diff --git a/Cargo.lock b/Cargo.lock index 3930b50220fc..450a87b4c0e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -523,7 +523,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "hash-db", "log", @@ -2506,7 +2506,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", ] @@ -2529,7 +2529,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-support-procedural", @@ -2554,7 +2554,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "Inflector", "array-bytes", @@ -2602,7 +2602,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2613,7 +2613,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2630,7 +2630,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-system", @@ -2659,7 +2659,7 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-recursion", "futures", @@ -2680,7 +2680,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "bitflags", "environmental", @@ -2714,7 +2714,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "Inflector", "cfg-expr", @@ -2732,7 +2732,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2744,7 +2744,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro2", "quote", @@ -2754,7 +2754,7 @@ dependencies = [ [[package]] name = "frame-support-test" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-executive", @@ -2781,19 +2781,20 @@ dependencies = [ [[package]] name = "frame-support-test-pallet" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-system", "parity-scale-codec", "scale-info", "serde", + "sp-runtime", ] [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "cfg-if", "frame-support", @@ -2812,7 +2813,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -2827,7 +2828,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "sp-api", @@ -2836,7 +2837,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "parity-scale-codec", @@ -3018,7 +3019,7 @@ dependencies = [ [[package]] name = "generate-bags" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "chrono", "frame-election-provider-support", @@ -4951,7 +4952,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "futures", "log", @@ -4970,7 +4971,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "anyhow", "jsonrpsee", @@ -5483,7 +5484,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5498,7 +5499,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-system", @@ -5514,7 +5515,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-system", @@ -5528,7 +5529,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5552,7 +5553,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5572,7 +5573,7 @@ dependencies = [ [[package]] name = "pallet-bags-list-remote-tests" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-election-provider-support", "frame-remote-externalities", @@ -5591,7 +5592,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5606,7 +5607,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-system", @@ -5625,7 +5626,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "binary-merkle-tree", @@ -5649,7 +5650,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5667,7 +5668,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5686,7 +5687,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5703,7 +5704,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "assert_matches", "frame-benchmarking", @@ -5720,7 +5721,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5738,7 +5739,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5761,7 +5762,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5774,7 +5775,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5793,7 +5794,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "docify", "frame-benchmarking", @@ -5812,7 +5813,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5835,7 +5836,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5851,7 +5852,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5871,7 +5872,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5888,7 +5889,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5905,7 +5906,7 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "7.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5924,7 +5925,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5941,7 +5942,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5957,7 +5958,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5973,7 +5974,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-system", @@ -5990,7 +5991,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6010,7 +6011,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -6021,7 +6022,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-system", @@ -6038,7 +6039,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6062,7 +6063,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6079,7 +6080,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6094,7 +6095,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6112,7 +6113,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6127,7 +6128,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6146,7 +6147,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6163,7 +6164,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-system", @@ -6184,7 +6185,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6200,7 +6201,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6219,7 +6220,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6242,7 +6243,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6253,7 +6254,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "log", "sp-arithmetic", @@ -6262,7 +6263,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "sp-api", @@ -6271,7 +6272,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6288,7 +6289,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6303,7 +6304,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6321,7 +6322,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6340,7 +6341,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-system", @@ -6356,7 +6357,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -6372,7 +6373,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6384,7 +6385,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6401,7 +6402,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6416,7 +6417,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6432,7 +6433,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6447,7 +6448,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -7492,6 +7493,7 @@ dependencies = [ name = "polkadot-node-core-runtime-api" version = "1.0.0" dependencies = [ + "async-trait", "futures", "lru 0.9.0", "polkadot-node-metrics", @@ -7502,7 +7504,6 @@ dependencies = [ "polkadot-primitives", "polkadot-primitives-test-helpers", "sp-api", - "sp-authority-discovery", "sp-consensus-babe", "sp-core", "sp-keyring", @@ -7542,7 +7543,6 @@ dependencies = [ "prioritized-metered-channel", "prometheus-parse", "sc-cli", - "sc-client-api", "sc-service", "sc-tracing", "sp-keyring", @@ -7639,6 +7639,7 @@ dependencies = [ "polkadot-primitives", "polkadot-statement-table", "sc-network", + "sc-transaction-pool-api", "smallvec", "sp-api", "sp-authority-discovery", @@ -8137,6 +8138,7 @@ dependencies = [ "sc-sysinfo", "sc-telemetry", "sc-transaction-pool", + "sc-transaction-pool-api", "serde", "serde_json", "sp-api", @@ -9564,7 +9566,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "log", "sp-core", @@ -9575,7 +9577,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "futures", @@ -9603,7 +9605,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "futures", "futures-timer", @@ -9626,7 +9628,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -9641,7 +9643,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -9660,7 +9662,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9671,7 +9673,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "chrono", @@ -9710,7 +9712,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "fnv", "futures", @@ -9726,7 +9728,6 @@ dependencies = [ "sp-core", "sp-database", "sp-externalities", - "sp-keystore", "sp-runtime", "sp-state-machine", "sp-statement-store", @@ -9737,7 +9738,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "hash-db", "kvdb", @@ -9763,7 +9764,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "futures", @@ -9788,7 +9789,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "fork-tree", @@ -9804,6 +9805,7 @@ dependencies = [ "sc-consensus-epochs", "sc-consensus-slots", "sc-telemetry", + "sc-transaction-pool-api", "scale-info", "sp-api", "sp-application-crypto", @@ -9823,7 +9825,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "futures", "jsonrpsee", @@ -9845,7 +9847,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "async-channel", @@ -9879,7 +9881,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "futures", "jsonrpsee", @@ -9898,7 +9900,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "fork-tree", "parity-scale-codec", @@ -9911,7 +9913,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "ahash 0.8.2", "array-bytes", @@ -9933,6 +9935,7 @@ dependencies = [ "sc-network-common", "sc-network-gossip", "sc-telemetry", + "sc-transaction-pool-api", "sc-utils", "serde_json", "sp-api", @@ -9951,7 +9954,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "finality-grandpa", "futures", @@ -9971,7 +9974,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "futures", @@ -9994,7 +9997,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", @@ -10016,7 +10019,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -10028,7 +10031,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "anyhow", "cfg-if", @@ -10045,7 +10048,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "ansi_term", "futures", @@ -10061,7 +10064,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "parking_lot 0.12.1", @@ -10075,7 +10078,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "async-channel", @@ -10116,7 +10119,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-channel", "cid", @@ -10136,7 +10139,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "bitflags", @@ -10153,7 +10156,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "ahash 0.8.2", "futures", @@ -10171,7 +10174,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "async-channel", @@ -10192,7 +10195,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "async-channel", @@ -10226,7 +10229,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "futures", @@ -10244,7 +10247,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "bytes", @@ -10254,6 +10257,7 @@ dependencies = [ "hyper", "hyper-rustls 0.24.0", "libp2p", + "log", "num_cpus", "once_cell", "parity-scale-codec", @@ -10261,9 +10265,13 @@ dependencies = [ "rand 0.8.5", "sc-client-api", "sc-network", + "sc-network-common", + "sc-transaction-pool-api", "sc-utils", "sp-api", "sp-core", + "sp-externalities", + "sp-keystore", "sp-offchain", "sp-runtime", "threadpool", @@ -10273,7 +10281,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -10282,7 +10290,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "futures", "jsonrpsee", @@ -10313,7 +10321,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10332,7 +10340,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "http", "jsonrpsee", @@ -10347,7 +10355,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "futures", @@ -10373,7 +10381,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "directories", @@ -10400,7 +10408,6 @@ dependencies = [ "sc-network-light", "sc-network-sync", "sc-network-transactions", - "sc-offchain", "sc-rpc", "sc-rpc-server", "sc-rpc-spec-v2", @@ -10438,7 +10445,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "log", "parity-scale-codec", @@ -10449,7 +10456,7 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "clap 4.2.5", "fs4", @@ -10463,7 +10470,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10482,7 +10489,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "futures", "libc", @@ -10501,7 +10508,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "chrono", "futures", @@ -10520,7 +10527,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "ansi_term", "atty", @@ -10549,7 +10556,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10560,7 +10567,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "futures", @@ -10586,7 +10593,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "futures", @@ -10602,7 +10609,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-channel", "futures", @@ -11150,7 +11157,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "hash-db", "log", @@ -11158,6 +11165,7 @@ dependencies = [ "scale-info", "sp-api-proc-macro", "sp-core", + "sp-externalities", "sp-metadata-ir", "sp-runtime", "sp-state-machine", @@ -11170,7 +11178,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "Inflector", "blake2", @@ -11184,7 +11192,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "23.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -11197,7 +11205,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "16.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "integer-sqrt", "num-traits", @@ -11211,7 +11219,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -11224,7 +11232,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "sp-api", "sp-inherents", @@ -11235,7 +11243,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "futures", "log", @@ -11253,7 +11261,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "futures", @@ -11268,7 +11276,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "parity-scale-codec", @@ -11285,7 +11293,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "parity-scale-codec", @@ -11304,7 +11312,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "lazy_static", "parity-scale-codec", @@ -11323,7 +11331,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "finality-grandpa", "log", @@ -11341,7 +11349,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -11353,7 +11361,7 @@ dependencies = [ [[package]] name = "sp-core" version = "21.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "bitflags", @@ -11391,13 +11399,14 @@ dependencies = [ "substrate-bip39", "thiserror", "tiny-bip39", + "tracing", "zeroize", ] [[package]] name = "sp-core-hashing" version = "9.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "blake2b_simd", "byteorder", @@ -11410,7 +11419,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "quote", "sp-core-hashing", @@ -11420,7 +11429,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -11429,7 +11438,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro2", "quote", @@ -11439,7 +11448,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "environmental", "parity-scale-codec", @@ -11450,7 +11459,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11464,7 +11473,7 @@ dependencies = [ [[package]] name = "sp-io" version = "23.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "bytes", "ed25519", @@ -11489,7 +11498,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "24.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "lazy_static", "sp-core", @@ -11500,7 +11509,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.27.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", @@ -11512,7 +11521,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "thiserror", "zstd 0.12.3+zstd.1.5.2", @@ -11521,7 +11530,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -11532,7 +11541,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -11550,7 +11559,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -11564,7 +11573,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "sp-api", "sp-core", @@ -11574,7 +11583,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "backtrace", "lazy_static", @@ -11584,7 +11593,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "rustc-hash", "serde", @@ -11594,7 +11603,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "24.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "either", "hash256-std-hasher", @@ -11616,7 +11625,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -11634,7 +11643,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "Inflector", "proc-macro-crate", @@ -11646,12 +11655,13 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", "sp-api", "sp-core", + "sp-keystore", "sp-runtime", "sp-staking", "sp-std", @@ -11660,7 +11670,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -11674,7 +11684,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.28.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "hash-db", "log", @@ -11695,7 +11705,7 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -11712,12 +11722,12 @@ dependencies = [ [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11730,7 +11740,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "parity-scale-codec", @@ -11743,7 +11753,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "sp-std", @@ -11755,7 +11765,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "sp-api", "sp-runtime", @@ -11764,7 +11774,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "parity-scale-codec", @@ -11779,7 +11789,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "22.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "ahash 0.8.2", "hash-db", @@ -11802,7 +11812,7 @@ dependencies = [ [[package]] name = "sp-version" version = "22.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11819,7 +11829,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -11830,7 +11840,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -11843,7 +11853,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "20.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -12084,12 +12094,12 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -12108,7 +12118,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "hyper", "log", @@ -12120,7 +12130,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "jsonrpsee", @@ -12133,7 +12143,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -12150,7 +12160,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "async-trait", @@ -12176,7 +12186,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "futures", "substrate-test-utils-derive", @@ -12186,7 +12196,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -12197,7 +12207,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "ansi_term", "build-helper", @@ -13101,7 +13111,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#2b76b44e6f7e948c8dffb7ff72d349f0702f5acf" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "clap 4.2.5", diff --git a/node/core/runtime-api/Cargo.toml b/node/core/runtime-api/Cargo.toml index e972505d65c8..da8aec2abe43 100644 --- a/node/core/runtime-api/Cargo.toml +++ b/node/core/runtime-api/Cargo.toml @@ -17,10 +17,10 @@ polkadot-node-subsystem = { path = "../../subsystem" } polkadot-node-subsystem-types = { path = "../../subsystem-types" } [dev-dependencies] -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sp-api = { git = "https://github.com/paritytech/substrate", branch ="polkadot-v1.0.0" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"} +async-trait = "0.1.57" futures = { version = "0.3.21", features = ["thread-pool"] } polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } polkadot-node-primitives = { path = "../../primitives" } diff --git a/node/core/runtime-api/src/tests.rs b/node/core/runtime-api/src/tests.rs index b5ba4fc08a78..27090a102ec2 100644 --- a/node/core/runtime-api/src/tests.rs +++ b/node/core/runtime-api/src/tests.rs @@ -16,233 +16,250 @@ use super::*; -use ::test_helpers::{dummy_committed_candidate_receipt, dummy_validation_code}; use polkadot_node_primitives::{BabeAllowedSlots, BabeEpoch, BabeEpochConfiguration}; use polkadot_node_subsystem::SpawnGlue; use polkadot_node_subsystem_test_helpers::make_subsystem_context; use polkadot_primitives::{ - runtime_api::ParachainHost, AuthorityDiscoveryId, Block, CandidateEvent, - CommittedCandidateReceipt, CoreState, GroupRotationInfo, Id as ParaId, InboundDownwardMessage, - InboundHrmpMessage, OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement, - ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash, - ValidatorId, ValidatorIndex, ValidatorSignature, + vstaging, AuthorityDiscoveryId, BlockNumber, CandidateCommitments, CandidateEvent, + CandidateHash, CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams, + GroupRotationInfo, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, + OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, + SessionIndex, SessionInfo, Slot, ValidationCode, ValidationCodeHash, ValidatorId, + ValidatorIndex, ValidatorSignature, }; -use sp_api::ProvideRuntimeApi; -use sp_authority_discovery::AuthorityDiscoveryApi; -use sp_consensus_babe::BabeApi; +use sp_api::ApiError; use sp_core::testing::TaskExecutor; use std::{ collections::{BTreeMap, HashMap}, sync::{Arc, Mutex}, }; +use test_helpers::{dummy_committed_candidate_receipt, dummy_validation_code}; -#[derive(Default, Clone)] -struct MockRuntimeApi { +#[derive(Default)] +struct MockSubsystemClient { + submitted_pvf_check_statement: Arc>>, authorities: Vec, validators: Vec, validator_groups: Vec>, availability_cores: Vec, - availability_cores_wait: Arc>, validation_data: HashMap, - session_index_for_child: SessionIndex, - session_info: HashMap, validation_code: HashMap, - validation_code_by_hash: HashMap, validation_outputs_results: HashMap, + session_index_for_child: SessionIndex, candidate_pending_availability: HashMap, - candidate_events: Vec, dmq_contents: HashMap>, hrmp_channels: HashMap>>, + validation_code_by_hash: HashMap, + availability_cores_wait: Arc>, babe_epoch: Option, - on_chain_votes: Option, - submitted_pvf_check_statement: Arc>>, pvfs_require_precheck: Vec, validation_code_hash: HashMap, + session_info: HashMap, + candidate_events: Vec, } -impl ProvideRuntimeApi for MockRuntimeApi { - type Api = Self; - - fn runtime_api<'a>(&'a self) -> sp_api::ApiRef<'a, Self::Api> { - self.clone().into() +#[async_trait::async_trait] +impl RuntimeApiSubsystemClient for MockSubsystemClient { + async fn api_version_parachain_host(&self, _: Hash) -> Result, ApiError> { + Ok(Some(5)) } -} -sp_api::mock_impl_runtime_apis! { - impl ParachainHost for MockRuntimeApi { - fn validators(&self) -> Vec { - self.validators.clone() - } + async fn validators(&self, _: Hash) -> Result, ApiError> { + Ok(self.validators.clone()) + } - fn validator_groups(&self) -> (Vec>, GroupRotationInfo) { - ( - self.validator_groups.clone(), - GroupRotationInfo { - session_start_block: 1, - group_rotation_frequency: 100, - now: 10, - }, - ) - } + async fn validator_groups( + &self, + _: Hash, + ) -> Result<(Vec>, GroupRotationInfo), ApiError> { + Ok(( + self.validator_groups.clone(), + GroupRotationInfo { session_start_block: 1, group_rotation_frequency: 100, now: 10 }, + )) + } - fn availability_cores(&self) -> Vec { - let _lock = self.availability_cores_wait.lock().unwrap(); - self.availability_cores.clone() - } + async fn availability_cores( + &self, + _: Hash, + ) -> Result>, ApiError> { + let _lock = self.availability_cores_wait.lock().unwrap(); + Ok(self.availability_cores.clone()) + } - fn persisted_validation_data( - &self, - para: ParaId, - _assumption: OccupiedCoreAssumption, - ) -> Option { - self.validation_data.get(¶).cloned() - } + async fn persisted_validation_data( + &self, + _: Hash, + para_id: ParaId, + _: OccupiedCoreAssumption, + ) -> Result>, ApiError> { + Ok(self.validation_data.get(¶_id).cloned()) + } - fn assumed_validation_data( - para_id: ParaId, - expected_persisted_validation_data_hash: Hash, - ) -> Option<(PersistedValidationData, ValidationCodeHash)> { - self.validation_data - .get(¶_id) - .cloned() - .filter(|data| data.hash() == expected_persisted_validation_data_hash) - .zip(self.validation_code.get(¶_id).map(|code| code.hash())) - } + async fn assumed_validation_data( + &self, + _: Hash, + para_id: ParaId, + expected_persisted_validation_data_hash: Hash, + ) -> Result, ValidationCodeHash)>, ApiError> + { + Ok(self + .validation_data + .get(¶_id) + .cloned() + .filter(|data| data.hash() == expected_persisted_validation_data_hash) + .zip(self.validation_code.get(¶_id).map(|code| code.hash()))) + } - fn check_validation_outputs( - &self, - para_id: ParaId, - _commitments: polkadot_primitives::CandidateCommitments, - ) -> bool { - self.validation_outputs_results - .get(¶_id) - .cloned() - .expect( - "`check_validation_outputs` called but the expected result hasn't been supplied" - ) - } + async fn check_validation_outputs( + &self, + _: Hash, + para_id: ParaId, + _: CandidateCommitments, + ) -> Result { + Ok(self.validation_outputs_results.get(¶_id).copied().unwrap()) + } - fn session_index_for_child(&self) -> SessionIndex { - self.session_index_for_child.clone() - } + async fn session_index_for_child(&self, _: Hash) -> Result { + Ok(self.session_index_for_child) + } - fn session_info(&self, index: SessionIndex) -> Option { - self.session_info.get(&index).cloned() - } + async fn validation_code( + &self, + _: Hash, + para_id: ParaId, + _: OccupiedCoreAssumption, + ) -> Result, ApiError> { + Ok(self.validation_code.get(¶_id).cloned()) + } - fn validation_code( - &self, - para: ParaId, - _assumption: OccupiedCoreAssumption, - ) -> Option { - self.validation_code.get(¶).map(|c| c.clone()) - } + async fn candidate_pending_availability( + &self, + _: Hash, + para_id: ParaId, + ) -> Result>, ApiError> { + Ok(self.candidate_pending_availability.get(¶_id).cloned()) + } - fn candidate_pending_availability( - &self, - para: ParaId, - ) -> Option { - self.candidate_pending_availability.get(¶).map(|c| c.clone()) - } + async fn candidate_events(&self, _: Hash) -> Result>, ApiError> { + Ok(self.candidate_events.clone()) + } - fn candidate_events(&self) -> Vec { - self.candidate_events.clone() - } + async fn dmq_contents( + &self, + _: Hash, + para_id: ParaId, + ) -> Result>, ApiError> { + Ok(self.dmq_contents.get(¶_id).cloned().unwrap()) + } - fn dmq_contents( - &self, - recipient: ParaId, - ) -> Vec { - self.dmq_contents.get(&recipient).map(|q| q.clone()).unwrap_or_default() - } + async fn inbound_hrmp_channels_contents( + &self, + _: Hash, + para_id: ParaId, + ) -> Result>>, ApiError> { + Ok(self.hrmp_channels.get(¶_id).cloned().unwrap()) + } - fn inbound_hrmp_channels_contents( - &self, - recipient: ParaId - ) -> BTreeMap> { - self.hrmp_channels.get(&recipient).map(|q| q.clone()).unwrap_or_default() - } + async fn validation_code_by_hash( + &self, + _: Hash, + hash: ValidationCodeHash, + ) -> Result, ApiError> { + Ok(self.validation_code_by_hash.get(&hash).cloned()) + } - fn validation_code_by_hash( - &self, - hash: ValidationCodeHash, - ) -> Option { - self.validation_code_by_hash.get(&hash).map(|c| c.clone()) - } + async fn on_chain_votes(&self, _: Hash) -> Result>, ApiError> { + todo!("Not required for tests") + } - fn on_chain_votes(&self) -> Option { - self.on_chain_votes.clone() - } + async fn session_info( + &self, + _: Hash, + index: SessionIndex, + ) -> Result, ApiError> { + Ok(self.session_info.get(&index).cloned()) + } - fn submit_pvf_check_statement(stmt: PvfCheckStatement, signature: ValidatorSignature) { - self - .submitted_pvf_check_statement - .lock() - .expect("poisoned mutext") - .push((stmt, signature)); - } + async fn submit_pvf_check_statement( + &self, + _: Hash, + stmt: PvfCheckStatement, + sig: ValidatorSignature, + ) -> Result<(), ApiError> { + self.submitted_pvf_check_statement.lock().unwrap().push((stmt, sig)); + Ok(()) + } - fn pvfs_require_precheck() -> Vec { - self.pvfs_require_precheck.clone() - } + async fn pvfs_require_precheck(&self, _: Hash) -> Result, ApiError> { + Ok(self.pvfs_require_precheck.clone()) + } - fn validation_code_hash( - &self, - para: ParaId, - _assumption: OccupiedCoreAssumption, - ) -> Option { - self.validation_code_hash.get(¶).map(|c| c.clone()) - } + async fn validation_code_hash( + &self, + _: Hash, + para_id: ParaId, + _: OccupiedCoreAssumption, + ) -> Result, ApiError> { + Ok(self.validation_code_hash.get(¶_id).cloned()) } - impl BabeApi for MockRuntimeApi { - fn configuration(&self) -> sp_consensus_babe::BabeConfiguration { - unimplemented!() - } + async fn disputes( + &self, + _: Hash, + ) -> Result)>, ApiError> { + todo!("Not required for tests") + } - fn current_epoch_start(&self) -> sp_consensus_babe::Slot { - self.babe_epoch.as_ref().unwrap().start_slot - } + async fn unapplied_slashes( + &self, + _: Hash, + ) -> Result, ApiError> { + todo!("Not required for tests") + } - fn current_epoch(&self) -> BabeEpoch { - self.babe_epoch.as_ref().unwrap().clone() - } + async fn key_ownership_proof( + &self, + _: Hash, + _: ValidatorId, + ) -> Result, ApiError> { + todo!("Not required for tests") + } - fn next_epoch(&self) -> BabeEpoch { - unimplemented!() - } + async fn submit_report_dispute_lost( + &self, + _: Hash, + _: vstaging::slashing::DisputeProof, + _: vstaging::slashing::OpaqueKeyOwnershipProof, + ) -> Result, ApiError> { + todo!("Not required for tests") + } - fn generate_key_ownership_proof( - _slot: sp_consensus_babe::Slot, - _authority_id: sp_consensus_babe::AuthorityId, - ) -> Option { - None - } + async fn session_executor_params( + &self, + _: Hash, + _: SessionIndex, + ) -> Result, ApiError> { + todo!("Not required for tests") + } - fn submit_report_equivocation_unsigned_extrinsic( - _equivocation_proof: sp_consensus_babe::EquivocationProof, - _key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof, - ) -> Option<()> { - None - } + async fn current_epoch(&self, _: Hash) -> Result { + Ok(self.babe_epoch.as_ref().unwrap().clone()) } - impl AuthorityDiscoveryApi for MockRuntimeApi { - fn authorities(&self) -> Vec { - self.authorities.clone() - } + async fn authorities(&self, _: Hash) -> Result, ApiError> { + Ok(self.authorities.clone()) } } #[test] fn requests_authorities() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); - let runtime_api = Arc::new(MockRuntimeApi::default()); + let substem_client = Arc::new(MockSubsystemClient::default()); let relay_parent = [1; 32].into(); let spawner = sp_core::testing::TaskExecutor::new(); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(substem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -253,7 +270,7 @@ fn requests_authorities() { }) .await; - assert_eq!(rx.await.unwrap().unwrap(), runtime_api.authorities); + assert_eq!(rx.await.unwrap().unwrap(), substem_client.authorities); ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await; }; @@ -264,12 +281,12 @@ fn requests_authorities() { #[test] fn requests_validators() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); - let runtime_api = Arc::new(MockRuntimeApi::default()); + let subsystem_client = Arc::new(MockSubsystemClient::default()); let relay_parent = [1; 32].into(); let spawner = sp_core::testing::TaskExecutor::new(); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -280,7 +297,7 @@ fn requests_validators() { }) .await; - assert_eq!(rx.await.unwrap().unwrap(), runtime_api.validators); + assert_eq!(rx.await.unwrap().unwrap(), subsystem_client.validators); ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await; }; @@ -291,12 +308,12 @@ fn requests_validators() { #[test] fn requests_validator_groups() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); - let runtime_api = Arc::new(MockRuntimeApi::default()); + let subsystem_client = Arc::new(MockSubsystemClient::default()); let relay_parent = [1; 32].into(); let spawner = sp_core::testing::TaskExecutor::new(); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -307,7 +324,7 @@ fn requests_validator_groups() { }) .await; - assert_eq!(rx.await.unwrap().unwrap().0, runtime_api.validator_groups); + assert_eq!(rx.await.unwrap().unwrap().0, subsystem_client.validator_groups); ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await; }; @@ -318,12 +335,12 @@ fn requests_validator_groups() { #[test] fn requests_availability_cores() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); - let runtime_api = Arc::new(MockRuntimeApi::default()); + let subsystem_client = Arc::new(MockSubsystemClient::default()); let relay_parent = [1; 32].into(); let spawner = sp_core::testing::TaskExecutor::new(); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -334,7 +351,7 @@ fn requests_availability_cores() { }) .await; - assert_eq!(rx.await.unwrap().unwrap(), runtime_api.availability_cores); + assert_eq!(rx.await.unwrap().unwrap(), subsystem_client.availability_cores); ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await; }; @@ -350,12 +367,12 @@ fn requests_persisted_validation_data() { let para_b = ParaId::from(6_u32); let spawner = sp_core::testing::TaskExecutor::new(); - let mut runtime_api = MockRuntimeApi::default(); - runtime_api.validation_data.insert(para_a, Default::default()); - let runtime_api = Arc::new(runtime_api); + let mut subsystem_client = MockSubsystemClient::default(); + subsystem_client.validation_data.insert(para_a, Default::default()); + let subsystem_client = Arc::new(subsystem_client); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -401,14 +418,14 @@ fn requests_assumed_validation_data() { let expected_data_hash = ::default().hash(); let expected_code_hash = validation_code.hash(); - let mut runtime_api = MockRuntimeApi::default(); - runtime_api.validation_data.insert(para_a, Default::default()); - runtime_api.validation_code.insert(para_a, validation_code); - runtime_api.validation_data.insert(para_b, Default::default()); - let runtime_api = Arc::new(runtime_api); + let mut subsystem_client = MockSubsystemClient::default(); + subsystem_client.validation_data.insert(para_a, Default::default()); + subsystem_client.validation_code.insert(para_a, validation_code); + subsystem_client.validation_data.insert(para_b, Default::default()); + let subsystem_client = Arc::new(subsystem_client); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -445,20 +462,20 @@ fn requests_assumed_validation_data() { #[test] fn requests_check_validation_outputs() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); - let mut runtime_api = MockRuntimeApi::default(); + let mut subsystem_client = MockSubsystemClient::default(); let relay_parent = [1; 32].into(); let para_a = ParaId::from(5_u32); let para_b = ParaId::from(6_u32); let commitments = polkadot_primitives::CandidateCommitments::default(); let spawner = sp_core::testing::TaskExecutor::new(); - runtime_api.validation_outputs_results.insert(para_a, false); - runtime_api.validation_outputs_results.insert(para_b, true); + subsystem_client.validation_outputs_results.insert(para_a, false); + subsystem_client.validation_outputs_results.insert(para_b, true); - let runtime_api = Arc::new(runtime_api); + let subsystem_client = Arc::new(subsystem_client); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -471,7 +488,10 @@ fn requests_check_validation_outputs() { ), }) .await; - assert_eq!(rx.await.unwrap().unwrap(), runtime_api.validation_outputs_results[¶_a]); + assert_eq!( + rx.await.unwrap().unwrap(), + subsystem_client.validation_outputs_results[¶_a] + ); let (tx, rx) = oneshot::channel(); ctx_handle @@ -482,7 +502,10 @@ fn requests_check_validation_outputs() { ), }) .await; - assert_eq!(rx.await.unwrap().unwrap(), runtime_api.validation_outputs_results[¶_b]); + assert_eq!( + rx.await.unwrap().unwrap(), + subsystem_client.validation_outputs_results[¶_b] + ); ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await; }; @@ -493,12 +516,12 @@ fn requests_check_validation_outputs() { #[test] fn requests_session_index_for_child() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); - let runtime_api = Arc::new(MockRuntimeApi::default()); + let subsystem_client = Arc::new(MockSubsystemClient::default()); let relay_parent = [1; 32].into(); let spawner = sp_core::testing::TaskExecutor::new(); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -509,7 +532,7 @@ fn requests_session_index_for_child() { }) .await; - assert_eq!(rx.await.unwrap().unwrap(), runtime_api.session_index_for_child); + assert_eq!(rx.await.unwrap().unwrap(), subsystem_client.session_index_for_child); ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await; }; @@ -537,16 +560,16 @@ fn dummy_session_info() -> SessionInfo { #[test] fn requests_session_info() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); - let mut runtime_api = MockRuntimeApi::default(); + let mut subsystem_client = MockSubsystemClient::default(); let session_index = 1; - runtime_api.session_info.insert(session_index, dummy_session_info()); - let runtime_api = Arc::new(runtime_api); + subsystem_client.session_info.insert(session_index, dummy_session_info()); + let subsystem_client = Arc::new(subsystem_client); let spawner = sp_core::testing::TaskExecutor::new(); let relay_parent = [1; 32].into(); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -578,12 +601,12 @@ fn requests_validation_code() { let spawner = sp_core::testing::TaskExecutor::new(); let validation_code = dummy_validation_code(); - let mut runtime_api = MockRuntimeApi::default(); - runtime_api.validation_code.insert(para_a, validation_code.clone()); - let runtime_api = Arc::new(runtime_api); + let mut subsystem_client = MockSubsystemClient::default(); + subsystem_client.validation_code.insert(para_a, validation_code.clone()); + let subsystem_client = Arc::new(subsystem_client); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -626,14 +649,14 @@ fn requests_candidate_pending_availability() { let spawner = sp_core::testing::TaskExecutor::new(); let candidate_receipt = dummy_committed_candidate_receipt(relay_parent); - let mut runtime_api = MockRuntimeApi::default(); - runtime_api + let mut subsystem_client = MockSubsystemClient::default(); + subsystem_client .candidate_pending_availability .insert(para_a, candidate_receipt.clone()); - let runtime_api = Arc::new(runtime_api); + let subsystem_client = Arc::new(subsystem_client); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -671,12 +694,12 @@ fn requests_candidate_pending_availability() { #[test] fn requests_candidate_events() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); - let runtime_api = Arc::new(MockRuntimeApi::default()); + let subsystem_client = Arc::new(MockSubsystemClient::default()); let relay_parent = [1; 32].into(); let spawner = sp_core::testing::TaskExecutor::new(); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -687,7 +710,7 @@ fn requests_candidate_events() { }) .await; - assert_eq!(rx.await.unwrap().unwrap(), runtime_api.candidate_events); + assert_eq!(rx.await.unwrap().unwrap(), subsystem_client.candidate_events); ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await; }; @@ -704,20 +727,20 @@ fn requests_dmq_contents() { let para_b = ParaId::from(6_u32); let spawner = sp_core::testing::TaskExecutor::new(); - let runtime_api = Arc::new({ - let mut runtime_api = MockRuntimeApi::default(); + let subsystem_client = Arc::new({ + let mut subsystem_client = MockSubsystemClient::default(); - runtime_api.dmq_contents.insert(para_a, vec![]); - runtime_api.dmq_contents.insert( + subsystem_client.dmq_contents.insert(para_a, vec![]); + subsystem_client.dmq_contents.insert( para_b, vec![InboundDownwardMessage { sent_at: 228, msg: b"Novus Ordo Seclorum".to_vec() }], ); - runtime_api + subsystem_client }); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -758,21 +781,20 @@ fn requests_inbound_hrmp_channels_contents() { (para_a, vec![]), (para_c, vec![InboundHrmpMessage { sent_at: 1, data: "𝙀=𝙈𝘾²".as_bytes().to_owned() }]), ] - .iter() - .cloned() + .into_iter() .collect::>(); - let runtime_api = Arc::new({ - let mut runtime_api = MockRuntimeApi::default(); + let subsystem_client = Arc::new({ + let mut subsystem_client = MockSubsystemClient::default(); - runtime_api.hrmp_channels.insert(para_a, BTreeMap::new()); - runtime_api.hrmp_channels.insert(para_b, para_b_inbound_channels.clone()); + subsystem_client.hrmp_channels.insert(para_a, BTreeMap::new()); + subsystem_client.hrmp_channels.insert(para_b, para_b_inbound_channels.clone()); - runtime_api + subsystem_client }); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -807,21 +829,21 @@ fn requests_validation_code_by_hash() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); let spawner = sp_core::testing::TaskExecutor::new(); - let (runtime_api, validation_code) = { - let mut runtime_api = MockRuntimeApi::default(); + let (subsystem_client, validation_code) = { + let mut subsystem_client = MockSubsystemClient::default(); let mut validation_code = Vec::new(); for n in 0..5 { let code = ValidationCode::from(vec![n; 32]); - runtime_api.validation_code_by_hash.insert(code.hash(), code.clone()); + subsystem_client.validation_code_by_hash.insert(code.hash(), code.clone()); validation_code.push(code); } - (runtime_api, validation_code) + (Arc::new(subsystem_client), validation_code) }; let subsystem = - RuntimeApiSubsystem::new(Arc::new(runtime_api), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let relay_parent = [1; 32].into(); @@ -849,13 +871,13 @@ fn requests_validation_code_by_hash() { #[test] fn multiple_requests_in_parallel_are_working() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); - let runtime_api = Arc::new(MockRuntimeApi::default()); + let subsystem_client = Arc::new(MockSubsystemClient::default()); let relay_parent = [1; 32].into(); let spawner = sp_core::testing::TaskExecutor::new(); - let mutex = runtime_api.availability_cores_wait.clone(); + let mutex = subsystem_client.availability_cores_wait.clone(); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { // Make all requests block until we release this mutex. @@ -891,7 +913,7 @@ fn multiple_requests_in_parallel_are_working() { join.await .into_iter() - .for_each(|r| assert_eq!(r.unwrap().unwrap(), runtime_api.availability_cores)); + .for_each(|r| assert_eq!(r.unwrap().unwrap(), subsystem_client.availability_cores)); ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await; }; @@ -902,22 +924,22 @@ fn multiple_requests_in_parallel_are_working() { #[test] fn requests_babe_epoch() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); - let mut runtime_api = MockRuntimeApi::default(); + let mut subsystem_client = MockSubsystemClient::default(); let epoch = BabeEpoch { epoch_index: 100, - start_slot: sp_consensus_babe::Slot::from(1000), + start_slot: Slot::from(1000), duration: 10, authorities: Vec::new(), randomness: [1u8; 32], config: BabeEpochConfiguration { c: (1, 4), allowed_slots: BabeAllowedSlots::PrimarySlots }, }; - runtime_api.babe_epoch = Some(epoch.clone()); - let runtime_api = Arc::new(runtime_api); + subsystem_client.babe_epoch = Some(epoch.clone()); + let subsystem_client = Arc::new(subsystem_client); let relay_parent = [1; 32].into(); let spawner = sp_core::testing::TaskExecutor::new(); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); @@ -939,10 +961,10 @@ fn requests_babe_epoch() { fn requests_submit_pvf_check_statement() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); let spawner = sp_core::testing::TaskExecutor::new(); + let subsystem_client = Arc::new(MockSubsystemClient::default()); - let runtime_api = Arc::new(MockRuntimeApi::default()); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let relay_parent = [1; 32].into(); @@ -974,7 +996,7 @@ fn requests_submit_pvf_check_statement() { assert_eq!(rx.await.unwrap().unwrap(), ()); assert_eq!( - &*runtime_api.submitted_pvf_check_statement.lock().expect("poisened mutex"), + &*subsystem_client.submitted_pvf_check_statement.lock().expect("poisened mutex"), &[(stmt.clone(), sig.clone()), (stmt.clone(), sig.clone())] ); @@ -1000,14 +1022,14 @@ fn requests_pvfs_require_precheck() { let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new()); let spawner = sp_core::testing::TaskExecutor::new(); - let runtime_api = Arc::new({ - let mut runtime_api = MockRuntimeApi::default(); - runtime_api.pvfs_require_precheck = vec![[1; 32].into(), [2; 32].into()]; - runtime_api + let subsystem_client = Arc::new({ + let mut subsystem_client = MockSubsystemClient::default(); + subsystem_client.pvfs_require_precheck = vec![[1; 32].into(), [2; 32].into()]; + subsystem_client }); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let relay_parent = [1; 32].into(); @@ -1037,12 +1059,14 @@ fn requests_validation_code_hash() { let spawner = sp_core::testing::TaskExecutor::new(); let validation_code_hash = dummy_validation_code().hash(); - let mut runtime_api = MockRuntimeApi::default(); - runtime_api.validation_code_hash.insert(para_a, validation_code_hash.clone()); - let runtime_api = Arc::new(runtime_api); + let mut subsystem_client = MockSubsystemClient::default(); + subsystem_client + .validation_code_hash + .insert(para_a, validation_code_hash.clone()); + let subsystem_client = Arc::new(subsystem_client); let subsystem = - RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner)); + RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner)); let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap()); let test_task = async move { let (tx, rx) = oneshot::channel(); diff --git a/node/malus/src/variants/back_garbage_candidate.rs b/node/malus/src/variants/back_garbage_candidate.rs index d0d21f783dff..45f1aa2e0b7f 100644 --- a/node/malus/src/variants/back_garbage_candidate.rs +++ b/node/malus/src/variants/back_garbage_candidate.rs @@ -28,6 +28,7 @@ use polkadot_cli::{ Cli, }; use polkadot_node_subsystem::SpawnGlue; +use polkadot_node_subsystem_types::DefaultSubsystemClient; use sp_core::traits::SpawnNamed; use crate::{ @@ -62,7 +63,10 @@ impl OverseerGen for BackGarbageCandidates { &self, connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, - ) -> Result<(Overseer, Arc>, OverseerHandle), Error> + ) -> Result< + (Overseer, Arc>>, OverseerHandle), + Error, + > where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, diff --git a/node/malus/src/variants/dispute_valid_candidates.rs b/node/malus/src/variants/dispute_valid_candidates.rs index 89504d76fbe6..ab1fba478beb 100644 --- a/node/malus/src/variants/dispute_valid_candidates.rs +++ b/node/malus/src/variants/dispute_valid_candidates.rs @@ -32,6 +32,7 @@ use polkadot_cli::{ Cli, }; use polkadot_node_subsystem::SpawnGlue; +use polkadot_node_subsystem_types::DefaultSubsystemClient; use sp_core::traits::SpawnNamed; // Filter wrapping related types. @@ -78,7 +79,10 @@ impl OverseerGen for DisputeValidCandidates { &self, connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, - ) -> Result<(Overseer, Arc>, OverseerHandle), Error> + ) -> Result< + (Overseer, Arc>>, OverseerHandle), + Error, + > where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, diff --git a/node/malus/src/variants/suggest_garbage_candidate.rs b/node/malus/src/variants/suggest_garbage_candidate.rs index 049cfc2b153d..9fd8f6473bde 100644 --- a/node/malus/src/variants/suggest_garbage_candidate.rs +++ b/node/malus/src/variants/suggest_garbage_candidate.rs @@ -33,6 +33,7 @@ use polkadot_cli::{ }; use polkadot_node_core_candidate_validation::find_validation_data; use polkadot_node_primitives::{AvailableData, BlockData, PoV}; +use polkadot_node_subsystem_types::DefaultSubsystemClient; use polkadot_primitives::{CandidateDescriptor, CandidateReceipt}; use polkadot_node_subsystem_util::request_validators; @@ -255,7 +256,10 @@ impl OverseerGen for SuggestGarbageCandidates { &self, connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, - ) -> Result<(Overseer, Arc>, OverseerHandle), Error> + ) -> Result< + (Overseer, Arc>>, OverseerHandle), + Error, + > where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, diff --git a/node/metrics/Cargo.toml b/node/metrics/Cargo.toml index 66dc12daedf6..aaa364522efc 100644 --- a/node/metrics/Cargo.toml +++ b/node/metrics/Cargo.toml @@ -32,7 +32,6 @@ polkadot-test-service = { path = "../test/service", features=["runtime-metrics"] substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } prometheus-parse = {version = "0.2.2"} [features] diff --git a/node/metrics/src/tests.rs b/node/metrics/src/tests.rs index f8f988e1f665..68abfeebc124 100644 --- a/node/metrics/src/tests.rs +++ b/node/metrics/src/tests.rs @@ -19,7 +19,6 @@ use hyper::{Client, Uri}; use polkadot_test_service::{node_config, run_validator_node, test_prometheus_config}; use primitives::metric_definitions::PARACHAIN_INHERENT_DATA_BITFIELDS_PROCESSED; -use sc_client_api::{execution_extensions::ExecutionStrategies, ExecutionStrategy}; use sp_keyring::AccountKeyring::*; use std::collections::HashMap; @@ -41,15 +40,6 @@ async fn runtime_can_publish_metrics() { // Setup the runtime metrics provider. crate::logger_hook()(&mut builder, &alice_config); - // Override default native strategy, runtime metrics are available only in the wasm runtime. - alice_config.execution_strategies = ExecutionStrategies { - syncing: ExecutionStrategy::AlwaysWasm, - importing: ExecutionStrategy::AlwaysWasm, - block_construction: ExecutionStrategy::AlwaysWasm, - offchain_worker: ExecutionStrategy::AlwaysWasm, - other: ExecutionStrategy::AlwaysWasm, - }; - builder.init().expect("Failed to set up the logger"); // Start validator Alice. diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 6bcb50eef5cc..2b7389bb5791 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -24,6 +24,7 @@ sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkad sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } sc-sync-state-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index 19bd0ce381fc..1253cd182264 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -350,7 +350,7 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Runt const STASH: u128 = 100 * DOT; polkadot::RuntimeGenesisConfig { - system: polkadot::SystemConfig { code: wasm_binary.to_vec() }, + system: polkadot::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() }, balances: polkadot::BalancesConfig { balances: endowed_accounts .iter() @@ -401,10 +401,14 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Runt babe: polkadot::BabeConfig { authorities: Default::default(), epoch_config: Some(polkadot::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, grandpa: Default::default(), im_online: Default::default(), - authority_discovery: polkadot::AuthorityDiscoveryConfig { keys: vec![] }, + authority_discovery: polkadot::AuthorityDiscoveryConfig { + keys: vec![], + ..Default::default() + }, claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] }, vesting: polkadot::VestingConfig { vesting: vec![] }, treasury: Default::default(), @@ -541,7 +545,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Runtim const STASH: u128 = 100 * WND; westend::RuntimeGenesisConfig { - system: westend::SystemConfig { code: wasm_binary.to_vec() }, + system: westend::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() }, balances: westend::BalancesConfig { balances: endowed_accounts .iter() @@ -584,10 +588,14 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Runtim babe: westend::BabeConfig { authorities: Default::default(), epoch_config: Some(westend::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, grandpa: Default::default(), im_online: Default::default(), - authority_discovery: westend::AuthorityDiscoveryConfig { keys: vec![] }, + authority_discovery: westend::AuthorityDiscoveryConfig { + keys: vec![], + ..Default::default() + }, vesting: westend::VestingConfig { vesting: vec![] }, sudo: westend::SudoConfig { key: Some(endowed_accounts[0].clone()) }, hrmp: Default::default(), @@ -597,6 +605,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Runtim paras: Default::default(), registrar: westend_runtime::RegistrarConfig { next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, + ..Default::default() }, xcm_pallet: Default::default(), nomination_pools: Default::default(), @@ -731,7 +740,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::RuntimeG const STASH: u128 = 100 * KSM; kusama::RuntimeGenesisConfig { - system: kusama::SystemConfig { code: wasm_binary.to_vec() }, + system: kusama::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() }, balances: kusama::BalancesConfig { balances: endowed_accounts .iter() @@ -774,10 +783,14 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::RuntimeG babe: kusama::BabeConfig { authorities: Default::default(), epoch_config: Some(kusama::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, grandpa: Default::default(), im_online: Default::default(), - authority_discovery: kusama::AuthorityDiscoveryConfig { keys: vec![] }, + authority_discovery: kusama::AuthorityDiscoveryConfig { + keys: vec![], + ..Default::default() + }, claims: kusama::ClaimsConfig { claims: vec![], vesting: vec![] }, vesting: kusama::VestingConfig { vesting: vec![] }, treasury: Default::default(), @@ -1039,7 +1052,7 @@ fn rococo_staging_testnet_config_genesis( const STASH: u128 = 100 * ROC; rococo_runtime::RuntimeGenesisConfig { - system: rococo_runtime::SystemConfig { code: wasm_binary.to_vec() }, + system: rococo_runtime::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() }, balances: rococo_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -1073,6 +1086,7 @@ fn rococo_staging_testnet_config_genesis( babe: rococo_runtime::BabeConfig { authorities: Default::default(), epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, grandpa: Default::default(), im_online: Default::default(), @@ -1084,17 +1098,21 @@ fn rococo_staging_testnet_config_genesis( }, technical_membership: Default::default(), treasury: Default::default(), - authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, + authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { + keys: vec![], + ..Default::default() + }, claims: rococo::ClaimsConfig { claims: vec![], vesting: vec![] }, vesting: rococo::VestingConfig { vesting: vec![] }, sudo: rococo_runtime::SudoConfig { key: Some(endowed_accounts[0].clone()) }, - paras: rococo_runtime::ParasConfig { paras: vec![] }, + paras: rococo_runtime::ParasConfig { paras: vec![], ..Default::default() }, hrmp: Default::default(), configuration: rococo_runtime::ConfigurationConfig { config: default_parachains_host_configuration(), }, registrar: rococo_runtime::RegistrarConfig { next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, + ..Default::default() }, xcm_pallet: Default::default(), nis_counterpart_balances: Default::default(), @@ -1347,7 +1365,7 @@ pub fn polkadot_testnet_genesis( const STASH: u128 = 100 * DOT; polkadot::RuntimeGenesisConfig { - system: polkadot::SystemConfig { code: wasm_binary.to_vec() }, + system: polkadot::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() }, indices: polkadot::IndicesConfig { indices: vec![] }, balances: polkadot::BalancesConfig { balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(), @@ -1394,10 +1412,14 @@ pub fn polkadot_testnet_genesis( babe: polkadot::BabeConfig { authorities: Default::default(), epoch_config: Some(polkadot::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, grandpa: Default::default(), im_online: Default::default(), - authority_discovery: polkadot::AuthorityDiscoveryConfig { keys: vec![] }, + authority_discovery: polkadot::AuthorityDiscoveryConfig { + keys: vec![], + ..Default::default() + }, claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] }, vesting: polkadot::VestingConfig { vesting: vec![] }, treasury: Default::default(), @@ -1434,7 +1456,7 @@ pub fn kusama_testnet_genesis( const STASH: u128 = 100 * KSM; kusama::RuntimeGenesisConfig { - system: kusama::SystemConfig { code: wasm_binary.to_vec() }, + system: kusama::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() }, indices: kusama::IndicesConfig { indices: vec![] }, balances: kusama::BalancesConfig { balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(), @@ -1473,10 +1495,14 @@ pub fn kusama_testnet_genesis( babe: kusama::BabeConfig { authorities: Default::default(), epoch_config: Some(kusama::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, grandpa: Default::default(), im_online: Default::default(), - authority_discovery: kusama::AuthorityDiscoveryConfig { keys: vec![] }, + authority_discovery: kusama::AuthorityDiscoveryConfig { + keys: vec![], + ..Default::default() + }, claims: kusama::ClaimsConfig { claims: vec![], vesting: vec![] }, vesting: kusama::VestingConfig { vesting: vec![] }, treasury: Default::default(), @@ -1514,7 +1540,7 @@ pub fn westend_testnet_genesis( const STASH: u128 = 100 * WND; westend::RuntimeGenesisConfig { - system: westend::SystemConfig { code: wasm_binary.to_vec() }, + system: westend::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() }, indices: westend::IndicesConfig { indices: vec![] }, balances: westend::BalancesConfig { balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(), @@ -1553,10 +1579,14 @@ pub fn westend_testnet_genesis( babe: westend::BabeConfig { authorities: Default::default(), epoch_config: Some(westend::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, grandpa: Default::default(), im_online: Default::default(), - authority_discovery: westend::AuthorityDiscoveryConfig { keys: vec![] }, + authority_discovery: westend::AuthorityDiscoveryConfig { + keys: vec![], + ..Default::default() + }, vesting: westend::VestingConfig { vesting: vec![] }, sudo: westend::SudoConfig { key: Some(root_key) }, hrmp: Default::default(), @@ -1566,6 +1596,7 @@ pub fn westend_testnet_genesis( paras: Default::default(), registrar: westend_runtime::RegistrarConfig { next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, + ..Default::default() }, xcm_pallet: Default::default(), nomination_pools: Default::default(), @@ -1595,7 +1626,7 @@ pub fn rococo_testnet_genesis( const ENDOWMENT: u128 = 1_000_000 * ROC; rococo_runtime::RuntimeGenesisConfig { - system: rococo_runtime::SystemConfig { code: wasm_binary.to_vec() }, + system: rococo_runtime::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() }, beefy: Default::default(), indices: rococo_runtime::IndicesConfig { indices: vec![] }, balances: rococo_runtime::BalancesConfig { @@ -1624,6 +1655,7 @@ pub fn rococo_testnet_genesis( babe: rococo_runtime::BabeConfig { authorities: Default::default(), epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, grandpa: Default::default(), im_online: Default::default(), @@ -1638,7 +1670,10 @@ pub fn rococo_testnet_genesis( treasury: Default::default(), claims: rococo::ClaimsConfig { claims: vec![], vesting: vec![] }, vesting: rococo::VestingConfig { vesting: vec![] }, - authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, + authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { + keys: vec![], + ..Default::default() + }, sudo: rococo_runtime::SudoConfig { key: Some(root_key.clone()) }, hrmp: Default::default(), configuration: rococo_runtime::ConfigurationConfig { @@ -1647,9 +1682,10 @@ pub fn rococo_testnet_genesis( ..default_parachains_host_configuration() }, }, - paras: rococo_runtime::ParasConfig { paras: vec![] }, + paras: rococo_runtime::ParasConfig { paras: vec![], ..Default::default() }, registrar: rococo_runtime::RegistrarConfig { next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, + ..Default::default() }, xcm_pallet: Default::default(), nis_counterpart_balances: Default::default(), diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index ed5e5361085e..0e54b458eb21 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -52,6 +52,7 @@ use { peer_set::PeerSetProtocolNames, request_response::ReqProtocolNames, }, sc_client_api::BlockBackend, + sc_transaction_pool_api::OffchainTransactionPoolFactory, sp_core::traits::SpawnNamed, sp_trie::PrefixedMemoryDB, }; @@ -87,7 +88,7 @@ pub use consensus_common::{Proposal, SelectChain}; use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; use mmr_gadget::MmrGadget; pub use polkadot_primitives::{Block, BlockId, BlockNumber, CollatorPair, Hash, Id as ParaId}; -pub use sc_client_api::{Backend, CallExecutor, ExecutionStrategy}; +pub use sc_client_api::{Backend, CallExecutor}; pub use sc_consensus::{BlockImport, LongestChain}; pub use sc_executor::NativeExecutionDispatch; use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY}; @@ -513,13 +514,13 @@ where babe::block_import(babe_config.clone(), beefy_block_import, client.clone())?; let slot_duration = babe_link.config().slot_duration(); - let (import_queue, babe_worker_handle) = babe::import_queue( - babe_link.clone(), - block_import.clone(), - Some(Box::new(justification_import)), - client.clone(), - select_chain.clone(), - move |_, ()| async move { + let (import_queue, babe_worker_handle) = babe::import_queue(babe::ImportQueueParams { + link: babe_link.clone(), + block_import: block_import.clone(), + justification_import: Some(Box::new(justification_import)), + client: client.clone(), + select_chain: select_chain.clone(), + create_inherent_data_providers: move |_, ()| async move { let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); let slot = @@ -530,10 +531,11 @@ where Ok((slot, timestamp)) }, - &task_manager.spawn_essential_handle(), - config.prometheus_registry(), - telemetry.as_ref().map(|x| x.handle()), - )?; + spawner: &task_manager.spawn_essential_handle(), + registry: config.prometheus_registry(), + telemetry: telemetry.as_ref().map(|x| x.handle()), + offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool.clone()), + })?; let justification_stream = grandpa_link.justification_stream(); let shared_authority_set = grandpa_link.shared_authority_set().clone(); @@ -579,9 +581,10 @@ where beefy_best_block_stream: beefy_rpc_links.from_voter_best_beefy_stream.clone(), subscription_executor, }, + backend: backend.clone(), }; - polkadot_rpc::create_full(deps, backend.clone()).map_err(Into::into) + polkadot_rpc::create_full(deps).map_err(Into::into) } }; @@ -824,22 +827,25 @@ where })?; if config.offchain_worker.enabled { - let offchain_workers = Arc::new(sc_offchain::OffchainWorkers::new_with_options( - client.clone(), - sc_offchain::OffchainWorkerOptions { enable_http_requests: false }, - )); + use futures::FutureExt; - // Start the offchain workers to have task_manager.spawn_handle().spawn( - "offchain-notifications", - None, - sc_offchain::notification_future( - config.role.is_authority(), - client.clone(), - offchain_workers, - task_manager.spawn_handle().clone(), - network.clone(), - ), + "offchain-workers-runner", + "offchain-work", + sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions { + runtime_api_provider: client.clone(), + keystore: Some(keystore_container.keystore()), + offchain_db: backend.offchain_storage(), + transaction_pool: Some(OffchainTransactionPoolFactory::new( + transaction_pool.clone(), + )), + network_provider: network.clone(), + is_validator: role.is_authority(), + enable_http_requests: false, + custom_extensions: move |_| vec![], + }) + .run(client.clone(), task_manager.spawn_handle()) + .boxed(), ); } @@ -981,6 +987,9 @@ where overseer_message_channel_capacity_override, req_protocol_names, peerset_protocol_names, + offchain_transaction_pool_factory: OffchainTransactionPoolFactory::new( + transaction_pool.clone(), + ), }, ) .map_err(|e| { @@ -1026,7 +1035,7 @@ where let proposer = sc_basic_authorship::ProposerFactory::new( task_manager.spawn_handle(), client.clone(), - transaction_pool, + transaction_pool.clone(), prometheus_registry.as_ref(), telemetry.as_ref().map(|x| x.handle()), ); @@ -1186,6 +1195,7 @@ where prometheus_registry: prometheus_registry.clone(), shared_voter_state, telemetry: telemetry.as_ref().map(|x| x.handle()), + offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool.clone()), }; task_manager.spawn_essential_handle().spawn_blocking( diff --git a/node/service/src/overseer.rs b/node/service/src/overseer.rs index afb7ec998b49..b1172cd9a549 100644 --- a/node/service/src/overseer.rs +++ b/node/service/src/overseer.rs @@ -15,6 +15,8 @@ // along with Polkadot. If not, see . use super::{AuthorityDiscoveryApi, Block, Error, Hash, IsCollator, Registry}; +use polkadot_node_subsystem_types::DefaultSubsystemClient; +use sc_transaction_pool_api::OffchainTransactionPoolFactory; use sp_core::traits::SpawnNamed; use lru::LruCache; @@ -125,6 +127,8 @@ where pub req_protocol_names: ReqProtocolNames, /// [`PeerSet`] protocol names to protocols mapping. pub peerset_protocol_names: PeerSetProtocolNames, + /// The offchain transaction pool factory. + pub offchain_transaction_pool_factory: OffchainTransactionPoolFactory, } /// Obtain a prepared `OverseerBuilder`, that is initialized @@ -155,11 +159,12 @@ pub fn prepared_overseer_builder( overseer_message_channel_capacity_override, req_protocol_names, peerset_protocol_names, + offchain_transaction_pool_factory, }: OverseerGenArgs, ) -> Result< InitializedOverseerBuilder< SpawnGlue, - Arc, + Arc>, CandidateValidationSubsystem, PvfCheckerSubsystem, CandidateBackingSubsystem, @@ -169,7 +174,7 @@ pub fn prepared_overseer_builder( BitfieldSigningSubsystem, BitfieldDistributionSubsystem, ProvisionerSubsystem, - RuntimeApiSubsystem, + RuntimeApiSubsystem>, AvailabilityStoreSubsystem, NetworkBridgeRxSubsystem< Arc>, @@ -204,6 +209,11 @@ where let network_bridge_metrics: NetworkBridgeMetrics = Metrics::register(registry)?; + let runtime_api_client = Arc::new(DefaultSubsystemClient::new( + runtime_client.clone(), + offchain_transaction_pool_factory, + )); + let builder = Overseer::builder() .network_bridge_tx(NetworkBridgeTxSubsystem::new( network_service.clone(), @@ -273,7 +283,7 @@ where }) .provisioner(ProvisionerSubsystem::new(Metrics::register(registry)?)) .runtime_api(RuntimeApiSubsystem::new( - runtime_client.clone(), + runtime_api_client.clone(), Metrics::register(registry)?, spawner.clone(), )) @@ -312,7 +322,7 @@ where .activation_external_listeners(Default::default()) .span_per_active_leaf(Default::default()) .active_leaves(Default::default()) - .supports_parachains(runtime_client) + .supports_parachains(runtime_api_client) .known_leaves(LruCache::new(KNOWN_LEAVES_CACHE_SIZE)) .metrics(metrics) .spawner(spawner); @@ -334,7 +344,10 @@ pub trait OverseerGen { &self, connector: OverseerConnector, args: OverseerGenArgs, - ) -> Result<(Overseer, Arc>, OverseerHandle), Error> + ) -> Result< + (Overseer, Arc>>, OverseerHandle), + Error, + > where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, @@ -358,7 +371,10 @@ impl OverseerGen for RealOverseerGen { &self, connector: OverseerConnector, args: OverseerGenArgs, - ) -> Result<(Overseer, Arc>, OverseerHandle), Error> + ) -> Result< + (Overseer, Arc>>, OverseerHandle), + Error, + > where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, diff --git a/node/subsystem-types/Cargo.toml b/node/subsystem-types/Cargo.toml index 59cc081b1c1d..9f21d080d38f 100644 --- a/node/subsystem-types/Cargo.toml +++ b/node/subsystem-types/Cargo.toml @@ -18,6 +18,7 @@ sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkad sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } smallvec = "1.8.0" substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } thiserror = "1.0.31" diff --git a/node/subsystem-types/src/lib.rs b/node/subsystem-types/src/lib.rs index 2ec25bb4ee51..88c7165bcd80 100644 --- a/node/subsystem-types/src/lib.rs +++ b/node/subsystem-types/src/lib.rs @@ -31,7 +31,7 @@ pub mod errors; pub mod messages; mod runtime_client; -pub use runtime_client::RuntimeApiSubsystemClient; +pub use runtime_client::{DefaultSubsystemClient, RuntimeApiSubsystemClient}; pub use jaeger::*; pub use polkadot_node_jaeger as jaeger; diff --git a/node/subsystem-types/src/runtime_client.rs b/node/subsystem-types/src/runtime_client.rs index 2d6d7afcfd08..196b928ad62b 100644 --- a/node/subsystem-types/src/runtime_client.rs +++ b/node/subsystem-types/src/runtime_client.rs @@ -23,10 +23,11 @@ use polkadot_primitives::{ SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature, }; +use sc_transaction_pool_api::OffchainTransactionPoolFactory; use sp_api::{ApiError, ApiExt, ProvideRuntimeApi}; use sp_authority_discovery::AuthorityDiscoveryApi; use sp_consensus_babe::{BabeApi, Epoch}; -use std::collections::BTreeMap; +use std::{collections::BTreeMap, sync::Arc}; /// Exposes all runtime calls that are used by the runtime API subsystem. #[async_trait] @@ -231,28 +232,44 @@ pub trait RuntimeApiSubsystemClient { ) -> std::result::Result, ApiError>; } +/// Default implementation of [`RuntimeApiSubsystemClient`] using the client. +pub struct DefaultSubsystemClient { + client: Arc, + offchain_transaction_pool_factory: OffchainTransactionPoolFactory, +} + +impl DefaultSubsystemClient { + /// Create new instance. + pub fn new( + client: Arc, + offchain_transaction_pool_factory: OffchainTransactionPoolFactory, + ) -> Self { + Self { client, offchain_transaction_pool_factory } + } +} + #[async_trait] -impl RuntimeApiSubsystemClient for T +impl RuntimeApiSubsystemClient for DefaultSubsystemClient where - T: ProvideRuntimeApi + Send + Sync, - T::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, + Client: ProvideRuntimeApi + Send + Sync, + Client::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, { async fn validators(&self, at: Hash) -> Result, ApiError> { - self.runtime_api().validators(at) + self.client.runtime_api().validators(at) } async fn validator_groups( &self, at: Hash, ) -> Result<(Vec>, GroupRotationInfo), ApiError> { - self.runtime_api().validator_groups(at) + self.client.runtime_api().validator_groups(at) } async fn availability_cores( &self, at: Hash, ) -> Result>, ApiError> { - self.runtime_api().availability_cores(at) + self.client.runtime_api().availability_cores(at) } async fn persisted_validation_data( @@ -261,7 +278,7 @@ where para_id: Id, assumption: OccupiedCoreAssumption, ) -> Result>, ApiError> { - self.runtime_api().persisted_validation_data(at, para_id, assumption) + self.client.runtime_api().persisted_validation_data(at, para_id, assumption) } async fn assumed_validation_data( @@ -271,7 +288,7 @@ where expected_persisted_validation_data_hash: Hash, ) -> Result, ValidationCodeHash)>, ApiError> { - self.runtime_api().assumed_validation_data( + self.client.runtime_api().assumed_validation_data( at, para_id, expected_persisted_validation_data_hash, @@ -284,11 +301,11 @@ where para_id: Id, outputs: CandidateCommitments, ) -> Result { - self.runtime_api().check_validation_outputs(at, para_id, outputs) + self.client.runtime_api().check_validation_outputs(at, para_id, outputs) } async fn session_index_for_child(&self, at: Hash) -> Result { - self.runtime_api().session_index_for_child(at) + self.client.runtime_api().session_index_for_child(at) } async fn validation_code( @@ -297,7 +314,7 @@ where para_id: Id, assumption: OccupiedCoreAssumption, ) -> Result, ApiError> { - self.runtime_api().validation_code(at, para_id, assumption) + self.client.runtime_api().validation_code(at, para_id, assumption) } async fn candidate_pending_availability( @@ -305,11 +322,11 @@ where at: Hash, para_id: Id, ) -> Result>, ApiError> { - self.runtime_api().candidate_pending_availability(at, para_id) + self.client.runtime_api().candidate_pending_availability(at, para_id) } async fn candidate_events(&self, at: Hash) -> Result>, ApiError> { - self.runtime_api().candidate_events(at) + self.client.runtime_api().candidate_events(at) } async fn dmq_contents( @@ -317,7 +334,7 @@ where at: Hash, recipient: Id, ) -> Result>, ApiError> { - self.runtime_api().dmq_contents(at, recipient) + self.client.runtime_api().dmq_contents(at, recipient) } async fn inbound_hrmp_channels_contents( @@ -325,7 +342,7 @@ where at: Hash, recipient: Id, ) -> Result>>, ApiError> { - self.runtime_api().inbound_hrmp_channels_contents(at, recipient) + self.client.runtime_api().inbound_hrmp_channels_contents(at, recipient) } async fn validation_code_by_hash( @@ -333,14 +350,14 @@ where at: Hash, hash: ValidationCodeHash, ) -> Result, ApiError> { - self.runtime_api().validation_code_by_hash(at, hash) + self.client.runtime_api().validation_code_by_hash(at, hash) } async fn on_chain_votes( &self, at: Hash, ) -> Result>, ApiError> { - self.runtime_api().on_chain_votes(at) + self.client.runtime_api().on_chain_votes(at) } async fn session_executor_params( @@ -348,7 +365,7 @@ where at: Hash, session_index: SessionIndex, ) -> Result, ApiError> { - self.runtime_api().session_executor_params(at, session_index) + self.client.runtime_api().session_executor_params(at, session_index) } async fn session_info( @@ -356,7 +373,7 @@ where at: Hash, index: SessionIndex, ) -> Result, ApiError> { - self.runtime_api().session_info(at, index) + self.client.runtime_api().session_info(at, index) } async fn submit_pvf_check_statement( @@ -365,11 +382,17 @@ where stmt: PvfCheckStatement, signature: ValidatorSignature, ) -> Result<(), ApiError> { - self.runtime_api().submit_pvf_check_statement(at, stmt, signature) + let mut runtime_api = self.client.runtime_api(); + + runtime_api.register_extension( + self.offchain_transaction_pool_factory.offchain_transaction_pool(at), + ); + + runtime_api.submit_pvf_check_statement(at, stmt, signature) } async fn pvfs_require_precheck(&self, at: Hash) -> Result, ApiError> { - self.runtime_api().pvfs_require_precheck(at) + self.client.runtime_api().pvfs_require_precheck(at) } async fn validation_code_hash( @@ -378,36 +401,36 @@ where para_id: Id, assumption: OccupiedCoreAssumption, ) -> Result, ApiError> { - self.runtime_api().validation_code_hash(at, para_id, assumption) + self.client.runtime_api().validation_code_hash(at, para_id, assumption) } async fn current_epoch(&self, at: Hash) -> Result { - self.runtime_api().current_epoch(at) + self.client.runtime_api().current_epoch(at) } async fn authorities( &self, at: Hash, ) -> std::result::Result, ApiError> { - self.runtime_api().authorities(at) + self.client.runtime_api().authorities(at) } async fn api_version_parachain_host(&self, at: Hash) -> Result, ApiError> { - self.runtime_api().api_version::>(at) + self.client.runtime_api().api_version::>(at) } async fn disputes( &self, at: Hash, ) -> Result)>, ApiError> { - self.runtime_api().disputes(at) + self.client.runtime_api().disputes(at) } async fn unapplied_slashes( &self, at: Hash, ) -> Result, ApiError> { - self.runtime_api().unapplied_slashes(at) + self.client.runtime_api().unapplied_slashes(at) } async fn key_ownership_proof( @@ -415,7 +438,7 @@ where at: Hash, validator_id: ValidatorId, ) -> Result, ApiError> { - self.runtime_api().key_ownership_proof(at, validator_id) + self.client.runtime_api().key_ownership_proof(at, validator_id) } async fn submit_report_dispute_lost( @@ -424,7 +447,12 @@ where dispute_proof: vstaging::slashing::DisputeProof, key_ownership_proof: vstaging::slashing::OpaqueKeyOwnershipProof, ) -> Result, ApiError> { - self.runtime_api() - .submit_report_dispute_lost(at, dispute_proof, key_ownership_proof) + let mut runtime_api = self.client.runtime_api(); + + runtime_api.register_extension( + self.offchain_transaction_pool_factory.offchain_transaction_pool(at), + ); + + runtime_api.submit_report_dispute_lost(at, dispute_proof, key_ownership_proof) } } diff --git a/node/test/client/src/lib.rs b/node/test/client/src/lib.rs index 2996bc84c763..5d97ffcdf1da 100644 --- a/node/test/client/src/lib.rs +++ b/node/test/client/src/lib.rs @@ -75,12 +75,7 @@ impl TestClientBuilderExt for TestClientBuilder { self.backend().clone(), executor.clone(), Default::default(), - ExecutionExtensions::new( - Default::default(), - None, - sc_offchain::OffchainDb::factory_from_backend(&*self.backend()), - Arc::new(executor), - ), + ExecutionExtensions::new(Default::default(), Arc::new(executor)), ) .unwrap(); diff --git a/node/test/service/src/chain_spec.rs b/node/test/service/src/chain_spec.rs index d48722599a67..876bbb8806b4 100644 --- a/node/test/service/src/chain_spec.rs +++ b/node/test/service/src/chain_spec.rs @@ -156,9 +156,13 @@ fn polkadot_testnet_genesis( babe: runtime::BabeConfig { authorities: vec![], epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, grandpa: Default::default(), - authority_discovery: runtime::AuthorityDiscoveryConfig { keys: vec![] }, + authority_discovery: runtime::AuthorityDiscoveryConfig { + keys: vec![], + ..Default::default() + }, claims: runtime::ClaimsConfig { claims: vec![], vesting: vec![] }, vesting: runtime::VestingConfig { vesting: vec![] }, sudo: runtime::SudoConfig { key: Some(root_key) }, diff --git a/node/test/service/src/lib.rs b/node/test/service/src/lib.rs index 08d09f8fe69a..0cf52c0934d5 100644 --- a/node/test/service/src/lib.rs +++ b/node/test/service/src/lib.rs @@ -35,7 +35,7 @@ use polkadot_test_runtime::{ }; use sc_chain_spec::ChainSpec; -use sc_client_api::{execution_extensions::ExecutionStrategies, BlockchainEvents}; +use sc_client_api::BlockchainEvents; use sc_network::{ config::{NetworkConfiguration, TransportConfig}, multiaddr, NetworkStateInfo, @@ -157,14 +157,6 @@ pub fn node_config( instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite, }, wasm_runtime_overrides: Default::default(), - // NOTE: we enforce the use of the native runtime to make the errors more debuggable - execution_strategies: ExecutionStrategies { - syncing: sc_client_api::ExecutionStrategy::NativeWhenPossible, - importing: sc_client_api::ExecutionStrategy::NativeWhenPossible, - block_construction: sc_client_api::ExecutionStrategy::NativeWhenPossible, - offchain_worker: sc_client_api::ExecutionStrategy::NativeWhenPossible, - other: sc_client_api::ExecutionStrategy::NativeWhenPossible, - }, rpc_addr: Default::default(), rpc_max_request_size: Default::default(), rpc_max_response_size: Default::default(), diff --git a/roadmap/implementers-guide/src/runtime/configuration.md b/roadmap/implementers-guide/src/runtime/configuration.md index 96d63faccedd..1d619ec26dff 100644 --- a/roadmap/implementers-guide/src/runtime/configuration.md +++ b/roadmap/implementers-guide/src/runtime/configuration.md @@ -56,7 +56,7 @@ pub fn configuration() -> HostConfiguration { /// /// If there is already a pending update for the current session index + 1, then it won't be touched. Otherwise, /// that would violate the promise of this function that changes will be applied on the second session change (cur + 2). -fn schedule_config_update(updater: impl FnOnce(&mut HostConfiguration)) -> DispatchResult +fn schedule_config_update(updater: impl FnOnce(&mut HostConfiguration>)) -> DispatchResult ``` ## Entry-points diff --git a/roadmap/implementers-guide/src/runtime/paras.md b/roadmap/implementers-guide/src/runtime/paras.md index a9e99c8993bf..2631fcf944ea 100644 --- a/roadmap/implementers-guide/src/runtime/paras.md +++ b/roadmap/implementers-guide/src/runtime/paras.md @@ -140,6 +140,7 @@ During the transition period, the para object is still considered in its existin ### Storage Layout ```rust +use frame_system::pallet_prelude::BlockNumberFor; /// All currently active PVF pre-checking votes. /// /// Invariant: @@ -197,12 +198,12 @@ UpgradeRestrictionSignal: map hasher(twox_64_concat) ParaId => Option; +UpgradeCooldowns: Vec<(ParaId, BlockNumberFor)>; /// The list of upcoming code upgrades. Each item is a pair of which para performs a code /// upgrade and at which relay-chain block it is expected at. /// /// Ordered ascending by block number. -UpcomingUpgrades: Vec<(ParaId, T::BlockNumber)>; +UpcomingUpgrades: Vec<(ParaId, BlockNumberFor)>; /// The actions to perform during the start of a specific session index. ActionsQueue: map SessionIndex => Vec; /// Upcoming paras instantiation arguments. diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index c08e28799c54..14ca9623589d 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -89,12 +89,13 @@ pub struct FullDeps { pub grandpa: GrandpaDeps, /// BEEFY specific dependencies. pub beefy: BeefyDeps, + /// Backend used by the node. + pub backend: Arc, } /// Instantiate all RPC extensions. pub fn create_full( - deps: FullDeps, - backend: Arc, + FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa, beefy, backend } : FullDeps, ) -> Result> where C: ProvideRuntimeApi @@ -124,8 +125,6 @@ where use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer}; let mut io = RpcModule::new(()); - let FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa, beefy } = - deps; let BabeDeps { babe_worker_handle, keystore } = babe; let GrandpaDeps { shared_voter_state, @@ -135,10 +134,18 @@ where finality_provider, } = grandpa; - io.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?; + io.merge(StateMigration::new(client.clone(), backend.clone(), deny_unsafe).into_rpc())?; io.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; io.merge(TransactionPayment::new(client.clone()).into_rpc())?; - io.merge(Mmr::new(client.clone()).into_rpc())?; + io.merge( + Mmr::new( + client.clone(), + backend + .offchain_storage() + .ok_or("Backend doesn't provide the required offchain storage")?, + ) + .into_rpc(), + )?; io.merge( Babe::new(client.clone(), babe_worker_handle.clone(), keystore, select_chain, deny_unsafe) .into_rpc(), diff --git a/runtime/common/src/assigned_slots.rs b/runtime/common/src/assigned_slots.rs index f2da950d0b16..4424738c9835 100644 --- a/runtime/common/src/assigned_slots.rs +++ b/runtime/common/src/assigned_slots.rs @@ -67,11 +67,10 @@ pub struct ParachainTemporarySlot { pub lease_count: u32, } -type BalanceOf = <<::Leaser as Leaser<::BlockNumber>>::Currency as Currency< +type BalanceOf = <<::Leaser as Leaser>>::Currency as Currency< ::AccountId, >>::Balance; -type LeasePeriodOf = - <::Leaser as Leaser<::BlockNumber>>::LeasePeriod; +type LeasePeriodOf = <::Leaser as Leaser>>::LeasePeriod; #[frame_support::pallet] pub mod pallet { @@ -91,9 +90,9 @@ pub mod pallet { /// The type representing the leasing system. type Leaser: Leaser< - Self::BlockNumber, + BlockNumberFor, AccountId = Self::AccountId, - LeasePeriod = Self::BlockNumber, + LeasePeriod = BlockNumberFor, >; /// The number of lease periods a permanent parachain slot lasts. @@ -182,7 +181,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_initialize(n: T::BlockNumber) -> Weight { + fn on_initialize(n: BlockNumberFor) -> Weight { if let Some((lease_period, first_block)) = Self::lease_period_index(n) { // If we're beginning a new lease period then handle that. if first_block { @@ -213,14 +212,14 @@ pub mod pallet { Error::::SlotAlreadyAssigned ); - let current_lease_period: T::BlockNumber = Self::current_lease_period_index(); + let current_lease_period: BlockNumberFor = Self::current_lease_period_index(); ensure!( !T::Leaser::already_leased( id, current_lease_period, // Check current lease & next one current_lease_period.saturating_add( - T::BlockNumber::from(2u32) + BlockNumberFor::::from(2u32) .saturating_mul(T::PermanentSlotLeasePeriodLength::get().into()) ) ), @@ -276,14 +275,14 @@ pub mod pallet { Error::::SlotAlreadyAssigned ); - let current_lease_period: T::BlockNumber = Self::current_lease_period_index(); + let current_lease_period: BlockNumberFor = Self::current_lease_period_index(); ensure!( !T::Leaser::already_leased( id, current_lease_period, // Check current lease & next one current_lease_period.saturating_add( - T::BlockNumber::from(2u32) + BlockNumberFor::::from(2u32) .saturating_mul(T::TemporarySlotLeasePeriodLength::get().into()) ) ), @@ -548,7 +547,7 @@ mod tests { use frame_support::{assert_noop, assert_ok, parameter_types}; use frame_system::EnsureRoot; use pallet_balances; - use primitives::{BlockNumber, Header}; + use primitives::BlockNumber; use runtime_parachains::{ configuration as parachains_configuration, paras as parachains_paras, shared as parachains_shared, @@ -557,23 +556,21 @@ mod tests { use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup}, transaction_validity::TransactionPriority, + BuildStorage, DispatchError::BadOrigin, }; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; - type Block = frame_system::mocking::MockBlock; + type Block = frame_system::mocking::MockBlockU32; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Configuration: parachains_configuration::{Pallet, Call, Storage, Config}, ParasShared: parachains_shared::{Pallet, Call, Storage}, - Parachains: parachains_paras::{Pallet, Call, Storage, Config, Event}, + Parachains: parachains_paras::{Pallet, Call, Storage, Config, Event}, Slots: slots::{Pallet, Call, Storage, Event}, AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event}, } @@ -596,13 +593,12 @@ mod tests { type BlockLength = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = BlockNumber; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = (); @@ -693,7 +689,7 @@ mod tests { // This function basically just builds a genesis storage key/value store according to // our desired mock up. pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)], } diff --git a/runtime/common/src/auctions.rs b/runtime/common/src/auctions.rs index 05ef6ad59bf0..7ab12eec7998 100644 --- a/runtime/common/src/auctions.rs +++ b/runtime/common/src/auctions.rs @@ -28,15 +28,15 @@ use frame_support::{ traits::{Currency, Get, Randomness, ReservableCurrency}, weights::Weight, }; +use frame_system::pallet_prelude::BlockNumberFor; pub use pallet::*; use parity_scale_codec::Decode; use primitives::Id as ParaId; use sp_runtime::traits::{CheckedSub, One, Saturating, Zero}; use sp_std::{mem::swap, prelude::*}; -type CurrencyOf = - <::Leaser as Leaser<::BlockNumber>>::Currency; -type BalanceOf = <<::Leaser as Leaser<::BlockNumber>>::Currency as Currency< +type CurrencyOf = <::Leaser as Leaser>>::Currency; +type BalanceOf = <<::Leaser as Leaser>>::Currency as Currency< ::AccountId, >>::Balance; @@ -66,8 +66,7 @@ impl WeightInfo for TestWeightInfo { /// An auction index. We count auctions in this type. pub type AuctionIndex = u32; -type LeasePeriodOf = - <::Leaser as Leaser<::BlockNumber>>::LeasePeriod; +type LeasePeriodOf = <::Leaser as Leaser>>::LeasePeriod; // Winning data type. This encodes the top bidders of each range together with their bid. type WinningData = [Option<(::AccountId, ParaId, BalanceOf)>; @@ -94,9 +93,9 @@ pub mod pallet { /// The type representing the leasing system. type Leaser: Leaser< - Self::BlockNumber, + BlockNumberFor, AccountId = Self::AccountId, - LeasePeriod = Self::BlockNumber, + LeasePeriod = BlockNumberFor, >; /// The parachain registrar type. @@ -104,16 +103,16 @@ pub mod pallet { /// The number of blocks over which an auction may be retroactively ended. #[pallet::constant] - type EndingPeriod: Get; + type EndingPeriod: Get>; /// The length of each sample to take during the ending period. /// /// `EndingPeriod` / `SampleLength` = Total # of Samples #[pallet::constant] - type SampleLength: Get; + type SampleLength: Get>; /// Something that provides randomness in the runtime. - type Randomness: Randomness; + type Randomness: Randomness>; /// The origin which may initiate auctions. type InitiateOrigin: EnsureOrigin; @@ -130,7 +129,7 @@ pub mod pallet { AuctionStarted { auction_index: AuctionIndex, lease_period: LeasePeriodOf, - ending: T::BlockNumber, + ending: BlockNumberFor, }, /// An auction ended. All funds become unreserved. AuctionClosed { auction_index: AuctionIndex }, @@ -151,7 +150,7 @@ pub mod pallet { last_slot: LeasePeriodOf, }, /// The winning offset was chosen for an auction. This will map into the `Winning` storage map. - WinningOffset { auction_index: AuctionIndex, block_number: T::BlockNumber }, + WinningOffset { auction_index: AuctionIndex, block_number: BlockNumberFor }, } #[pallet::error] @@ -184,7 +183,7 @@ pub mod pallet { /// auction will "begin to end", i.e. the first block of the Ending Period of the auction. #[pallet::storage] #[pallet::getter(fn auction_info)] - pub type AuctionInfo = StorageValue<_, (LeasePeriodOf, T::BlockNumber)>; + pub type AuctionInfo = StorageValue<_, (LeasePeriodOf, BlockNumberFor)>; /// Amounts currently reserved in the accounts of the bidders currently winning /// (sub-)ranges. @@ -198,7 +197,7 @@ pub mod pallet { /// first sample of the ending period is 0; the last is `Sample Size - 1`. #[pallet::storage] #[pallet::getter(fn winning)] - pub type Winning = StorageMap<_, Twox64Concat, T::BlockNumber, WinningData>; + pub type Winning = StorageMap<_, Twox64Concat, BlockNumberFor, WinningData>; #[pallet::extra_constants] impl Pallet { @@ -215,7 +214,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_initialize(n: T::BlockNumber) -> Weight { + fn on_initialize(n: BlockNumberFor) -> Weight { let mut weight = T::DbWeight::get().reads(1); // If the current auction was in its ending period last block, then ensure that the (sub-)range @@ -256,7 +255,7 @@ pub mod pallet { #[pallet::weight((T::WeightInfo::new_auction(), DispatchClass::Operational))] pub fn new_auction( origin: OriginFor, - #[pallet::compact] duration: T::BlockNumber, + #[pallet::compact] duration: BlockNumberFor, #[pallet::compact] lease_period_index: LeasePeriodOf, ) -> DispatchResult { T::InitiateOrigin::ensure_origin(origin)?; @@ -313,20 +312,20 @@ pub mod pallet { } } -impl Auctioneer for Pallet { +impl Auctioneer> for Pallet { type AccountId = T::AccountId; - type LeasePeriod = T::BlockNumber; + type LeasePeriod = BlockNumberFor; type Currency = CurrencyOf; fn new_auction( - duration: T::BlockNumber, + duration: BlockNumberFor, lease_period_index: LeasePeriodOf, ) -> DispatchResult { Self::do_new_auction(duration, lease_period_index) } // Returns the status of the auction given the current block number. - fn auction_status(now: T::BlockNumber) -> AuctionStatus { + fn auction_status(now: BlockNumberFor) -> AuctionStatus> { let early_end = match AuctionInfo::::get() { Some((_, early_end)) => early_end, None => return AuctionStatus::NotStarted, @@ -359,12 +358,12 @@ impl Auctioneer for Pallet { Self::handle_bid(bidder, para, AuctionCounter::::get(), first_slot, last_slot, amount) } - fn lease_period_index(b: T::BlockNumber) -> Option<(Self::LeasePeriod, bool)> { + fn lease_period_index(b: BlockNumberFor) -> Option<(Self::LeasePeriod, bool)> { T::Leaser::lease_period_index(b) } #[cfg(any(feature = "runtime-benchmarks", test))] - fn lease_period_length() -> (T::BlockNumber, T::BlockNumber) { + fn lease_period_length() -> (BlockNumberFor, BlockNumberFor) { T::Leaser::lease_period_length() } @@ -383,7 +382,7 @@ impl Pallet { /// of this auction and the `lease_period_index` of the initial lease period of the four that /// are to be auctioned. fn do_new_auction( - duration: T::BlockNumber, + duration: BlockNumberFor, lease_period_index: LeasePeriodOf, ) -> DispatchResult { let maybe_auction = AuctionInfo::::get(); @@ -530,7 +529,7 @@ impl Pallet { /// /// This mutates the state, cleaning up `AuctionInfo` and `Winning` in the case of an auction /// ending. An immediately subsequent call with the same argument will always return `None`. - fn check_auction_end(now: T::BlockNumber) -> Option<(WinningData, LeasePeriodOf)> { + fn check_auction_end(now: BlockNumberFor) -> Option<(WinningData, LeasePeriodOf)> { if let Some((lease_period_index, early_end)) = AuctionInfo::::get() { let ending_period = T::EndingPeriod::get(); let late_end = early_end.saturating_add(ending_period); @@ -542,7 +541,7 @@ impl Pallet { if late_end <= known_since { // Our random seed was known only after the auction ended. Good to use. - let raw_offset_block_number = ::decode( + let raw_offset_block_number = >::decode( &mut raw_offset.as_ref(), ) .expect("secure hashes should always be bigger than the block number; qed"); @@ -683,21 +682,20 @@ mod tests { }; use frame_system::{EnsureRoot, EnsureSignedBy}; use pallet_balances; - use primitives::{BlockNumber, Header, Id as ParaId}; + use primitives::{BlockNumber, Id as ParaId}; use sp_core::H256; - use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; + use sp_runtime::{ + traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, + }; use std::{cell::RefCell, collections::BTreeMap}; - type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; - type Block = frame_system::mocking::MockBlock; + type Block = frame_system::mocking::MockBlockU32; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Auctions: auctions::{Pallet, Call, Storage, Event}, } @@ -713,13 +711,12 @@ mod tests { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = BlockNumber; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -886,7 +883,7 @@ mod tests { // This function basically just builds a genesis storage key/value store according to // our desired mock up. pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)], } @@ -1797,7 +1794,7 @@ mod benchmarking { where_clause { where T: pallet_babe::Config + paras::Config } new_auction { - let duration = T::BlockNumber::max_value(); + let duration = BlockNumberFor::::max_value(); let lease_period_index = LeasePeriodOf::::max_value(); let origin = T::InitiateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; @@ -1806,7 +1803,7 @@ mod benchmarking { assert_last_event::(Event::::AuctionStarted { auction_index: AuctionCounter::::get(), lease_period: LeasePeriodOf::::max_value(), - ending: T::BlockNumber::max_value(), + ending: BlockNumberFor::::max_value(), }.into()); } @@ -1817,7 +1814,7 @@ mod benchmarking { frame_system::Pallet::::set_block_number(offset + One::one()); // Create a new auction - let duration = T::BlockNumber::max_value(); + let duration = BlockNumberFor::::max_value(); let lease_period_index = LeasePeriodOf::::zero(); let origin = T::InitiateOrigin::try_successful_origin() .expect("InitiateOrigin has no successful origin required for the benchmark"); @@ -1874,7 +1871,7 @@ mod benchmarking { frame_system::Pallet::::set_block_number(offset + One::one()); // Create a new auction - let duration: T::BlockNumber = lease_length / 2u32.into(); + let duration: BlockNumberFor = lease_length / 2u32.into(); let lease_period_index = LeasePeriodOf::::zero(); let now = frame_system::Pallet::::block_number(); let origin = T::InitiateOrigin::try_successful_origin() @@ -1883,14 +1880,14 @@ mod benchmarking { fill_winners::(lease_period_index); - for winner in Winning::::get(T::BlockNumber::from(0u32)).unwrap().iter() { + for winner in Winning::::get(BlockNumberFor::::from(0u32)).unwrap().iter() { assert!(winner.is_some()); } - let winning_data = Winning::::get(T::BlockNumber::from(0u32)).unwrap(); + let winning_data = Winning::::get(BlockNumberFor::::from(0u32)).unwrap(); // Make winning map full for i in 0u32 .. (T::EndingPeriod::get() / T::SampleLength::get()).saturated_into() { - Winning::::insert(T::BlockNumber::from(i), winning_data.clone()); + Winning::::insert(BlockNumberFor::::from(i), winning_data.clone()); } // Move ahead to the block we want to initialize @@ -1919,7 +1916,7 @@ mod benchmarking { frame_system::Pallet::::set_block_number(offset + One::one()); // Create a new auction - let duration: T::BlockNumber = lease_length / 2u32.into(); + let duration: BlockNumberFor = lease_length / 2u32.into(); let lease_period_index = LeasePeriodOf::::zero(); let now = frame_system::Pallet::::block_number(); let origin = T::InitiateOrigin::try_successful_origin() @@ -1928,14 +1925,14 @@ mod benchmarking { fill_winners::(lease_period_index); - let winning_data = Winning::::get(T::BlockNumber::from(0u32)).unwrap(); + let winning_data = Winning::::get(BlockNumberFor::::from(0u32)).unwrap(); for winner in winning_data.iter() { assert!(winner.is_some()); } // Make winning map full for i in 0u32 .. (T::EndingPeriod::get() / T::SampleLength::get()).saturated_into() { - Winning::::insert(T::BlockNumber::from(i), winning_data.clone()); + Winning::::insert(BlockNumberFor::::from(i), winning_data.clone()); } assert!(AuctionInfo::::get().is_some()); }: _(RawOrigin::Root) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 9715bad556a1..6a41a8f3f472 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -171,7 +171,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// The overarching event type. type RuntimeEvent: From> + IsType<::RuntimeEvent>; - type VestingSchedule: VestingSchedule; + type VestingSchedule: VestingSchedule>; #[pallet::constant] type Prefix: Get<&'static [u8]>; type MoveClaimOrigin: EnsureOrigin; @@ -217,7 +217,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn vesting)] pub(super) type Vesting = - StorageMap<_, Identity, EthereumAddress, (BalanceOf, BalanceOf, T::BlockNumber)>; + StorageMap<_, Identity, EthereumAddress, (BalanceOf, BalanceOf, BlockNumberFor)>; /// The statement kind that must be signed, if any. #[pallet::storage] @@ -232,11 +232,11 @@ pub mod pallet { pub struct GenesisConfig { pub claims: Vec<(EthereumAddress, BalanceOf, Option, Option)>, - pub vesting: Vec<(EthereumAddress, (BalanceOf, BalanceOf, T::BlockNumber))>, + pub vesting: Vec<(EthereumAddress, (BalanceOf, BalanceOf, BlockNumberFor))>, } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { // build `Claims` self.claims.iter().map(|(a, b, _, _)| (*a, *b)).for_each(|(a, b)| { @@ -336,7 +336,7 @@ pub mod pallet { origin: OriginFor, who: EthereumAddress, value: BalanceOf, - vesting_schedule: Option<(BalanceOf, BalanceOf, T::BlockNumber)>, + vesting_schedule: Option<(BalanceOf, BalanceOf, BlockNumberFor)>, statement: Option, ) -> DispatchResult { ensure_root(origin)?; @@ -710,26 +710,21 @@ mod tests { assert_err, assert_noop, assert_ok, dispatch::{DispatchError::BadOrigin, GetDispatchInfo, Pays}, ord_parameter_types, parameter_types, - traits::{ConstU32, ExistenceRequirement, GenesisBuild, WithdrawReasons}, + traits::{ConstU32, ExistenceRequirement, WithdrawReasons}, }; use pallet_balances; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, Identity, IdentityLookup}, transaction_validity::TransactionLongevity, - TokenError, + BuildStorage, TokenError, }; - type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Vesting: pallet_vesting::{Pallet, Call, Storage, Config, Event}, Claims: claims::{Pallet, Call, Storage, Config, Event, ValidateUnsigned}, @@ -746,13 +741,12 @@ mod tests { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -836,7 +830,7 @@ mod tests { // This function basically just builds a genesis storage key/value store according to // our desired mockup. pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); // We use default for brevity, but you can configure as desired if needed. pallet_balances::GenesisConfig::::default() .assimilate_storage(&mut t) diff --git a/runtime/common/src/crowdloan/mod.rs b/runtime/common/src/crowdloan/mod.rs index 6be608756669..18c86e68e5df 100644 --- a/runtime/common/src/crowdloan/mod.rs +++ b/runtime/common/src/crowdloan/mod.rs @@ -66,6 +66,7 @@ use frame_support::{ }, Identity, PalletId, }; +use frame_system::pallet_prelude::BlockNumberFor; pub use pallet::*; use parity_scale_codec::{Decode, Encode}; use primitives::Id as ParaId; @@ -78,11 +79,8 @@ use sp_runtime::{ }; use sp_std::vec::Vec; -type CurrencyOf = - <::Auctioneer as Auctioneer<::BlockNumber>>::Currency; -type LeasePeriodOf = <::Auctioneer as Auctioneer< - ::BlockNumber, ->>::LeasePeriod; +type CurrencyOf = <::Auctioneer as Auctioneer>>::Currency; +type LeasePeriodOf = <::Auctioneer as Auctioneer>>::LeasePeriod; type BalanceOf = as Currency<::AccountId>>::Balance; #[allow(dead_code)] @@ -216,9 +214,9 @@ pub mod pallet { /// The type representing the auctioning system. type Auctioneer: Auctioneer< - Self::BlockNumber, + BlockNumberFor, AccountId = Self::AccountId, - LeasePeriod = Self::BlockNumber, + LeasePeriod = BlockNumberFor, >; /// The maximum length for the memo attached to a crowdloan contribution. @@ -235,7 +233,7 @@ pub mod pallet { _, Twox64Concat, ParaId, - FundInfo, T::BlockNumber, LeasePeriodOf>, + FundInfo, BlockNumberFor, LeasePeriodOf>, >; /// The funds that have had additional contributions during the last block. This is used @@ -332,7 +330,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_initialize(num: T::BlockNumber) -> frame_support::weights::Weight { + fn on_initialize(num: BlockNumberFor) -> frame_support::weights::Weight { if let Some((sample, sub_sample)) = T::Auctioneer::auction_status(num).is_ending() { // This is the very first block in the ending period if sample.is_zero() && sub_sample.is_zero() { @@ -377,7 +375,7 @@ pub mod pallet { #[pallet::compact] cap: BalanceOf, #[pallet::compact] first_period: LeasePeriodOf, #[pallet::compact] last_period: LeasePeriodOf, - #[pallet::compact] end: T::BlockNumber, + #[pallet::compact] end: BlockNumberFor, verifier: Option, ) -> DispatchResult { let depositor = ensure_signed(origin)?; @@ -594,7 +592,7 @@ pub mod pallet { #[pallet::compact] cap: BalanceOf, #[pallet::compact] first_period: LeasePeriodOf, #[pallet::compact] last_period: LeasePeriodOf, - #[pallet::compact] end: T::BlockNumber, + #[pallet::compact] end: BlockNumberFor, verifier: Option, ) -> DispatchResult { ensure_root(origin)?; @@ -725,9 +723,9 @@ impl Pallet { /// trying to bid for has started already. /// * And, if the fund has enough free funds to refund full raised amount. fn ensure_crowdloan_ended( - now: T::BlockNumber, + now: BlockNumberFor, fund_account: &T::AccountId, - fund: &FundInfo, T::BlockNumber, LeasePeriodOf>, + fund: &FundInfo, BlockNumberFor, LeasePeriodOf>, ) -> sp_runtime::DispatchResult { // `fund.end` can represent the end of a failed crowdloan or the beginning of retirement // If the current lease period is past the first period they are trying to bid for, then @@ -878,21 +876,16 @@ mod tests { use ::test_helpers::{dummy_head_data, dummy_validation_code}; use sp_keystore::{testing::MemoryKeystore, KeystoreExt}; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup, TrailingZeroInput}, - DispatchResult, + BuildStorage, DispatchResult, }; - type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Crowdloan: crowdloan::{Pallet, Call, Storage, Event}, } @@ -911,13 +904,12 @@ mod tests { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = BlockNumber; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -1110,7 +1102,7 @@ mod tests { // This function basically just builds a genesis storage key/value store according to // our desired mockup. pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(1, 1000), (2, 2000), (3, 3000), (4, 4000)], } @@ -1968,7 +1960,7 @@ mod benchmarking { assert_eq!(event, &system_event); } - fn create_fund(id: u32, end: T::BlockNumber) -> ParaId { + fn create_fund(id: u32, end: BlockNumberFor) -> ParaId { let cap = BalanceOf::::max_value(); let (_, offset) = T::Auctioneer::lease_period_length(); // Set to the very beginning of lease period index 0. @@ -2088,7 +2080,7 @@ mod benchmarking { let caller: T::AccountId = whitelisted_caller(); let contributor = account("contributor", 0, 0); contribute_fund::(&contributor, fund_index); - frame_system::Pallet::::set_block_number(T::BlockNumber::max_value()); + frame_system::Pallet::::set_block_number(BlockNumberFor::::max_value()); }: _(RawOrigin::Signed(caller), contributor.clone(), fund_index) verify { assert_last_event::(Event::::Withdrew { who: contributor, fund_index, amount: T::MinContribution::get() }.into()); @@ -2108,7 +2100,7 @@ mod benchmarking { } let caller: T::AccountId = whitelisted_caller(); - frame_system::Pallet::::set_block_number(T::BlockNumber::max_value()); + frame_system::Pallet::::set_block_number(BlockNumberFor::::max_value()); }: _(RawOrigin::Signed(caller), fund_index) verify { assert_last_event::(Event::::AllRefunded { para_id: fund_index }.into()); @@ -2119,7 +2111,7 @@ mod benchmarking { let end = lpl + offset; let fund_index = create_fund::(1337, end); let caller: T::AccountId = whitelisted_caller(); - frame_system::Pallet::::set_block_number(T::BlockNumber::max_value()); + frame_system::Pallet::::set_block_number(BlockNumberFor::::max_value()); }: _(RawOrigin::Signed(caller.clone()), fund_index) verify { assert_last_event::(Event::::Dissolved { para_id: fund_index }.into()); diff --git a/runtime/common/src/impls.rs b/runtime/common/src/impls.rs index b827b8c34103..0d0dee2e9ad9 100644 --- a/runtime/common/src/impls.rs +++ b/runtime/common/src/impls.rs @@ -112,25 +112,20 @@ mod tests { use primitives::AccountId; use sp_core::{ConstU64, H256}; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, - Perbill, + BuildStorage, Perbill, }; - type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; const TEST_ACCOUNT: AccountId = AccountId::new([1; 32]); frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Authorship: pallet_authorship::{Pallet, Storage}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event}, + Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event}, } ); @@ -152,14 +147,13 @@ mod tests { impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type RuntimeOrigin = RuntimeOrigin; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type BlockLength = BlockLength; @@ -231,7 +225,7 @@ mod tests { } pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); // We use default for brevity, but you can configure as desired if needed. pallet_balances::GenesisConfig::::default() .assimilate_storage(&mut t) diff --git a/runtime/common/src/integration_tests.rs b/runtime/common/src/integration_tests.rs index cf879e6bb182..4dbdc6841c52 100644 --- a/runtime/common/src/integration_tests.rs +++ b/runtime/common/src/integration_tests.rs @@ -26,7 +26,7 @@ use crate::{ }; use frame_support::{ assert_noop, assert_ok, parameter_types, - traits::{ConstU32, Currency, GenesisBuild, OnFinalize, OnInitialize}, + traits::{ConstU32, Currency, OnFinalize, OnInitialize}, weights::Weight, PalletId, }; @@ -34,7 +34,7 @@ use frame_support_test::TestRandomness; use frame_system::EnsureRoot; use parity_scale_codec::Encode; use primitives::{ - BlockNumber, HeadData, Header, Id as ParaId, SessionIndex, ValidationCode, LOWEST_PUBLIC_ID, + BlockNumber, HeadData, Id as ParaId, SessionIndex, ValidationCode, LOWEST_PUBLIC_ID, }; use runtime_parachains::{ configuration, origin, paras, shared, Origin as ParaOrigin, ParaLifecycle, @@ -46,12 +46,12 @@ use sp_keystore::{testing::MemoryKeystore, KeystoreExt}; use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup, One}, transaction_validity::TransactionPriority, - AccountId32, + AccountId32, BuildStorage, }; use sp_std::sync::Arc; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; +type Block = frame_system::mocking::MockBlockU32; type AccountId = AccountId32; type Balance = u32; @@ -70,19 +70,16 @@ fn signed(i: u32) -> RuntimeOrigin { } frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { // System Stuff - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, // Parachains Runtime Configuration: configuration::{Pallet, Call, Storage, Config}, - Paras: paras::{Pallet, Call, Storage, Event, Config}, + Paras: paras::{Pallet, Call, Storage, Event, Config}, ParasShared: shared::{Pallet, Call, Storage}, ParachainsOrigin: origin::{Pallet, Origin}, @@ -119,13 +116,12 @@ impl frame_system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = BlockNumber; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -277,17 +273,15 @@ impl crowdloan::Config for Test { /// Create a new set of test externalities. pub fn new_test_ext() -> TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - GenesisBuild::::assimilate_storage( - &configuration::GenesisConfig { - config: configuration::HostConfiguration { - max_code_size: 2 * 1024 * 1024, // 2 MB - max_head_data_size: 1 * 1024 * 1024, // 1 MB - ..Default::default() - }, + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); + configuration::GenesisConfig:: { + config: configuration::HostConfiguration { + max_code_size: 2 * 1024 * 1024, // 2 MB + max_head_data_size: 1 * 1024 * 1024, // 1 MB + ..Default::default() }, - &mut t, - ) + } + .assimilate_storage(&mut t) .unwrap(); let keystore = MemoryKeystore::new(); let mut ext: sp_io::TestExternalities = t.into(); diff --git a/runtime/common/src/mock.rs b/runtime/common/src/mock.rs index 06cc7771dede..a331ca3968e6 100644 --- a/runtime/common/src/mock.rs +++ b/runtime/common/src/mock.rs @@ -21,6 +21,7 @@ use frame_support::{ dispatch::{DispatchError, DispatchResult}, weights::Weight, }; +use frame_system::pallet_prelude::BlockNumberFor; use parity_scale_codec::{Decode, Encode}; use primitives::{HeadData, Id as ParaId, PvfCheckStatement, SessionIndex, ValidationCode}; use runtime_parachains::paras; @@ -192,7 +193,7 @@ impl Registrar for TestRegistrar { } impl TestRegistrar { - pub fn operations() -> Vec<(ParaId, T::BlockNumber, bool)> { + pub fn operations() -> Vec<(ParaId, BlockNumberFor, bool)> { OPERATIONS .with(|x| x.borrow().iter().map(|(p, b, c)| (*p, (*b).into(), *c)).collect::>()) } diff --git a/runtime/common/src/paras_registrar.rs b/runtime/common/src/paras_registrar.rs index 284decff46a5..550f443a5a78 100644 --- a/runtime/common/src/paras_registrar.rs +++ b/runtime/common/src/paras_registrar.rs @@ -191,18 +191,20 @@ pub mod pallet { pub type NextFreeParaId = StorageValue<_, ParaId, ValueQuery>; #[pallet::genesis_config] - pub struct GenesisConfig { + pub struct GenesisConfig { + #[serde(skip)] + pub _config: sp_std::marker::PhantomData, pub next_free_para_id: ParaId, } - impl Default for GenesisConfig { + impl Default for GenesisConfig { fn default() -> Self { - GenesisConfig { next_free_para_id: LOWEST_PUBLIC_ID } + GenesisConfig { next_free_para_id: LOWEST_PUBLIC_ID, _config: Default::default() } } } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { NextFreeParaId::::put(self.next_free_para_id); } @@ -661,11 +663,11 @@ mod tests { assert_noop, assert_ok, error::BadOrigin, parameter_types, - traits::{ConstU32, GenesisBuild, OnFinalize, OnInitialize}, + traits::{ConstU32, OnFinalize, OnInitialize}, }; use frame_system::limits; use pallet_balances::Error as BalancesError; - use primitives::{Balance, BlockNumber, Header, SessionIndex}; + use primitives::{Balance, BlockNumber, SessionIndex}; use runtime_parachains::{configuration, origin, shared}; use sp_core::H256; use sp_io::TestExternalities; @@ -673,23 +675,20 @@ mod tests { use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup}, transaction_validity::TransactionPriority, - Perbill, + BuildStorage, Perbill, }; use sp_std::collections::btree_map::BTreeMap; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; - type Block = frame_system::mocking::MockBlock; + type Block = frame_system::mocking::MockBlockU32; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Configuration: configuration::{Pallet, Call, Storage, Config}, - Parachains: paras::{Pallet, Call, Storage, Config, Event}, + Parachains: paras::{Pallet, Call, Storage, Config, Event}, ParasShared: shared::{Pallet, Call, Storage}, Registrar: paras_registrar::{Pallet, Call, Storage, Event}, ParachainsOrigin: origin::{Pallet, Origin}, @@ -717,13 +716,12 @@ mod tests { type BaseCallFilter = frame_support::traits::Everything; type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = BlockNumber; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = (); @@ -797,18 +795,16 @@ mod tests { } pub fn new_test_ext() -> TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - GenesisBuild::::assimilate_storage( - &configuration::GenesisConfig { - config: configuration::HostConfiguration { - max_code_size: 2 * 1024 * 1024, // 2 MB - max_head_data_size: 1 * 1024 * 1024, // 1 MB - ..Default::default() - }, + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); + + configuration::GenesisConfig:: { + config: configuration::HostConfiguration { + max_code_size: 2 * 1024 * 1024, // 2 MB + max_head_data_size: 1 * 1024 * 1024, // 1 MB + ..Default::default() }, - &mut t, - ) + } + .assimilate_storage(&mut t) .unwrap(); pallet_balances::GenesisConfig:: { diff --git a/runtime/common/src/purchase.rs b/runtime/common/src/purchase.rs index e2864b262779..246511a5d3d8 100644 --- a/runtime/common/src/purchase.rs +++ b/runtime/common/src/purchase.rs @@ -105,7 +105,7 @@ pub mod pallet { /// Vesting Pallet type VestingSchedule: VestingSchedule< Self::AccountId, - Moment = Self::BlockNumber, + Moment = BlockNumberFor, Currency = Self::Currency, >; @@ -144,7 +144,7 @@ pub mod pallet { /// A new statement was set. StatementUpdated, /// A new statement was set. `[block_number]` - UnlockBlockUpdated { block_number: T::BlockNumber }, + UnlockBlockUpdated { block_number: BlockNumberFor }, } #[pallet::error] @@ -182,7 +182,7 @@ pub mod pallet { // The block where all locked dots will unlock. #[pallet::storage] - pub(super) type UnlockBlock = StorageValue<_, T::BlockNumber, ValueQuery>; + pub(super) type UnlockBlock = StorageValue<_, BlockNumberFor, ValueQuery>; #[pallet::hooks] impl Hooks> for Pallet {} @@ -403,7 +403,7 @@ pub mod pallet { #[pallet::weight(T::DbWeight::get().writes(1))] pub fn set_unlock_block( origin: OriginFor, - unlock_block: T::BlockNumber, + unlock_block: BlockNumberFor, ) -> DispatchResult { T::ConfigurationOrigin::ensure_origin(origin)?; ensure!( @@ -486,21 +486,16 @@ mod tests { traits::{Currency, WithdrawReasons}, }; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, Dispatchable, IdentifyAccount, Identity, IdentityLookup, Verify}, - ArithmeticError, MultiSignature, + ArithmeticError, BuildStorage, MultiSignature, }; - type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Vesting: pallet_vesting::{Pallet, Call, Storage, Config, Event}, Purchase: purchase::{Pallet, Call, Storage, Event}, @@ -519,13 +514,12 @@ mod tests { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -601,7 +595,7 @@ mod tests { // This function basically just builds a genesis storage key/value store according to // our desired mockup. It also executes our `setup` function which sets up this pallet for use. pub fn new_test_ext() -> sp_io::TestExternalities { - let t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let t = frame_system::GenesisConfig::::default().build_storage().unwrap(); let mut ext = sp_io::TestExternalities::new(t); ext.execute_with(|| setup()); ext diff --git a/runtime/common/src/slots/mod.rs b/runtime/common/src/slots/mod.rs index 202062fd7ce9..0be75fcba2b1 100644 --- a/runtime/common/src/slots/mod.rs +++ b/runtime/common/src/slots/mod.rs @@ -37,7 +37,7 @@ use sp_std::prelude::*; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; -type LeasePeriodOf = ::BlockNumber; +type LeasePeriodOf = BlockNumberFor; pub trait WeightInfo { fn force_lease() -> Weight; @@ -83,11 +83,11 @@ pub mod pallet { /// The number of blocks over which a single period lasts. #[pallet::constant] - type LeasePeriod: Get; + type LeasePeriod: Get>; /// The number of blocks to offset each lease period by. #[pallet::constant] - type LeaseOffset: Get; + type LeaseOffset: Get>; /// The origin which may forcibly create or clear leases. Root can always do this. type ForceOrigin: EnsureOrigin<::RuntimeOrigin>; @@ -145,7 +145,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_initialize(n: T::BlockNumber) -> Weight { + fn on_initialize(n: BlockNumberFor) -> Weight { if let Some((lease_period, first_block)) = Self::lease_period_index(n) { // If we're beginning a new lease period then handle that. if first_block { @@ -333,9 +333,9 @@ impl crate::traits::OnSwap for Pallet { } } -impl Leaser for Pallet { +impl Leaser> for Pallet { type AccountId = T::AccountId; - type LeasePeriod = T::BlockNumber; + type LeasePeriod = BlockNumberFor; type Currency = T::Currency; fn lease_out( @@ -442,11 +442,11 @@ impl Leaser for Pallet { } #[cfg(any(feature = "runtime-benchmarks", test))] - fn lease_period_length() -> (T::BlockNumber, T::BlockNumber) { + fn lease_period_length() -> (BlockNumberFor, BlockNumberFor) { (T::LeasePeriod::get(), T::LeaseOffset::get()) } - fn lease_period_index(b: T::BlockNumber) -> Option<(Self::LeasePeriod, bool)> { + fn lease_period_index(b: BlockNumberFor) -> Option<(Self::LeasePeriod, bool)> { // Note that blocks before `LeaseOffset` do not count as any lease period. let offset_block_now = b.checked_sub(&T::LeaseOffset::get())?; let lease_period = offset_block_now / T::LeasePeriod::get(); @@ -505,20 +505,19 @@ mod tests { use frame_support::{assert_noop, assert_ok, parameter_types}; use frame_system::EnsureRoot; use pallet_balances; - use primitives::{BlockNumber, Header}; + use primitives::BlockNumber; use sp_core::H256; - use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; + use sp_runtime::{ + traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, + }; - type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; - type Block = frame_system::mocking::MockBlock; + type Block = frame_system::mocking::MockBlockU32; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Slots: slots::{Pallet, Call, Storage, Event}, } @@ -533,13 +532,12 @@ mod tests { type BlockLength = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = BlockNumber; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = (); @@ -593,7 +591,7 @@ mod tests { // This function basically just builds a genesis storage key/value store according to // our desired mock up. pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)], } diff --git a/runtime/common/src/xcm_sender.rs b/runtime/common/src/xcm_sender.rs index 3654c44010e9..3573ec3dc42b 100644 --- a/runtime/common/src/xcm_sender.rs +++ b/runtime/common/src/xcm_sender.rs @@ -17,6 +17,7 @@ //! XCM sender for relay chain. use frame_support::traits::Get; +use frame_system::pallet_prelude::BlockNumberFor; use parity_scale_codec::Encode; use primitives::Id as ParaId; use runtime_parachains::{ @@ -72,12 +73,12 @@ pub struct ChildParachainRouter(PhantomData<(T, W, P)>); impl SendXcm for ChildParachainRouter { - type Ticket = (HostConfiguration, ParaId, Vec); + type Ticket = (HostConfiguration>, ParaId, Vec); fn validate( dest: &mut Option, msg: &mut Option>, - ) -> SendResult<(HostConfiguration, ParaId, Vec)> { + ) -> SendResult<(HostConfiguration>, ParaId, Vec)> { let d = dest.take().ok_or(MissingArgument)?; let id = if let MultiLocation { parents: 0, interior: X1(Parachain(id)) } = &d { *id @@ -99,7 +100,7 @@ impl, ParaId, Vec), + (config, para, blob): (HostConfiguration>, ParaId, Vec), ) -> Result { let hash = sp_io::hashing::blake2_256(&blob[..]); >::queue_downward_message(&config, para, blob) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index d66c4b37e878..a5655eba075e 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -175,13 +175,12 @@ impl frame_system::Config for Runtime { type BlockLength = BlockLength; type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = Nonce; - type BlockNumber = BlockNumber; + type Nonce = Nonce; type Hash = Hash; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = AccountIdLookup; - type Header = generic::Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = RocksDbWeight; @@ -734,7 +733,7 @@ where call: RuntimeCall, public: ::Signer, account: AccountId, - nonce: ::Index, + nonce: ::Nonce, ) -> Option<(RuntimeCall, ::SignaturePayload)> { use sp_runtime::traits::StaticLookup; // take the biggest period possible. @@ -1363,16 +1362,13 @@ impl pallet_state_trie_migration::Config for Runtime { } construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = primitives::Block, - UncheckedExtrinsic = UncheckedExtrinsic + pub enum Runtime { // Basic stuff; balances is uncallable initially. - System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, + System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, // Babe must be before session. - Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 3, @@ -1387,12 +1383,12 @@ construct_runtime! { Offences: pallet_offences::{Pallet, Storage, Event} = 7, Historical: session_historical::{Pallet} = 34, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, - Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 11, - AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, // Governance stuff. - Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, + Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, ConvictionVoting: pallet_conviction_voting::{Pallet, Call, Storage, Event} = 20, Referenda: pallet_referenda::{Pallet, Call, Storage, Event} = 21, // pub type FellowshipCollectiveInstance = pallet_ranked_collective::Instance1; @@ -1464,10 +1460,10 @@ construct_runtime! { ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event} = 53, ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54, ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55, - Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, + Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, Dmp: parachains_dmp::{Pallet, Storage} = 58, - Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event, Config} = 60, + Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event, Config} = 60, ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61, ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event} = 62, ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 63, @@ -1482,7 +1478,7 @@ construct_runtime! { StateTrieMigration: pallet_state_trie_migration = 98, // Pallet for sending XCM. - XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, + XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, // Generalized message queue MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event} = 100, @@ -1565,8 +1561,7 @@ pub mod migrations { ); /// Unreleased migrations. Add new ones here: - pub type Unreleased = ( - ); + pub type Unreleased = (); /// Migrations that set `StorageVersion`s we missed to set. pub struct SetStorageVersions; @@ -2324,8 +2319,8 @@ mod multiplier_tests { where F: FnMut() -> (), { - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() + let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::::default() + .build_storage() .unwrap() .into(); t.execute_with(|| { @@ -2373,8 +2368,8 @@ mod multiplier_tests { frame_system::Pallet::::set_block_consumed_resources(Weight::MAX, 0); let info = DispatchInfo { weight: Weight::MAX, ..Default::default() }; - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() + let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::::default() + .build_storage() .unwrap() .into(); // set the minimum @@ -2416,8 +2411,8 @@ mod multiplier_tests { let mut multiplier = Multiplier::from_u32(2); let mut blocks = 0; - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() + let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::::default() + .build_storage() .unwrap() .into(); // set the minimum diff --git a/runtime/kusama/src/xcm_config.rs b/runtime/kusama/src/xcm_config.rs index 0aa50a364a0c..d2a1d666ebc0 100644 --- a/runtime/kusama/src/xcm_config.rs +++ b/runtime/kusama/src/xcm_config.rs @@ -428,8 +428,10 @@ fn karura_liquid_staking_xcm_has_sane_weight_upper_limt() { // should be [WithdrawAsset, BuyExecution, Transact, RefundSurplus, DepositAsset] let blob = hex_literal::hex!("02140004000000000700e40b540213000000000700e40b54020006010700c817a804341801000006010b00c490bf4302140d010003ffffffff000100411f"); - let Ok(VersionedXcm::V2(old_xcm)) = - VersionedXcm::::decode(&mut &blob[..]) else { panic!("can't decode XCM blob") }; + let Ok(VersionedXcm::V2(old_xcm)) = VersionedXcm::::decode(&mut &blob[..]) + else { + panic!("can't decode XCM blob") + }; let mut xcm: Xcm = old_xcm.try_into().expect("conversion from v2 to v3 failed"); let weight = ::Weigher::weight(&mut xcm) @@ -440,9 +442,10 @@ fn karura_liquid_staking_xcm_has_sane_weight_upper_limt() { assert!(weight.all_lte(Weight::from_parts(30_313_281_000, 65536))); let Some(Transact { require_weight_at_most, call, .. }) = - xcm.inner_mut().into_iter().find(|inst| matches!(inst, Transact { .. })) else { - panic!("no Transact instruction found") - }; + xcm.inner_mut().into_iter().find(|inst| matches!(inst, Transact { .. })) + else { + panic!("no Transact instruction found") + }; // should be pallet_utility.as_derivative { index: 0, call: pallet_staking::bond_extra { max_additional: 2490000000000 } } let message_call = call.take_decoded().expect("can't decode Transact call"); let call_weight = message_call.get_dispatch_info().weight; diff --git a/runtime/parachains/src/builder.rs b/runtime/parachains/src/builder.rs index f9908e30ad03..e46c9f59b957 100644 --- a/runtime/parachains/src/builder.rs +++ b/runtime/parachains/src/builder.rs @@ -22,6 +22,7 @@ use crate::{ }; use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec}; use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::*; use primitives::{ collator_signature_payload, AvailabilityBitfield, BackedCandidate, CandidateCommitments, CandidateDescriptor, CandidateHash, CollatorId, CollatorSignature, CommittedCandidateReceipt, @@ -69,7 +70,7 @@ pub(crate) struct BenchBuilder { /// Active validators. Validators should be declared prior to all other setup. validators: Option>, /// Starting block number; we expect it to get incremented on session setup. - block_number: T::BlockNumber, + block_number: BlockNumberFor, /// Starting session; we expect it to get incremented on session setup. session: SessionIndex, /// Session we want the scenario to take place in. We will roll to this session. @@ -97,9 +98,9 @@ pub(crate) struct BenchBuilder { /// Paras inherent `enter` benchmark scenario. #[cfg(any(feature = "runtime-benchmarks", test))] pub(crate) struct Bench { - pub(crate) data: ParachainsInherentData, + pub(crate) data: ParachainsInherentData>, pub(crate) _session: u32, - pub(crate) _block_number: T::BlockNumber, + pub(crate) _block_number: BlockNumberFor, } impl BenchBuilder { @@ -150,8 +151,8 @@ impl BenchBuilder { } /// Mock header. - pub(crate) fn header(block_number: T::BlockNumber) -> T::Header { - T::Header::new( + pub(crate) fn header(block_number: BlockNumberFor) -> HeaderFor { + HeaderFor::::new( block_number, // `block_number`, Default::default(), // `extrinsics_root`, Default::default(), // `storage_root`, @@ -260,8 +261,8 @@ impl BenchBuilder { core_idx: CoreIndex, candidate_hash: CandidateHash, availability_votes: BitVec, - ) -> inclusion::CandidatePendingAvailability { - inclusion::CandidatePendingAvailability::::new( + ) -> inclusion::CandidatePendingAvailability> { + inclusion::CandidatePendingAvailability::>::new( core_idx, // core candidate_hash, // hash Self::candidate_descriptor_mock(), // candidate descriptor @@ -405,7 +406,7 @@ impl BenchBuilder { Self::run_to_block(block); } - let block_number = ::BlockNumber::from(block); + let block_number = BlockNumberFor::::from(block); let header = Self::header(block_number.clone()); frame_system::Pallet::::reset_events(); @@ -523,7 +524,7 @@ impl BenchBuilder { // candidate receipt. paras::Pallet::::heads_insert(¶_id, head_data.clone()); - let mut past_code_meta = paras::ParaPastCodeMeta::::default(); + let mut past_code_meta = paras::ParaPastCodeMeta::>::default(); past_code_meta.note_replacement(0u32.into(), 0u32.into()); let group_validators = scheduler::Pallet::::group_validators(group_idx).unwrap(); diff --git a/runtime/parachains/src/configuration.rs b/runtime/parachains/src/configuration.rs index 5317c18f8962..385f3fca0e89 100644 --- a/runtime/parachains/src/configuration.rs +++ b/runtime/parachains/src/configuration.rs @@ -510,7 +510,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn config)] pub(crate) type ActiveConfig = - StorageValue<_, HostConfiguration, ValueQuery>; + StorageValue<_, HostConfiguration>, ValueQuery>; /// Pending configuration changes. /// @@ -521,7 +521,7 @@ pub mod pallet { /// 2 items: for the next session and for the `scheduled_session`. #[pallet::storage] pub(crate) type PendingConfigs = - StorageValue<_, Vec<(SessionIndex, HostConfiguration)>, ValueQuery>; + StorageValue<_, Vec<(SessionIndex, HostConfiguration>)>, ValueQuery>; /// If this is set, then the configuration setters will bypass the consistency checks. This /// is meant to be used only as the last resort. @@ -531,11 +531,11 @@ pub mod pallet { #[pallet::genesis_config] #[derive(DefaultNoBound)] pub struct GenesisConfig { - pub config: HostConfiguration, + pub config: HostConfiguration>, } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { self.config.panic_if_not_consistent(); ActiveConfig::::put(&self.config); @@ -552,7 +552,7 @@ pub mod pallet { ))] pub fn set_validation_upgrade_cooldown( origin: OriginFor, - new: T::BlockNumber, + new: BlockNumberFor, ) -> DispatchResult { ensure_root(origin)?; Self::schedule_config_update(|config| { @@ -568,7 +568,7 @@ pub mod pallet { ))] pub fn set_validation_upgrade_delay( origin: OriginFor, - new: T::BlockNumber, + new: BlockNumberFor, ) -> DispatchResult { ensure_root(origin)?; Self::schedule_config_update(|config| { @@ -584,7 +584,7 @@ pub mod pallet { ))] pub fn set_code_retention_period( origin: OriginFor, - new: T::BlockNumber, + new: BlockNumberFor, ) -> DispatchResult { ensure_root(origin)?; Self::schedule_config_update(|config| { @@ -665,7 +665,7 @@ pub mod pallet { ))] pub fn set_group_rotation_frequency( origin: OriginFor, - new: T::BlockNumber, + new: BlockNumberFor, ) -> DispatchResult { ensure_root(origin)?; Self::schedule_config_update(|config| { @@ -681,7 +681,7 @@ pub mod pallet { ))] pub fn set_chain_availability_period( origin: OriginFor, - new: T::BlockNumber, + new: BlockNumberFor, ) -> DispatchResult { ensure_root(origin)?; Self::schedule_config_update(|config| { @@ -697,7 +697,7 @@ pub mod pallet { ))] pub fn set_thread_availability_period( origin: OriginFor, - new: T::BlockNumber, + new: BlockNumberFor, ) -> DispatchResult { ensure_root(origin)?; Self::schedule_config_update(|config| { @@ -768,7 +768,7 @@ pub mod pallet { ))] pub fn set_dispute_post_conclusion_acceptance_period( origin: OriginFor, - new: T::BlockNumber, + new: BlockNumberFor, ) -> DispatchResult { ensure_root(origin)?; Self::schedule_config_update(|config| { @@ -1108,7 +1108,7 @@ pub mod pallet { ))] pub fn set_minimum_validation_upgrade_delay( origin: OriginFor, - new: T::BlockNumber, + new: BlockNumberFor, ) -> DispatchResult { ensure_root(origin)?; Self::schedule_config_update(|config| { @@ -1183,7 +1183,7 @@ pub struct SessionChangeOutcome { impl Pallet { /// Called by the initializer to initialize the configuration pallet. - pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight { + pub(crate) fn initializer_initialize(_now: BlockNumberFor) -> Weight { Weight::zero() } @@ -1197,7 +1197,7 @@ impl Pallet { /// be the same. pub(crate) fn initializer_on_new_session( session_index: &SessionIndex, - ) -> SessionChangeOutcome { + ) -> SessionChangeOutcome> { let pending_configs = >::get(); let prev_config = ActiveConfig::::get(); @@ -1238,7 +1238,7 @@ impl Pallet { /// Forcibly set the active config. This should be used with extreme care, and typically /// only when enabling parachains runtime pallets for the first time on a chain which has /// been running without them. - pub fn force_set_active_config(config: HostConfiguration) { + pub fn force_set_active_config(config: HostConfiguration>) { ActiveConfig::::set(config); } @@ -1258,7 +1258,7 @@ impl Pallet { // the sake of essentially avoiding an indirect call. Doesn't worth it. #[inline(never)] pub(crate) fn schedule_config_update( - updater: impl FnOnce(&mut HostConfiguration), + updater: impl FnOnce(&mut HostConfiguration>), ) -> DispatchResult { let mut pending_configs = >::get(); diff --git a/runtime/parachains/src/configuration/migration_ump.rs b/runtime/parachains/src/configuration/migration_ump.rs index 008a93142ee7..0eb06cbecb99 100644 --- a/runtime/parachains/src/configuration/migration_ump.rs +++ b/runtime/parachains/src/configuration/migration_ump.rs @@ -100,7 +100,7 @@ pub mod latest { pending.last() ); let Some(last) = pending.last() else { - return Err("There must be a new pending upgrade enqueued".into()); + return Err("There must be a new pending upgrade enqueued".into()) }; ensure!( pending.len() == old_pending as usize + 1, diff --git a/runtime/parachains/src/disputes.rs b/runtime/parachains/src/disputes.rs index 3e96c25a26c2..7b03cde8ed28 100644 --- a/runtime/parachains/src/disputes.rs +++ b/runtime/parachains/src/disputes.rs @@ -298,9 +298,9 @@ impl DisputesHandler for () { fn initializer_on_new_session(_notification: &SessionChangeNotification) {} } -impl DisputesHandler for pallet::Pallet +impl DisputesHandler> for pallet::Pallet where - T::BlockNumber: Ord, + BlockNumberFor: Ord, { fn is_frozen() -> bool { pallet::Pallet::::is_frozen() @@ -308,7 +308,7 @@ where fn filter_dispute_data( set: DisputeStatementSet, - post_conclusion_acceptance_period: T::BlockNumber, + post_conclusion_acceptance_period: BlockNumberFor, ) -> Option { pallet::Pallet::::filter_dispute_data(&set, post_conclusion_acceptance_period) .filter_statement_set(set) @@ -323,7 +323,7 @@ where fn note_included( session: SessionIndex, candidate_hash: CandidateHash, - included_in: T::BlockNumber, + included_in: BlockNumberFor, ) { pallet::Pallet::::note_included(session, candidate_hash, included_in) } @@ -331,7 +331,7 @@ where fn included_state( session: SessionIndex, candidate_hash: CandidateHash, - ) -> Option { + ) -> Option> { pallet::Pallet::::included_state(session, candidate_hash) } @@ -339,7 +339,7 @@ where pallet::Pallet::::concluded_invalid(session, candidate_hash) } - fn initializer_initialize(now: T::BlockNumber) -> Weight { + fn initializer_initialize(now: BlockNumberFor) -> Weight { pallet::Pallet::::initializer_initialize(now) } @@ -347,7 +347,7 @@ where pallet::Pallet::::initializer_finalize() } - fn initializer_on_new_session(notification: &SessionChangeNotification) { + fn initializer_on_new_session(notification: &SessionChangeNotification>) { pallet::Pallet::::initializer_on_new_session(notification) } } @@ -373,7 +373,7 @@ pub mod pallet { pub trait Config: frame_system::Config + configuration::Config + session_info::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; type RewardValidators: RewardValidators; - type SlashingHandler: SlashingHandler; + type SlashingHandler: SlashingHandler>; /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; @@ -400,7 +400,7 @@ pub mod pallet { SessionIndex, Blake2_128Concat, CandidateHash, - DisputeState, + DisputeState>, >; /// Backing votes stored for each dispute. @@ -424,7 +424,7 @@ pub mod pallet { SessionIndex, Blake2_128Concat, CandidateHash, - T::BlockNumber, + BlockNumberFor, >; /// Whether the chain is frozen. Starts as `None`. When this is `Some`, @@ -433,7 +433,7 @@ pub mod pallet { /// It can only be set back to `None` by governance intervention. #[pallet::storage] #[pallet::getter(fn last_valid_block)] - pub(super) type Frozen = StorageValue<_, Option, ValueQuery>; + pub(super) type Frozen = StorageValue<_, Option>, ValueQuery>; #[pallet::event] #[pallet::generate_deposit(pub fn deposit_event)] @@ -447,7 +447,7 @@ pub mod pallet { /// Block authors should no longer build on top of this head and should /// instead revert the block at the given height. This should be the /// number of the child of the last known valid block in the chain. - Revert(T::BlockNumber), + Revert(BlockNumberFor), } #[pallet::error] @@ -854,7 +854,7 @@ impl StatementSetFilter { impl Pallet { /// Called by the initializer to initialize the disputes module. - pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight { + pub(crate) fn initializer_initialize(_now: BlockNumberFor) -> Weight { Weight::zero() } @@ -863,7 +863,7 @@ impl Pallet { /// Called by the initializer to note a new session in the disputes pallet. pub(crate) fn initializer_on_new_session( - notification: &SessionChangeNotification, + notification: &SessionChangeNotification>, ) { let config = >::config(); @@ -937,7 +937,7 @@ impl Pallet { // Disputes without enough votes to get confirmed are also filtered out. fn filter_dispute_data( set: &DisputeStatementSet, - post_conclusion_acceptance_period: ::BlockNumber, + post_conclusion_acceptance_period: BlockNumberFor, ) -> StatementSetFilter { let mut filter = StatementSetFilter::RemoveIndices(Vec::new()); @@ -1048,7 +1048,7 @@ impl Pallet { /// dispute is fresh. fn process_checked_dispute_data( set: &CheckedDisputeStatementSet, - dispute_post_conclusion_acceptance_period: T::BlockNumber, + dispute_post_conclusion_acceptance_period: BlockNumberFor, ) -> Result { // Dispute statement sets on any dispute which concluded // before this point are to be rejected. @@ -1189,14 +1189,15 @@ impl Pallet { } #[allow(unused)] - pub(crate) fn disputes() -> Vec<(SessionIndex, CandidateHash, DisputeState)> { + pub(crate) fn disputes() -> Vec<(SessionIndex, CandidateHash, DisputeState>)> + { >::iter().collect() } pub(crate) fn note_included( session: SessionIndex, candidate_hash: CandidateHash, - included_in: T::BlockNumber, + included_in: BlockNumberFor, ) { if included_in.is_zero() { return @@ -1216,7 +1217,7 @@ impl Pallet { pub(crate) fn included_state( session: SessionIndex, candidate_hash: CandidateHash, - ) -> Option { + ) -> Option> { >::get(session, candidate_hash) } @@ -1231,7 +1232,7 @@ impl Pallet { Self::last_valid_block().is_some() } - pub(crate) fn revert_and_freeze(revert_to: T::BlockNumber) { + pub(crate) fn revert_and_freeze(revert_to: BlockNumberFor) { if Self::last_valid_block().map_or(true, |last| last > revert_to) { Frozen::::set(Some(revert_to)); diff --git a/runtime/parachains/src/disputes/slashing.rs b/runtime/parachains/src/disputes/slashing.rs index ac6f89019388..b27a7ab1ad73 100644 --- a/runtime/parachains/src/disputes/slashing.rs +++ b/runtime/parachains/src/disputes/slashing.rs @@ -48,6 +48,7 @@ use frame_support::{ traits::{Defensive, Get, KeyOwnerProofSystem, ValidatorSet, ValidatorSetWithIdentification}, weights::Weight, }; +use frame_system::pallet_prelude::BlockNumberFor; use primitives::{ vstaging::slashing::{DisputeProof, DisputesTimeSlot, PendingSlashes, SlashingOffenceKind}, @@ -270,7 +271,7 @@ where } } -impl disputes::SlashingHandler for SlashValidatorsForDisputes> +impl disputes::SlashingHandler> for SlashValidatorsForDisputes> where T: Config>, { @@ -294,7 +295,7 @@ where // NOTE: changing that requires modifying `do_punish` implementation } - fn initializer_initialize(now: T::BlockNumber) -> Weight { + fn initializer_initialize(now: BlockNumberFor) -> Weight { Pallet::::initializer_initialize(now) } @@ -529,7 +530,7 @@ pub mod pallet { impl Pallet { /// Called by the initializer to initialize the disputes slashing module. - fn initializer_initialize(_now: T::BlockNumber) -> Weight { + fn initializer_initialize(_now: BlockNumberFor) -> Weight { Weight::zero() } diff --git a/runtime/parachains/src/disputes/slashing/benchmarking.rs b/runtime/parachains/src/disputes/slashing/benchmarking.rs index 4debc41d3306..271da6d58437 100644 --- a/runtime/parachains/src/disputes/slashing/benchmarking.rs +++ b/runtime/parachains/src/disputes/slashing/benchmarking.rs @@ -19,7 +19,7 @@ use super::*; use crate::{disputes::SlashingHandler, initializer, shared}; use frame_benchmarking::{benchmarks, whitelist_account}; use frame_support::traits::{OnFinalize, OnInitialize}; -use frame_system::RawOrigin; +use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use pallet_staking::testing_utils::create_validators; use parity_scale_codec::Decode; use primitives::{Hash, PARACHAIN_KEY_TYPE_ID}; @@ -70,13 +70,13 @@ where .expect("session::set_keys should work"); } - pallet_session::Pallet::::on_initialize(T::BlockNumber::one()); - initializer::Pallet::::on_initialize(T::BlockNumber::one()); + pallet_session::Pallet::::on_initialize(BlockNumberFor::::one()); + initializer::Pallet::::on_initialize(BlockNumberFor::::one()); // skip sessions until the new validator set is enacted while pallet_session::Pallet::::validators().len() < n as usize { pallet_session::Pallet::::rotate_session(); } - initializer::Pallet::::on_finalize(T::BlockNumber::one()); + initializer::Pallet::::on_finalize(BlockNumberFor::::one()); let session_index = crate::shared::Pallet::::session_index(); let session_info = crate::session_info::Pallet::::session_info(session_index); @@ -86,9 +86,9 @@ where let key_owner_proof = pallet_session::historical::Pallet::::prove(key).unwrap(); // rotate a session to make sure `key_owner_proof` is historical - initializer::Pallet::::on_initialize(T::BlockNumber::one()); + initializer::Pallet::::on_initialize(BlockNumberFor::::one()); pallet_session::Pallet::::rotate_session(); - initializer::Pallet::::on_finalize(T::BlockNumber::one()); + initializer::Pallet::::on_finalize(BlockNumberFor::::one()); let idx = crate::shared::Pallet::::session_index(); assert!( diff --git a/runtime/parachains/src/disputes/tests.rs b/runtime/parachains/src/disputes/tests.rs index eaf1bde12353..93dcd58264b2 100644 --- a/runtime/parachains/src/disputes/tests.rs +++ b/runtime/parachains/src/disputes/tests.rs @@ -28,6 +28,7 @@ use frame_support::{ assert_err, assert_noop, assert_ok, traits::{OnFinalize, OnInitialize}, }; +use frame_system::pallet_prelude::BlockNumberFor; use primitives::BlockNumber; use sp_core::{crypto::CryptoType, Pair}; @@ -2054,9 +2055,10 @@ fn deduplication_and_sorting_works() { let disputes_orig = disputes.clone(); - as DisputesHandler< - ::BlockNumber, - >>::deduplicate_and_sort_dispute_data(&mut disputes).unwrap_err(); + as DisputesHandler>>::deduplicate_and_sort_dispute_data( + &mut disputes, + ) + .unwrap_err(); // assert ordering of local only disputes, and at the same time, and being free of duplicates assert_eq!(disputes_orig.len(), disputes.len() + 1); @@ -2083,10 +2085,11 @@ fn apply_filter_all>( let mut acc = Vec::::new(); for dispute_statement in sets { - if let Some(checked) = as DisputesHandler<::BlockNumber>>::filter_dispute_data( - dispute_statement, - post_conclusion_acceptance_period, - ) { + if let Some(checked) = + as DisputesHandler>>::filter_dispute_data( + dispute_statement, + post_conclusion_acceptance_period, + ) { acc.push(checked); } } @@ -2158,9 +2161,11 @@ fn filter_removes_duplicates_within_set() { }; let post_conclusion_acceptance_period = 10; - let statements = as DisputesHandler< - ::BlockNumber, - >>::filter_dispute_data(statements, post_conclusion_acceptance_period); + let statements = + as DisputesHandler>>::filter_dispute_data( + statements, + post_conclusion_acceptance_period, + ); assert_eq!( statements, @@ -2446,7 +2451,7 @@ fn filter_removes_duplicate_statements_sets() { // `Err(())` indicates presence of duplicates assert!( as DisputesHandler< - ::BlockNumber, + BlockNumberFor, >>::deduplicate_and_sort_dispute_data(&mut sets) .is_err()); diff --git a/runtime/parachains/src/dmp.rs b/runtime/parachains/src/dmp.rs index 5244406fcce4..b88475c980ef 100644 --- a/runtime/parachains/src/dmp.rs +++ b/runtime/parachains/src/dmp.rs @@ -47,6 +47,7 @@ use crate::{ initializer, FeeTracker, }; use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::BlockNumberFor; use primitives::{DownwardMessage, Hash, Id as ParaId, InboundDownwardMessage}; use sp_core::MAX_POSSIBLE_ALLOCATION; use sp_runtime::{ @@ -121,7 +122,7 @@ pub mod pallet { _, Twox64Concat, ParaId, - Vec>, + Vec>>, ValueQuery, >; @@ -150,7 +151,7 @@ pub mod pallet { /// Routines and getters related to downward message passing. impl Pallet { /// Block initialization logic, called by initializer. - pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight { + pub(crate) fn initializer_initialize(_now: BlockNumberFor) -> Weight { Weight::zero() } @@ -159,7 +160,7 @@ impl Pallet { /// Called by the initializer to note that a new session has started. pub(crate) fn initializer_on_new_session( - _notification: &initializer::SessionChangeNotification, + _notification: &initializer::SessionChangeNotification>, outgoing_paras: &[ParaId], ) { Self::perform_outgoing_para_cleanup(outgoing_paras); @@ -183,7 +184,7 @@ impl Pallet { /// in an error. If this returns `Ok(())` the caller can be certain that a call to /// `queue_downward_message` with the same parameters will be successful. pub fn can_queue_downward_message( - config: &HostConfiguration, + config: &HostConfiguration>, para: &ParaId, msg: &DownwardMessage, ) -> Result<(), QueueDownwardMessageError> { @@ -209,7 +210,7 @@ impl Pallet { /// to a dangling storage. If the caller cannot statically prove that the recipient exists /// then the caller should perform a runtime check. pub fn queue_downward_message( - config: &HostConfiguration, + config: &HostConfiguration>, para: ParaId, msg: DownwardMessage, ) -> Result<(), QueueDownwardMessageError> { @@ -316,7 +317,9 @@ impl Pallet { /// Returns the downward message queue contents for the given para. /// /// The most recent messages are the latest in the vector. - pub(crate) fn dmq_contents(recipient: ParaId) -> Vec> { + pub(crate) fn dmq_contents( + recipient: ParaId, + ) -> Vec>> { DownwardMessageQueues::::get(&recipient) } diff --git a/runtime/parachains/src/hrmp.rs b/runtime/parachains/src/hrmp.rs index 0d62ec16d74a..4fbffc45e563 100644 --- a/runtime/parachains/src/hrmp.rs +++ b/runtime/parachains/src/hrmp.rs @@ -369,7 +369,7 @@ pub mod pallet { /// Invariant: /// - each para `P` used here as a key should satisfy `Paras::is_valid_para(P)` within a session. #[pallet::storage] - pub type HrmpWatermarks = StorageMap<_, Twox64Concat, ParaId, T::BlockNumber>; + pub type HrmpWatermarks = StorageMap<_, Twox64Concat, ParaId, BlockNumberFor>; /// HRMP channel data associated with each para. /// Invariant: @@ -407,7 +407,7 @@ pub mod pallet { _, Twox64Concat, HrmpChannelId, - Vec>, + Vec>>, ValueQuery, >; @@ -419,7 +419,7 @@ pub mod pallet { /// same block number. #[pallet::storage] pub type HrmpChannelDigests = - StorageMap<_, Twox64Concat, ParaId, Vec<(T::BlockNumber, Vec)>, ValueQuery>; + StorageMap<_, Twox64Concat, ParaId, Vec<(BlockNumberFor, Vec)>, ValueQuery>; /// Preopen the given HRMP channels. /// @@ -436,12 +436,14 @@ pub mod pallet { /// 2. `sender` and `recipient` must be valid paras. #[pallet::genesis_config] #[derive(DefaultNoBound)] - pub struct GenesisConfig { + pub struct GenesisConfig { + #[serde(skip)] + _config: sp_std::marker::PhantomData, preopen_hrmp_channels: Vec<(ParaId, ParaId, u32, u32)>, } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { initialize_storage::(&self.preopen_hrmp_channels); } @@ -657,7 +659,7 @@ fn preopen_hrmp_channel( /// Routines and getters related to HRMP. impl Pallet { /// Block initialization logic, called by initializer. - pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight { + pub(crate) fn initializer_initialize(_now: BlockNumberFor) -> Weight { Weight::zero() } @@ -666,7 +668,7 @@ impl Pallet { /// Called by the initializer to note that a new session has started. pub(crate) fn initializer_on_new_session( - notification: &initializer::SessionChangeNotification, + notification: &initializer::SessionChangeNotification>, outgoing_paras: &[ParaId], ) -> Weight { let w1 = Self::perform_outgoing_para_cleanup(¬ification.prev_config, outgoing_paras); @@ -683,7 +685,7 @@ impl Pallet { /// Iterate over all paras that were noted for offboarding and remove all the data /// associated with them. fn perform_outgoing_para_cleanup( - config: &HostConfiguration, + config: &HostConfiguration>, outgoing: &[ParaId], ) -> Weight { let mut w = Self::clean_open_channel_requests(config, outgoing); @@ -708,7 +710,7 @@ impl Pallet { // // This will also perform the refunds for the counterparty if it doesn't offboard. pub(crate) fn clean_open_channel_requests( - config: &HostConfiguration, + config: &HostConfiguration>, outgoing: &[ParaId], ) -> Weight { // First collect all the channel ids of the open requests in which there is at least one @@ -784,7 +786,7 @@ impl Pallet { /// /// - prune the stale requests /// - enact the confirmed requests - fn process_hrmp_open_channel_requests(config: &HostConfiguration) { + fn process_hrmp_open_channel_requests(config: &HostConfiguration>) { let mut open_req_channels = HrmpOpenChannelRequestsList::::get(); if open_req_channels.is_empty() { return @@ -892,9 +894,9 @@ impl Pallet { /// Check that the candidate of the given recipient controls the HRMP watermark properly. pub(crate) fn check_hrmp_watermark( recipient: ParaId, - relay_chain_parent_number: T::BlockNumber, - new_hrmp_watermark: T::BlockNumber, - ) -> Result<(), HrmpWatermarkAcceptanceErr> { + relay_chain_parent_number: BlockNumberFor, + new_hrmp_watermark: BlockNumberFor, + ) -> Result<(), HrmpWatermarkAcceptanceErr>> { // First, check where the watermark CANNOT legally land. // // (a) For ensuring that messages are eventually processed, we require each parablock's @@ -940,7 +942,7 @@ impl Pallet { } pub(crate) fn check_outbound_hrmp( - config: &HostConfiguration, + config: &HostConfiguration>, sender: ParaId, out_hrmp_msgs: &[OutboundHrmpMessage], ) -> Result<(), OutboundHrmpAcceptanceErr> { @@ -1003,7 +1005,7 @@ impl Pallet { Ok(()) } - pub(crate) fn prune_hrmp(recipient: ParaId, new_hrmp_watermark: T::BlockNumber) -> Weight { + pub(crate) fn prune_hrmp(recipient: ParaId, new_hrmp_watermark: BlockNumberFor) -> Weight { let mut weight = Weight::zero(); // sift through the incoming messages digest to collect the paras that sent at least one @@ -1388,7 +1390,7 @@ impl Pallet { /// messages in them are also included. pub(crate) fn inbound_hrmp_channels_contents( recipient: ParaId, - ) -> BTreeMap>> { + ) -> BTreeMap>>> { let sender_set = HrmpIngressChannelsIndex::::get(&recipient); let mut inbound_hrmp_channels_contents = BTreeMap::new(); diff --git a/runtime/parachains/src/inclusion/mod.rs b/runtime/parachains/src/inclusion/mod.rs index 3815aa45a4b1..ffa74487c085 100644 --- a/runtime/parachains/src/inclusion/mod.rs +++ b/runtime/parachains/src/inclusion/mod.rs @@ -33,6 +33,7 @@ use frame_support::{ traits::{Defensive, EnqueueMessage}, BoundedSlice, }; +use frame_system::pallet_prelude::*; use pallet_message_queue::OnQueueChanged; use parity_scale_codec::{Decode, Encode}; use primitives::{ @@ -270,7 +271,7 @@ pub mod pallet { + configuration::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; - type DisputesHandler: disputes::DisputesHandler; + type DisputesHandler: disputes::DisputesHandler>; type RewardValidators: RewardValidators; /// The system message queue. @@ -365,12 +366,16 @@ pub mod pallet { /// The latest bitfield for each validator, referred to by their index in the validator set. #[pallet::storage] pub(crate) type AvailabilityBitfields = - StorageMap<_, Twox64Concat, ValidatorIndex, AvailabilityBitfieldRecord>; + StorageMap<_, Twox64Concat, ValidatorIndex, AvailabilityBitfieldRecord>>; /// Candidates pending availability by `ParaId`. #[pallet::storage] - pub(crate) type PendingAvailability = - StorageMap<_, Twox64Concat, ParaId, CandidatePendingAvailability>; + pub(crate) type PendingAvailability = StorageMap< + _, + Twox64Concat, + ParaId, + CandidatePendingAvailability>, + >; /// The commitments of candidates pending availability, by `ParaId`. #[pallet::storage] @@ -450,7 +455,7 @@ impl fmt::Debug for UmpAcceptanceCheckErr { impl Pallet { /// Block initialization logic, called by initializer. - pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight { + pub(crate) fn initializer_initialize(_now: BlockNumberFor) -> Weight { Weight::zero() } @@ -459,7 +464,7 @@ impl Pallet { /// Handle an incoming session change. pub(crate) fn initializer_on_new_session( - _notification: &crate::initializer::SessionChangeNotification, + _notification: &crate::initializer::SessionChangeNotification>, outgoing_paras: &[ParaId], ) { // unlike most drain methods, drained elements are not cleared on `Drop` of the iterator @@ -832,7 +837,7 @@ impl Pallet { &validation_outputs.new_validation_code, validation_outputs.processed_downward_messages, &validation_outputs.upward_messages, - T::BlockNumber::from(validation_outputs.hrmp_watermark), + BlockNumberFor::::from(validation_outputs.hrmp_watermark), &validation_outputs.horizontal_messages, ) .is_err() @@ -849,7 +854,7 @@ impl Pallet { } fn enact_candidate( - relay_parent_number: T::BlockNumber, + relay_parent_number: BlockNumberFor, receipt: CommittedCandidateReceipt, backers: BitVec, availability_votes: BitVec, @@ -898,7 +903,7 @@ impl Pallet { )); weight.saturating_accrue(>::prune_hrmp( receipt.descriptor.para_id, - T::BlockNumber::from(commitments.hrmp_watermark), + BlockNumberFor::::from(commitments.hrmp_watermark), )); weight.saturating_accrue(>::queue_outbound_hrmp( receipt.descriptor.para_id, @@ -921,7 +926,7 @@ impl Pallet { /// Check that all the upward messages sent by a candidate pass the acceptance criteria. pub(crate) fn check_upward_messages( - config: &HostConfiguration, + config: &HostConfiguration>, para: ParaId, upward_messages: &[UpwardMessage], ) -> Result<(), UmpAcceptanceCheckErr> { @@ -1020,7 +1025,7 @@ impl Pallet { /// /// Returns a vector of cleaned-up core IDs. pub(crate) fn collect_pending( - pred: impl Fn(CoreIndex, T::BlockNumber) -> bool, + pred: impl Fn(CoreIndex, BlockNumberFor) -> bool, ) -> Vec { let mut cleaned_up_ids = Vec::new(); let mut cleaned_up_cores = Vec::new(); @@ -1115,7 +1120,7 @@ impl Pallet { /// para provided, if any. pub(crate) fn pending_availability( para: ParaId, - ) -> Option> { + ) -> Option>> { >::get(¶) } } @@ -1162,9 +1167,9 @@ impl OnQueueChanged for Pallet { /// A collection of data required for checking a candidate. pub(crate) struct CandidateCheckContext { - config: configuration::HostConfiguration, - now: T::BlockNumber, - relay_parent_number: T::BlockNumber, + config: configuration::HostConfiguration>, + now: BlockNumberFor, + relay_parent_number: BlockNumberFor, } /// An error indicating that creating Persisted Validation Data failed @@ -1172,7 +1177,7 @@ pub(crate) struct CandidateCheckContext { pub(crate) struct FailedToCreatePVD; impl CandidateCheckContext { - pub(crate) fn new(now: T::BlockNumber, relay_parent_number: T::BlockNumber) -> Self { + pub(crate) fn new(now: BlockNumberFor, relay_parent_number: BlockNumberFor) -> Self { Self { config: >::config(), now, relay_parent_number } } @@ -1244,7 +1249,7 @@ impl CandidateCheckContext { &backed_candidate.candidate.commitments.new_validation_code, backed_candidate.candidate.commitments.processed_downward_messages, &backed_candidate.candidate.commitments.upward_messages, - T::BlockNumber::from(backed_candidate.candidate.commitments.hrmp_watermark), + BlockNumberFor::::from(backed_candidate.candidate.commitments.hrmp_watermark), &backed_candidate.candidate.commitments.horizontal_messages, ) { log::debug!( @@ -1267,9 +1272,9 @@ impl CandidateCheckContext { new_validation_code: &Option, processed_downward_messages: u32, upward_messages: &[primitives::UpwardMessage], - hrmp_watermark: T::BlockNumber, + hrmp_watermark: BlockNumberFor, horizontal_messages: &[primitives::OutboundHrmpMessage], - ) -> Result<(), AcceptanceCheckErr> { + ) -> Result<(), AcceptanceCheckErr>> { ensure!( head_data.0.len() <= self.config.max_head_data_size as _, AcceptanceCheckErr::HeadDataTooLarge, diff --git a/runtime/parachains/src/initializer.rs b/runtime/parachains/src/initializer.rs index 338392b6e060..b9ecc3038ca2 100644 --- a/runtime/parachains/src/initializer.rs +++ b/runtime/parachains/src/initializer.rs @@ -116,7 +116,7 @@ pub mod pallet { + hrmp::Config { /// A randomness beacon. - type Randomness: Randomness; + type Randomness: Randomness>; /// An origin which is allowed to force updates to parachains. type ForceOrigin: EnsureOrigin<::RuntimeOrigin>; /// Weight information for extrinsics in this pallet. @@ -147,7 +147,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_initialize(now: T::BlockNumber) -> Weight { + fn on_initialize(now: BlockNumberFor) -> Weight { // The other modules are initialized in this order: // - Configuration // - Paras @@ -174,7 +174,7 @@ pub mod pallet { total_weight } - fn on_finalize(now: T::BlockNumber) { + fn on_finalize(now: BlockNumberFor) { // reverse initialization order. hrmp::Pallet::::initializer_finalize(); dmp::Pallet::::initializer_finalize(); diff --git a/runtime/parachains/src/mock.rs b/runtime/parachains/src/mock.rs index b06a75480662..b33559ff663c 100644 --- a/runtime/parachains/src/mock.rs +++ b/runtime/parachains/src/mock.rs @@ -27,34 +27,30 @@ use crate::{ use frame_support::{ assert_ok, parameter_types, traits::{ - Currency, GenesisBuild, ProcessMessage, ProcessMessageError, ValidatorSet, - ValidatorSetWithIdentification, + Currency, ProcessMessage, ProcessMessageError, ValidatorSet, ValidatorSetWithIdentification, }, weights::{Weight, WeightMeter}, }; use frame_support_test::TestRandomness; use parity_scale_codec::Decode; use primitives::{ - AuthorityDiscoveryId, Balance, BlockNumber, CandidateHash, Header, Moment, SessionIndex, - UpwardMessage, ValidationCode, ValidatorIndex, + AuthorityDiscoveryId, Balance, BlockNumber, CandidateHash, Moment, SessionIndex, UpwardMessage, + ValidationCode, ValidatorIndex, }; use sp_core::{ConstU32, H256}; use sp_io::TestExternalities; use sp_runtime::{ traits::{AccountIdConversion, BlakeTwo256, IdentityLookup}, transaction_validity::TransactionPriority, - Permill, + BuildStorage, Permill, }; use std::{cell::RefCell, collections::HashMap}; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; +type Block = frame_system::mocking::MockBlockU32; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { System: frame_system, Balances: pallet_balances, @@ -100,13 +96,12 @@ impl frame_system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = BlockNumber; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -485,9 +480,9 @@ pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities { BACKING_REWARDS.with(|r| r.borrow_mut().clear()); AVAILABILITY_REWARDS.with(|r| r.borrow_mut().clear()); - let mut t = state.system.build_storage::().unwrap(); + let mut t = state.system.build_storage().unwrap(); state.configuration.assimilate_storage(&mut t).unwrap(); - GenesisBuild::::assimilate_storage(&state.paras, &mut t).unwrap(); + state.paras.assimilate_storage(&mut t).unwrap(); let mut ext: TestExternalities = t.into(); ext.register_extension(KeystoreExt(Arc::new(MemoryKeystore::new()) as KeystorePtr)); @@ -497,9 +492,9 @@ pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities { #[derive(Default)] pub struct MockGenesisConfig { - pub system: frame_system::GenesisConfig, + pub system: frame_system::GenesisConfig, pub configuration: crate::configuration::GenesisConfig, - pub paras: crate::paras::GenesisConfig, + pub paras: crate::paras::GenesisConfig, } pub fn assert_last_event(generic_event: RuntimeEvent) { diff --git a/runtime/parachains/src/paras/benchmarking.rs b/runtime/parachains/src/paras/benchmarking.rs index 8faf8d67f7fd..9dfb8a4b37d7 100644 --- a/runtime/parachains/src/paras/benchmarking.rs +++ b/runtime/parachains/src/paras/benchmarking.rs @@ -17,7 +17,7 @@ use super::*; use crate::configuration::HostConfiguration; use frame_benchmarking::benchmarks; -use frame_system::RawOrigin; +use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use primitives::{HeadData, Id as ParaId, ValidationCode, MAX_CODE_SIZE, MAX_HEAD_DATA_SIZE}; use sp_runtime::traits::{One, Saturating}; @@ -44,7 +44,7 @@ fn generate_disordered_pruning() { for i in 0..SAMPLE_SIZE { let id = ParaId::from(i); - let block_number = T::BlockNumber::from(1000u32); + let block_number = BlockNumberFor::::from(1000u32); needs_pruning.push((id, block_number)); } @@ -57,7 +57,7 @@ pub(crate) fn generate_disordered_upgrades() { for i in 0..SAMPLE_SIZE { let id = ParaId::from(i); - let block_number = T::BlockNumber::from(1000u32); + let block_number = BlockNumberFor::::from(1000u32); upgrades.push((id, block_number)); cooldowns.push((id, block_number)); } @@ -103,7 +103,7 @@ benchmarks! { let c in 1 .. MAX_CODE_SIZE; let new_code = ValidationCode(vec![0; c as usize]); let para_id = ParaId::from(c as u32); - let block = T::BlockNumber::from(c); + let block = BlockNumberFor::::from(c); generate_disordered_upgrades::(); }: _(RawOrigin::Root, para_id, new_code, block) verify { @@ -118,7 +118,7 @@ benchmarks! { // schedule an expired code upgrade for this `para_id` so that force_note_new_head would use // the worst possible code path let expired = frame_system::Pallet::::block_number().saturating_sub(One::one()); - let config = HostConfiguration::::default(); + let config = HostConfiguration::>::default(); generate_disordered_pruning::(); Pallet::::schedule_code_upgrade(para_id, ValidationCode(vec![0]), expired, &config); }: _(RawOrigin::Root, para_id, new_head) diff --git a/runtime/parachains/src/paras/mod.rs b/runtime/parachains/src/paras/mod.rs index 554a393d6057..c1a53579c35a 100644 --- a/runtime/parachains/src/paras/mod.rs +++ b/runtime/parachains/src/paras/mod.rs @@ -550,7 +550,7 @@ pub mod pallet { #[pallet::constant] type UnsignedPriority: Get; - type NextSessionRotation: EstimateNextSessionRotation; + type NextSessionRotation: EstimateNextSessionRotation>; /// Retrieve how many UMP messages are enqueued for this para-chain. /// @@ -623,7 +623,7 @@ pub mod pallet { _, Twox64Concat, ValidationCodeHash, - PvfCheckActiveVoteState, + PvfCheckActiveVoteState>, OptionQuery, >; @@ -662,7 +662,7 @@ pub mod pallet { /// Corresponding code can be retrieved with [`CodeByHash`]. #[pallet::storage] pub(super) type PastCodeHash = - StorageMap<_, Twox64Concat, (ParaId, T::BlockNumber), ValidationCodeHash>; + StorageMap<_, Twox64Concat, (ParaId, BlockNumberFor), ValidationCodeHash>; /// Past code of parachains. The parachains themselves may not be registered anymore, /// but we also keep their code on-chain for the same amount of time as outdated code @@ -670,7 +670,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn past_code_meta)] pub(super) type PastCodeMeta = - StorageMap<_, Twox64Concat, ParaId, ParaPastCodeMeta, ValueQuery>; + StorageMap<_, Twox64Concat, ParaId, ParaPastCodeMeta>, ValueQuery>; /// Which paras have past code that needs pruning and the relay-chain block at which the code was replaced. /// Note that this is the actual height of the included block, not the expected height at which the @@ -680,7 +680,7 @@ pub mod pallet { /// Multiple entries for a single para are permitted. Ordered ascending by block number. #[pallet::storage] pub(super) type PastCodePruning = - StorageValue<_, Vec<(ParaId, T::BlockNumber)>, ValueQuery>; + StorageValue<_, Vec<(ParaId, BlockNumberFor)>, ValueQuery>; /// The block number at which the planned code change is expected for a para. /// The change will be applied after the first parablock for this ID included which executes @@ -688,7 +688,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn future_code_upgrade_at)] pub(super) type FutureCodeUpgrades = - StorageMap<_, Twox64Concat, ParaId, T::BlockNumber>; + StorageMap<_, Twox64Concat, ParaId, BlockNumberFor>; /// The actual future code hash of a para. /// @@ -728,7 +728,7 @@ pub mod pallet { /// Ordered ascending by block number. #[pallet::storage] pub(super) type UpgradeCooldowns = - StorageValue<_, Vec<(ParaId, T::BlockNumber)>, ValueQuery>; + StorageValue<_, Vec<(ParaId, BlockNumberFor)>, ValueQuery>; /// The list of upcoming code upgrades. Each item is a pair of which para performs a code /// upgrade and at which relay-chain block it is expected at. @@ -736,7 +736,7 @@ pub mod pallet { /// Ordered ascending by block number. #[pallet::storage] pub(super) type UpcomingUpgrades = - StorageValue<_, Vec<(ParaId, T::BlockNumber)>, ValueQuery>; + StorageValue<_, Vec<(ParaId, BlockNumberFor)>, ValueQuery>; /// The actions to perform during the start of a specific session index. #[pallet::storage] @@ -768,12 +768,14 @@ pub mod pallet { #[pallet::genesis_config] #[derive(DefaultNoBound)] - pub struct GenesisConfig { + pub struct GenesisConfig { + #[serde(skip)] + pub _config: sp_std::marker::PhantomData, pub paras: Vec<(ParaId, ParaGenesisArgs)>, } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { let mut parachains = ParachainsCache::new(); for (id, genesis_args) in &self.paras { @@ -836,7 +838,7 @@ pub mod pallet { origin: OriginFor, para: ParaId, new_code: ValidationCode, - relay_parent_number: T::BlockNumber, + relay_parent_number: BlockNumberFor, ) -> DispatchResult { ensure_root(origin)?; let config = configuration::Pallet::::config(); @@ -1143,13 +1145,13 @@ impl Pallet { } /// Called by the initializer to initialize the paras pallet. - pub(crate) fn initializer_initialize(now: T::BlockNumber) -> Weight { + pub(crate) fn initializer_initialize(now: BlockNumberFor) -> Weight { let weight = Self::prune_old_code(now); weight + Self::process_scheduled_upgrade_changes(now) } /// Called by the initializer to finalize the paras pallet. - pub(crate) fn initializer_finalize(now: T::BlockNumber) { + pub(crate) fn initializer_finalize(now: BlockNumberFor) { Self::process_scheduled_upgrade_cooldowns(now); } @@ -1157,7 +1159,7 @@ impl Pallet { /// /// Returns the list of outgoing paras from the actions queue. pub(crate) fn initializer_on_new_session( - notification: &SessionChangeNotification, + notification: &SessionChangeNotification>, ) -> Vec { let outgoing_paras = Self::apply_actions_queue(notification.session_index); Self::groom_ongoing_pvf_votes(¬ification.new_config, notification.validators.len()); @@ -1273,8 +1275,8 @@ impl Pallet { // (i.e. number of `relay_parent` in the receipt) fn note_past_code( id: ParaId, - at: T::BlockNumber, - now: T::BlockNumber, + at: BlockNumberFor, + now: BlockNumberFor, old_code_hash: ValidationCodeHash, ) -> Weight { PastCodeMeta::::mutate(&id, |past_meta| { @@ -1296,7 +1298,7 @@ impl Pallet { // looks at old code metadata, compares them to the current acceptance window, and prunes those // that are too old. - fn prune_old_code(now: T::BlockNumber) -> Weight { + fn prune_old_code(now: BlockNumberFor) -> Weight { let config = configuration::Pallet::::config(); let code_retention_period = config.code_retention_period; if now <= code_retention_period { @@ -1308,7 +1310,7 @@ impl Pallet { let pruning_height = now - (code_retention_period + One::one()); let pruning_tasks_done = - PastCodePruning::::mutate(|pruning_tasks: &mut Vec<(_, T::BlockNumber)>| { + PastCodePruning::::mutate(|pruning_tasks: &mut Vec<(_, BlockNumberFor)>| { let (pruning_tasks_done, pruning_tasks_to_do) = { // find all past code that has just exited the pruning window. let up_to_idx = @@ -1356,11 +1358,11 @@ impl Pallet { /// the upgrade restriction, that will happen in the `initializer_finalize` function. However, /// this function does count the number of cooldown timers expired so that we can reserve weight /// for the `initializer_finalize` function. - fn process_scheduled_upgrade_changes(now: T::BlockNumber) -> Weight { + fn process_scheduled_upgrade_changes(now: BlockNumberFor) -> Weight { // account weight for `UpcomingUpgrades::mutate`. let mut weight = T::DbWeight::get().reads_writes(1, 1); let upgrades_signaled = UpcomingUpgrades::::mutate( - |upcoming_upgrades: &mut Vec<(ParaId, T::BlockNumber)>| { + |upcoming_upgrades: &mut Vec<(ParaId, BlockNumberFor)>| { let num = upcoming_upgrades.iter().take_while(|&(_, at)| at <= &now).count(); for (para, _) in upcoming_upgrades.drain(..num) { UpgradeGoAheadSignal::::insert(¶, UpgradeGoAhead::GoAhead); @@ -1387,24 +1389,26 @@ impl Pallet { /// Actually perform unsetting the expired upgrade restrictions. /// /// See `process_scheduled_upgrade_changes` for more details. - fn process_scheduled_upgrade_cooldowns(now: T::BlockNumber) { - UpgradeCooldowns::::mutate(|upgrade_cooldowns: &mut Vec<(ParaId, T::BlockNumber)>| { - // Remove all expired signals and also prune the cooldowns. - upgrade_cooldowns.retain(|(para, at)| { - if at <= &now { - UpgradeRestrictionSignal::::remove(¶); - false - } else { - true - } - }); - }); + fn process_scheduled_upgrade_cooldowns(now: BlockNumberFor) { + UpgradeCooldowns::::mutate( + |upgrade_cooldowns: &mut Vec<(ParaId, BlockNumberFor)>| { + // Remove all expired signals and also prune the cooldowns. + upgrade_cooldowns.retain(|(para, at)| { + if at <= &now { + UpgradeRestrictionSignal::::remove(¶); + false + } else { + true + } + }); + }, + ); } /// Goes over all PVF votes in progress, reinitializes ballots, increments ages and prunes the /// active votes that reached their time-to-live. fn groom_ongoing_pvf_votes( - cfg: &configuration::HostConfiguration, + cfg: &configuration::HostConfiguration>, new_n_validators: usize, ) -> Weight { let mut weight = T::DbWeight::get().reads(1); @@ -1454,11 +1458,11 @@ impl Pallet { } fn enact_pvf_accepted( - now: T::BlockNumber, + now: BlockNumberFor, code_hash: &ValidationCodeHash, - causes: &[PvfCheckCause], + causes: &[PvfCheckCause>], sessions_observed: SessionIndex, - cfg: &configuration::HostConfiguration, + cfg: &configuration::HostConfiguration>, ) -> Weight { let mut weight = Weight::zero(); for cause in causes { @@ -1501,9 +1505,9 @@ impl Pallet { fn proceed_with_upgrade( id: ParaId, code_hash: &ValidationCodeHash, - now: T::BlockNumber, - relay_parent_number: T::BlockNumber, - cfg: &configuration::HostConfiguration, + now: BlockNumberFor, + relay_parent_number: BlockNumberFor, + cfg: &configuration::HostConfiguration>, ) -> Weight { let mut weight = Weight::zero(); @@ -1543,7 +1547,7 @@ impl Pallet { fn enact_pvf_rejected( code_hash: &ValidationCodeHash, - causes: Vec>, + causes: Vec>>, ) -> Weight { let mut weight = Weight::zero(); @@ -1764,8 +1768,8 @@ impl Pallet { pub(crate) fn schedule_code_upgrade( id: ParaId, new_code: ValidationCode, - relay_parent_number: T::BlockNumber, - cfg: &configuration::HostConfiguration, + relay_parent_number: BlockNumberFor, + cfg: &configuration::HostConfiguration>, ) -> Weight { let mut weight = T::DbWeight::get().reads(1); @@ -1838,10 +1842,10 @@ impl Pallet { /// /// Unconditionally increases the reference count for the passed `code`. fn kick_off_pvf_check( - cause: PvfCheckCause, + cause: PvfCheckCause>, code_hash: ValidationCodeHash, code: ValidationCode, - cfg: &configuration::HostConfiguration, + cfg: &configuration::HostConfiguration>, ) -> Weight { let mut weight = Weight::zero(); @@ -1910,7 +1914,7 @@ impl Pallet { pub(crate) fn note_new_head( id: ParaId, new_head: HeadData, - execution_context: T::BlockNumber, + execution_context: BlockNumberFor, ) -> Weight { Heads::::insert(&id, new_head); diff --git a/runtime/parachains/src/paras_inherent/mod.rs b/runtime/parachains/src/paras_inherent/mod.rs index f20af3ba7d64..ca846949b703 100644 --- a/runtime/parachains/src/paras_inherent/mod.rs +++ b/runtime/parachains/src/paras_inherent/mod.rs @@ -191,11 +191,11 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_initialize(_: T::BlockNumber) -> Weight { + fn on_initialize(_: BlockNumberFor) -> Weight { T::DbWeight::get().reads_writes(1, 1) // in `on_finalize`. } - fn on_finalize(_: T::BlockNumber) { + fn on_finalize(_: BlockNumberFor) { if Included::::take().is_none() { panic!("Bitfields and heads must be included every block"); } @@ -262,7 +262,7 @@ pub mod pallet { ))] pub fn enter( origin: OriginFor, - data: ParachainsInherentData, + data: ParachainsInherentData>, ) -> DispatchResultWithPostInfo { ensure_none(origin)?; @@ -277,7 +277,7 @@ pub mod pallet { impl Pallet { /// Create the `ParachainsInherentData` that gets passed to [`Self::enter`] in [`Self::create_inherent`]. /// This code is pulled out of [`Self::create_inherent`] so it can be unit tested. - fn create_inherent_inner(data: &InherentData) -> Option> { + fn create_inherent_inner(data: &InherentData) -> Option>> { let parachains_inherent_data = match data.get_data(&Self::INHERENT_IDENTIFIER) { Ok(Some(d)) => d, Ok(None) => return None, @@ -307,9 +307,9 @@ impl Pallet { /// Returns: Result containing processed inherent data and weight, the processed inherent would /// consume. fn process_inherent_data( - data: ParachainsInherentData, + data: ParachainsInherentData>, ) -> sp_std::result::Result< - (ParachainsInherentData, PostDispatchInfo), + (ParachainsInherentData>, PostDispatchInfo), DispatchErrorWithPostInfo, > { #[cfg(feature = "runtime-metrics")] @@ -530,7 +530,7 @@ impl Pallet { // Process backed candidates according to scheduled cores. let parent_storage_root = *parent_header.state_root(); - let inclusion::ProcessedCandidates::<::Hash> { + let inclusion::ProcessedCandidates::< as HeaderT>::Hash> { core_indices: occupied, candidate_receipt_with_backing_validator_indices, } = >::process_candidates( diff --git a/runtime/parachains/src/runtime_api_impl/v5.rs b/runtime/parachains/src/runtime_api_impl/v5.rs index 72425995b4b0..7708bbd69b73 100644 --- a/runtime/parachains/src/runtime_api_impl/v5.rs +++ b/runtime/parachains/src/runtime_api_impl/v5.rs @@ -21,6 +21,7 @@ use crate::{ configuration, disputes, dmp, hrmp, inclusion, initializer, paras, paras_inherent, scheduler, session_info, shared, }; +use frame_system::pallet_prelude::*; use primitives::{ slashing, AuthorityDiscoveryId, CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreIndex, CoreOccupied, CoreState, DisputeState, ExecutorParams, GroupIndex, @@ -39,7 +40,7 @@ pub fn validators() -> Vec { /// Implementation for the `validator_groups` function of the runtime API. pub fn validator_groups( -) -> (Vec>, GroupRotationInfo) { +) -> (Vec>, GroupRotationInfo>) { let now = >::block_number() + One::one(); let groups = >::validator_groups(); @@ -49,7 +50,7 @@ pub fn validator_groups( } /// Implementation for the `availability_cores` function of the runtime API. -pub fn availability_cores() -> Vec> { +pub fn availability_cores() -> Vec>> { let cores = >::availability_cores(); let parachains = >::parachains(); let config = >::config(); @@ -176,7 +177,7 @@ pub fn availability_cores() -> Vec( -) -> (::BlockNumber, ::Hash) { +) -> (BlockNumberFor, ::Hash) { use parity_scale_codec::Decode as _; let state_version = >::runtime_version().state_version(); let relay_parent_number = >::block_number(); @@ -214,7 +215,7 @@ where pub fn persisted_validation_data( para_id: ParaId, assumption: OccupiedCoreAssumption, -) -> Option> { +) -> Option>> { let (relay_parent_number, relay_parent_storage_root) = current_relay_parent::(); with_assumption::(para_id, assumption, || { crate::util::make_persisted_validation_data::( @@ -229,7 +230,7 @@ pub fn persisted_validation_data( pub fn assumed_validation_data( para_id: ParaId, expected_persisted_validation_data_hash: Hash, -) -> Option<(PersistedValidationData, ValidationCodeHash)> { +) -> Option<(PersistedValidationData>, ValidationCodeHash)> { let (relay_parent_number, relay_parent_storage_root) = current_relay_parent::(); // This closure obtains the `persisted_validation_data` for the given `para_id` and matches // its hash against an expected one. @@ -355,14 +356,14 @@ pub fn session_info(index: SessionIndex) -> Option( recipient: ParaId, -) -> Vec> { +) -> Vec>> { >::dmq_contents(recipient) } /// Implementation for the `inbound_hrmp_channels_contents` function of the runtime API. pub fn inbound_hrmp_channels_contents( recipient: ParaId, -) -> BTreeMap>> { +) -> BTreeMap>>> { >::inbound_hrmp_channels_contents(recipient) } @@ -407,7 +408,7 @@ where /// Implementation for `get_session_disputes` function from the runtime API pub fn get_session_disputes( -) -> Vec<(SessionIndex, CandidateHash, DisputeState)> { +) -> Vec<(SessionIndex, CandidateHash, DisputeState>)> { >::disputes() } diff --git a/runtime/parachains/src/scheduler.rs b/runtime/parachains/src/scheduler.rs index 916df1687b9d..b69c16ae8d01 100644 --- a/runtime/parachains/src/scheduler.rs +++ b/runtime/parachains/src/scheduler.rs @@ -36,6 +36,7 @@ //! over time. use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::BlockNumberFor; use primitives::{ CollatorId, CoreIndex, CoreOccupied, GroupIndex, GroupRotationInfo, Id as ParaId, ParathreadClaim, ParathreadEntry, ScheduledCore, ValidatorIndex, @@ -208,7 +209,7 @@ pub mod pallet { /// block following the session change, block number of which we save in this storage value. #[pallet::storage] #[pallet::getter(fn session_start_block)] - pub(crate) type SessionStartBlock = StorageValue<_, T::BlockNumber, ValueQuery>; + pub(crate) type SessionStartBlock = StorageValue<_, BlockNumberFor, ValueQuery>; /// Currently scheduled cores - free but up to be occupied. /// @@ -224,7 +225,7 @@ pub mod pallet { impl Pallet { /// Called by the initializer to initialize the scheduler pallet. - pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight { + pub(crate) fn initializer_initialize(_now: BlockNumberFor) -> Weight { Weight::zero() } @@ -233,7 +234,7 @@ impl Pallet { /// Called by the initializer to note that a new session has started. pub(crate) fn initializer_on_new_session( - notification: &SessionChangeNotification, + notification: &SessionChangeNotification>, ) { let SessionChangeNotification { validators, new_config, .. } = notification; let config = new_config; @@ -421,7 +422,7 @@ impl Pallet { /// ascending order by core index. pub(crate) fn schedule( just_freed_cores: impl IntoIterator, - now: T::BlockNumber, + now: BlockNumberFor, ) { Self::free_cores(just_freed_cores); @@ -590,7 +591,7 @@ impl Pallet { /// or the block number is less than the session start index. pub(crate) fn group_assigned_to_core( core: CoreIndex, - at: T::BlockNumber, + at: BlockNumberFor, ) -> Option { let config = >::config(); let session_start_block = >::get(); @@ -605,11 +606,12 @@ impl Pallet { return None } - let rotations_since_session_start: T::BlockNumber = + let rotations_since_session_start: BlockNumberFor = (at - session_start_block) / config.group_rotation_frequency.into(); let rotations_since_session_start = - >::try_into(rotations_since_session_start).unwrap_or(0); + as TryInto>::try_into(rotations_since_session_start) + .unwrap_or(0); // Error case can only happen if rotations occur only once every u32::max(), // so functionally no difference in behavior. @@ -629,7 +631,7 @@ impl Pallet { /// https://github.com/rust-lang/rust/issues/73226 /// which prevents us from testing the code if using `impl Trait`. pub(crate) fn availability_timeout_predicate( - ) -> Option bool>> { + ) -> Option) -> bool>> { let now = >::block_number(); let config = >::config(); @@ -670,7 +672,9 @@ impl Pallet { } /// Returns a helper for determining group rotation. - pub(crate) fn group_rotation_info(now: T::BlockNumber) -> GroupRotationInfo { + pub(crate) fn group_rotation_info( + now: BlockNumberFor, + ) -> GroupRotationInfo> { let session_start_block = Self::session_start_block(); let group_rotation_frequency = >::config().group_rotation_frequency; diff --git a/runtime/parachains/src/session_info.rs b/runtime/parachains/src/session_info.rs index 9f47ad0b03d6..0043851be0f2 100644 --- a/runtime/parachains/src/session_info.rs +++ b/runtime/parachains/src/session_info.rs @@ -27,6 +27,7 @@ use frame_support::{ pallet_prelude::*, traits::{OneSessionHandler, ValidatorSet, ValidatorSetWithIdentification}, }; +use frame_system::pallet_prelude::BlockNumberFor; use primitives::{AssignmentId, AuthorityDiscoveryId, ExecutorParams, SessionIndex, SessionInfo}; use sp_std::vec::Vec; @@ -125,7 +126,7 @@ impl AuthorityDiscoveryConfig for T { impl Pallet { /// Handle an incoming session change. pub(crate) fn initializer_on_new_session( - notification: &crate::initializer::SessionChangeNotification, + notification: &crate::initializer::SessionChangeNotification>, ) { let config = >::config(); @@ -195,7 +196,7 @@ impl Pallet { } /// Called by the initializer to initialize the session info pallet. - pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight { + pub(crate) fn initializer_initialize(_now: BlockNumberFor) -> Weight { Weight::zero() } diff --git a/runtime/parachains/src/shared.rs b/runtime/parachains/src/shared.rs index 686b955175b1..857e671f0ee4 100644 --- a/runtime/parachains/src/shared.rs +++ b/runtime/parachains/src/shared.rs @@ -20,6 +20,7 @@ //! dependent on any of the other pallets. use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::BlockNumberFor; use primitives::{SessionIndex, ValidatorId, ValidatorIndex}; use sp_std::vec::Vec; @@ -73,7 +74,7 @@ pub mod pallet { impl Pallet { /// Called by the initializer to initialize the configuration pallet. - pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight { + pub(crate) fn initializer_initialize(_now: BlockNumberFor) -> Weight { Weight::zero() } @@ -86,7 +87,7 @@ impl Pallet { pub(crate) fn initializer_on_new_session( session_index: SessionIndex, random_seed: [u8; 32], - new_config: &HostConfiguration, + new_config: &HostConfiguration>, all_validators: Vec, ) -> Vec { CurrentSessionIndex::::set(session_index); diff --git a/runtime/parachains/src/util.rs b/runtime/parachains/src/util.rs index bf037b54a99f..d5b339b679e3 100644 --- a/runtime/parachains/src/util.rs +++ b/runtime/parachains/src/util.rs @@ -17,6 +17,7 @@ //! Utilities that don't belong to any particular module but may draw //! on all modules. +use frame_system::pallet_prelude::BlockNumberFor; use primitives::{Id as ParaId, PersistedValidationData, ValidatorIndex}; use sp_std::{collections::btree_set::BTreeSet, vec::Vec}; @@ -28,9 +29,9 @@ use crate::{configuration, hrmp, paras}; /// This ties together the storage of several modules. pub fn make_persisted_validation_data( para_id: ParaId, - relay_parent_number: T::BlockNumber, + relay_parent_number: BlockNumberFor, relay_parent_storage_root: T::Hash, -) -> Option> { +) -> Option>> { let config = >::config(); Some(PersistedValidationData { diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index d9bf579a7061..fa5d4f5a1bf0 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -160,13 +160,12 @@ impl frame_system::Config for Runtime { type BlockLength = BlockLength; type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = Nonce; - type BlockNumber = BlockNumber; + type Nonce = Nonce; type Hash = Hash; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = AccountIdLookup; - type Header = generic::Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = RocksDbWeight; @@ -782,7 +781,7 @@ where call: RuntimeCall, public: ::Signer, account: AccountId, - nonce: ::Index, + nonce: ::Nonce, ) -> Option<(RuntimeCall, ::SignaturePayload)> { use sp_runtime::traits::StaticLookup; // take the biggest period possible. @@ -1340,18 +1339,15 @@ impl frame_support::traits::OnRuntimeUpgrade for InitiateNominationPools { } construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = primitives::Block, - UncheckedExtrinsic = UncheckedExtrinsic + pub enum Runtime { // Basic stuff; balances is uncallable initially. - System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, + System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 1, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 10, // Babe must be before session. - Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 2, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 2, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3, Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 4, @@ -1366,9 +1362,9 @@ construct_runtime! { Offences: pallet_offences::{Pallet, Storage, Event} = 8, Historical: session_historical::{Pallet} = 33, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 9, - Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 11, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 11, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 12, - AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 13, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 13, // Old governance stuff. Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 14, @@ -1376,7 +1372,7 @@ construct_runtime! { TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 16, PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 17, TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 18, - Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 19, + Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 19, // OpenGov stuff. ConvictionVoting: pallet_conviction_voting::{Pallet, Call, Storage, Event} = 20, @@ -1426,11 +1422,11 @@ construct_runtime! { ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event} = 53, ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54, ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55, - Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, + Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, Dmp: parachains_dmp::{Pallet, Storage} = 58, // Ump 59 - Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event, Config} = 60, + Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event, Config} = 60, ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61, ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event} = 62, ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 63, @@ -1442,7 +1438,7 @@ construct_runtime! { Crowdloan: crowdloan::{Pallet, Call, Storage, Event} = 73, // Pallet for sending XCM. - XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, + XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, // Generalized message queue MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event} = 100, @@ -1525,9 +1521,7 @@ pub mod migrations { ump_migrations::UpdateUmpLimits, ); - pub type V10000 = ( - pallet_im_online::migration::v1::Migration, - ); + pub type V10000 = (pallet_im_online::migration::v1::Migration,); /// Unreleased migrations. Add new ones here: pub type Unreleased = (); @@ -2379,8 +2373,8 @@ mod multiplier_tests { where F: FnMut() -> (), { - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() + let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::::default() + .build_storage() .unwrap() .into(); t.execute_with(|| { @@ -2428,8 +2422,8 @@ mod multiplier_tests { frame_system::Pallet::::set_block_consumed_resources(Weight::MAX, 0); let info = DispatchInfo { weight: Weight::MAX, ..Default::default() }; - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() + let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::::default() + .build_storage() .unwrap() .into(); // set the minimum @@ -2471,8 +2465,8 @@ mod multiplier_tests { let mut multiplier = Multiplier::from_u32(2); let mut blocks = 0; - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() + let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::::default() + .build_storage() .unwrap() .into(); // set the minimum diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index ca69947b676d..235e1ecd252d 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -155,13 +155,12 @@ impl frame_system::Config for Runtime { type DbWeight = RocksDbWeight; type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = Nonce; - type BlockNumber = BlockNumber; + type Nonce = Nonce; type Hash = Hash; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = AccountIdLookup; - type Header = generic::Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = Version; @@ -676,7 +675,7 @@ where call: RuntimeCall, public: ::Signer, account: AccountId, - nonce: ::Index, + nonce: ::Nonce, ) -> Option<(RuntimeCall, ::SignaturePayload)> { use sp_runtime::traits::StaticLookup; // take the biggest period possible. @@ -1359,16 +1358,13 @@ impl pallet_sudo::Config for Runtime { } construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = primitives::Block, - UncheckedExtrinsic = UncheckedExtrinsic + pub enum Runtime { // Basic stuff; balances is uncallable initially. - System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, + System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, // Babe must be before session. - Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 3, @@ -1385,9 +1381,9 @@ construct_runtime! { // refer to block consistently. see substrate issue #11797 for details. Mmr: pallet_mmr::{Pallet, Storage} = 241, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, - Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 11, - AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, // Governance stuff; uncallable initially. Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 13, @@ -1395,7 +1391,7 @@ construct_runtime! { TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 16, TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17, - Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, + Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, // Claims. Usable initially. Claims: claims::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 19, @@ -1446,23 +1442,23 @@ construct_runtime! { ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event} = 53, ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54, ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55, - Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, + Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, Dmp: parachains_dmp::{Pallet, Storage} = 58, - Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event, Config} = 60, + Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event, Config} = 60, ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61, ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event} = 62, ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 63, MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event} = 64, // Parachain Onboarding Pallets. Start indices at 70 to leave room. - Registrar: paras_registrar::{Pallet, Call, Storage, Event, Config} = 70, + Registrar: paras_registrar::{Pallet, Call, Storage, Event, Config} = 70, Slots: slots::{Pallet, Call, Storage, Event} = 71, Auctions: auctions::{Pallet, Call, Storage, Event} = 72, Crowdloan: crowdloan::{Pallet, Call, Storage, Event} = 73, // Pallet for sending XCM. - XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, + XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, // Rococo specific pallets (not included in Kusama). Start indices at 240 // @@ -1630,8 +1626,7 @@ pub mod migrations { ); /// Unreleased migrations. Add new ones here: - pub type Unreleased = ( - ); + pub type Unreleased = (); } /// Helpers to configure all migrations. diff --git a/runtime/test-runtime/src/lib.rs b/runtime/test-runtime/src/lib.rs index 7703abfc7b4f..4ab8dcfda31b 100644 --- a/runtime/test-runtime/src/lib.rs +++ b/runtime/test-runtime/src/lib.rs @@ -140,13 +140,12 @@ impl frame_system::Config for Runtime { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = Nonce; - type BlockNumber = BlockNumber; + type Nonce = Nonce; type Hash = HashT; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = Indices; - type Header = generic::Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = Version; @@ -385,7 +384,7 @@ where call: RuntimeCall, public: ::Signer, account: AccountId, - nonce: ::Index, + nonce: ::Nonce, ) -> Option<(RuntimeCall, ::SignaturePayload)> { let period = BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64; @@ -646,16 +645,13 @@ pub mod pallet_test_notifier { } construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = primitives::Block, - UncheckedExtrinsic = UncheckedExtrinsic + pub enum Runtime { // Basic stuff; balances is uncallable initially. - System: frame_system::{Pallet, Call, Storage, Config, Event}, + System: frame_system::{Pallet, Call, Storage, Config, Event}, // Must be before session. - Babe: pallet_babe::{Pallet, Call, Storage, Config}, + Babe: pallet_babe::{Pallet, Call, Storage, Config}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Indices: pallet_indices::{Pallet, Call, Storage, Config, Event}, @@ -668,8 +664,8 @@ construct_runtime! { Offences: pallet_offences::{Pallet, Storage, Event}, Historical: session_historical::{Pallet}, Session: pallet_session::{Pallet, Call, Storage, Event, Config}, - Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, - AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config}, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config}, // Claims. Usable initially. Claims: claims::{Pallet, Call, Storage, Event, Config, ValidateUnsigned}, diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 91a631b0c68c..eaaf84119e61 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -150,13 +150,12 @@ impl frame_system::Config for Runtime { type BlockLength = BlockLength; type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = Nonce; - type BlockNumber = BlockNumber; + type Nonce = Nonce; type Hash = Hash; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = AccountIdLookup; - type Header = generic::Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = RocksDbWeight; @@ -610,7 +609,7 @@ where call: RuntimeCall, public: ::Signer, account: AccountId, - nonce: ::Index, + nonce: ::Nonce, ) -> Option<(RuntimeCall, ::SignaturePayload)> { use sp_runtime::traits::StaticLookup; // take the biggest period possible. @@ -1144,16 +1143,13 @@ parameter_types! { } construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = primitives::Block, - UncheckedExtrinsic = UncheckedExtrinsic + pub enum Runtime { // Basic stuff; balances is uncallable initially. - System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, + System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, // Babe must be before session. - Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 3, @@ -1168,9 +1164,9 @@ construct_runtime! { Offences: pallet_offences::{Pallet, Storage, Event} = 7, Historical: session_historical::{Pallet} = 27, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, - Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 11, - AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, // Utility module. Utility: pallet_utility::{Pallet, Call, Event} = 16, @@ -1218,17 +1214,17 @@ construct_runtime! { ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event} = 44, ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 45, ParaScheduler: parachains_scheduler::{Pallet, Storage} = 46, - Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 47, + Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 47, Initializer: parachains_initializer::{Pallet, Call, Storage} = 48, Dmp: parachains_dmp::{Pallet, Storage} = 49, // RIP Ump 50 - Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event, Config} = 51, + Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event, Config} = 51, ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 52, ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event} = 53, ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 54, // Parachain Onboarding Pallets. Start indices at 60 to leave room. - Registrar: paras_registrar::{Pallet, Call, Storage, Event, Config} = 60, + Registrar: paras_registrar::{Pallet, Call, Storage, Event, Config} = 60, Slots: slots::{Pallet, Call, Storage, Event} = 61, ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 62, Auctions: auctions::{Pallet, Call, Storage, Event} = 63, @@ -1236,7 +1232,7 @@ construct_runtime! { AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event} = 65, // Pallet for sending XCM. - XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, + XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, // Generalized message queue MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event} = 100, @@ -1326,9 +1322,7 @@ pub mod migrations { } } - pub type V10000 = ( - pallet_im_online::migration::v1::Migration, - ); + pub type V10000 = (pallet_im_online::migration::v1::Migration,); /// Unreleased migrations. Add new ones here: pub type Unreleased = (); diff --git a/scripts/ci/gitlab/pipeline/short-benchmarks.yml b/scripts/ci/gitlab/pipeline/short-benchmarks.yml index 89e137cf379b..dd150e5916e2 100644 --- a/scripts/ci/gitlab/pipeline/short-benchmarks.yml +++ b/scripts/ci/gitlab/pipeline/short-benchmarks.yml @@ -14,7 +14,7 @@ short-benchmark-polkadot: &short-bench variables: RUNTIME: polkadot script: - - ./artifacts/polkadot benchmark pallet --execution wasm --wasm-execution compiled --chain $RUNTIME-dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1 + - ./artifacts/polkadot benchmark pallet --wasm-execution compiled --chain $RUNTIME-dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1 short-benchmark-kusama: <<: *short-bench diff --git a/scripts/ci/run_benches_for_runtime.sh b/scripts/ci/run_benches_for_runtime.sh index d88ca343d6cf..296985a42764 100755 --- a/scripts/ci/run_benches_for_runtime.sh +++ b/scripts/ci/run_benches_for_runtime.sh @@ -42,7 +42,6 @@ for PALLET in "${PALLETS[@]}"; do --repeat=20 \ --pallet="$PALLET" \ --extrinsic="*" \ - --execution=wasm \ --wasm-execution=compiled \ --header=./file_header.txt \ --output="./runtime/${runtime}/src/weights/${output_file}" 2>&1 @@ -58,7 +57,6 @@ echo "[+] Benchmarking block and extrinsic overheads..." OUTPUT=$( ./target/production/polkadot benchmark overhead \ --chain="${runtime}-dev" \ - --execution=wasm \ --wasm-execution=compiled \ --weight-path="runtime/${runtime}/constants/src/weights/" \ --warmup=10 \ diff --git a/tests/benchmark_block.rs b/tests/benchmark_block.rs index b7ff6cdef969..bc91b31bc7b6 100644 --- a/tests/benchmark_block.rs +++ b/tests/benchmark_block.rs @@ -82,7 +82,7 @@ fn benchmark_block(runtime: &str, base_path: &Path, block: u32) -> Result<(), St .arg(base_path) .args(["--from", &block.to_string(), "--to", &block.to_string()]) .args(["--repeat", "1"]) - .args(["--execution", "wasm", "--wasm-execution", "compiled"]) + .args(["--wasm-execution", "compiled"]) .status() .map_err(|e| format!("command failed: {:?}", e))?; diff --git a/utils/staking-miner/src/main.rs b/utils/staking-miner/src/main.rs index 1ba42b21d91c..a4c496998ed9 100644 --- a/utils/staking-miner/src/main.rs +++ b/utils/staking-miner/src/main.rs @@ -83,7 +83,7 @@ macro_rules! construct_runtime_prelude { pub(crate) fn []( raw_solution: EPM::RawSolution>, signer: crate::signer::Signer, - nonce: crate::prelude::Index, + nonce: crate::prelude::Nonce, tip: crate::prelude::Balance, era: sp_runtime::generic::Era, ) -> UncheckedExtrinsic { @@ -121,7 +121,7 @@ macro_rules! construct_runtime_prelude { // NOTE: we might be able to use some code from the bridges repo here. fn signed_ext_builder_polkadot( - nonce: Index, + nonce: Nonce, tip: Balance, era: sp_runtime::generic::Era, ) -> polkadot_runtime_exports::SignedExtra { @@ -140,7 +140,7 @@ fn signed_ext_builder_polkadot( } fn signed_ext_builder_kusama( - nonce: Index, + nonce: Nonce, tip: Balance, era: sp_runtime::generic::Era, ) -> kusama_runtime_exports::SignedExtra { @@ -158,7 +158,7 @@ fn signed_ext_builder_kusama( } fn signed_ext_builder_westend( - nonce: Index, + nonce: Nonce, tip: Balance, era: sp_runtime::generic::Era, ) -> westend_runtime_exports::SignedExtra { diff --git a/utils/staking-miner/src/prelude.rs b/utils/staking-miner/src/prelude.rs index 45553d7a3441..db029de881c9 100644 --- a/utils/staking-miner/src/prelude.rs +++ b/utils/staking-miner/src/prelude.rs @@ -26,8 +26,8 @@ pub type AccountId = core_primitives::AccountId; pub type BlockNumber = core_primitives::BlockNumber; /// The balance type. pub type Balance = core_primitives::Balance; -/// The index of an account. -pub type Index = core_primitives::AccountIndex; +/// Index of a transaction in the chain. +pub type Nonce = core_primitives::Nonce; /// The hash type. We re-export it here, but we can easily get it from block as well. pub type Hash = core_primitives::Hash; /// The header type. We re-export it here, but we can easily get it from block as well. diff --git a/utils/staking-miner/src/signer.rs b/utils/staking-miner/src/signer.rs index 88b68cbd8dcc..e6677ccd3a66 100644 --- a/utils/staking-miner/src/signer.rs +++ b/utils/staking-miner/src/signer.rs @@ -16,7 +16,7 @@ //! Wrappers around creating a signer account. -use crate::{prelude::*, rpc::SharedRpcClient, AccountId, Error, Index, Pair, LOG_TARGET}; +use crate::{prelude::*, rpc::SharedRpcClient, AccountId, Error, Nonce, Pair, LOG_TARGET}; use frame_system::AccountInfo; use sp_core::{crypto::Pair as _, storage::StorageKey}; @@ -39,8 +39,8 @@ pub(crate) async fn get_account_info + EPM: rpc: &SharedRpcClient, who: &T::AccountId, maybe_at: Option, -) -> Result>, Error> { - rpc.get_storage_and_decode::>( +) -> Result>, Error> { + rpc.get_storage_and_decode::>( &StorageKey(>::hashed_key_for(&who)), maybe_at, ) @@ -52,7 +52,7 @@ pub(crate) async fn get_account_info + EPM: pub(crate) async fn signer_uri_from_string< T: frame_system::Config< AccountId = AccountId, - Index = Index, + Nonce = Nonce, AccountData = pallet_balances::AccountData, Hash = Hash, > + EPM::Config, diff --git a/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs b/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs index a8b50215e315..d67e7dd77bf8 100644 --- a/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs +++ b/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs @@ -24,24 +24,17 @@ use frame_support::{ weights::Weight, }; use sp_core::H256; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, IdentityLookup}, -}; +use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; use xcm::latest::prelude::*; use xcm_builder::{AllowUnpaidExecutionFrom, MintLocation}; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; // For testing the pallet, we construct a mock runtime. frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, XcmBalancesBenchmark: xcm_balances_benchmark::{Pallet}, } @@ -58,14 +51,13 @@ impl frame_system::Config for Test { type BlockLength = (); type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type RuntimeCall = RuntimeCall; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); diff --git a/xcm/pallet-xcm-benchmarks/src/generic/mock.rs b/xcm/pallet-xcm-benchmarks/src/generic/mock.rs index 5c2ca5ca7088..1b244f316de9 100644 --- a/xcm/pallet-xcm-benchmarks/src/generic/mock.rs +++ b/xcm/pallet-xcm-benchmarks/src/generic/mock.rs @@ -24,10 +24,7 @@ use frame_support::{ weights::Weight, }; use sp_core::H256; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, IdentityLookup, TrailingZeroInput}, -}; +use sp_runtime::traits::{BlakeTwo256, IdentityLookup, TrailingZeroInput}; use xcm_builder::{ test_utils::{ Assets, TestAssetExchanger, TestAssetLocker, TestAssetTrap, TestSubscriptionService, @@ -37,16 +34,12 @@ use xcm_builder::{ }; use xcm_executor::traits::ConvertOrigin; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, XcmGenericBenchmarks: generic::{Pallet}, } ); @@ -63,14 +56,13 @@ impl frame_system::Config for Test { type BlockLength = (); type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type RuntimeCall = RuntimeCall; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); diff --git a/xcm/pallet-xcm/src/lib.rs b/xcm/pallet-xcm/src/lib.rs index c53c9119bbd2..1d975af47384 100644 --- a/xcm/pallet-xcm/src/lib.rs +++ b/xcm/pallet-xcm/src/lib.rs @@ -180,7 +180,7 @@ pub mod pallet { /// A lockable currency. // TODO: We should really use a trait which can handle multiple currencies. - type Currency: LockableCurrency; + type Currency: LockableCurrency>; /// The `MultiAsset` matcher for `Currency`. type CurrencyMatcher: MatchesFungible>; @@ -508,7 +508,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn query)] pub(super) type Queries = - StorageMap<_, Blake2_128Concat, QueryId, QueryStatus, OptionQuery>; + StorageMap<_, Blake2_128Concat, QueryId, QueryStatus>, OptionQuery>; /// The existing asset traps. /// @@ -633,19 +633,21 @@ pub mod pallet { pub(super) type XcmExecutionSuspended = StorageValue<_, bool, ValueQuery>; #[pallet::genesis_config] - pub struct GenesisConfig { + pub struct GenesisConfig { + #[serde(skip)] + pub _config: sp_std::marker::PhantomData, /// The default version to encode outgoing XCM messages with. pub safe_xcm_version: Option, } - impl Default for GenesisConfig { + impl Default for GenesisConfig { fn default() -> Self { - Self { safe_xcm_version: Some(XCM_VERSION) } + Self { safe_xcm_version: Some(XCM_VERSION), _config: Default::default() } } } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { SafeXcmVersion::::set(self.safe_xcm_version); } @@ -741,7 +743,7 @@ pub mod pallet { if on_chain_storage_version < 1 { let mut count = 0; - Queries::::translate::, _>(|_key, value| { + Queries::::translate::>, _>(|_key, value| { count += 1; Some(value.into()) }); @@ -1128,14 +1130,14 @@ const MAX_ASSETS_FOR_TRANSFER: usize = 2; impl QueryHandler for Pallet { type QueryId = u64; - type BlockNumber = T::BlockNumber; + type BlockNumber = BlockNumberFor; type Error = XcmError; type UniversalLocation = T::UniversalLocation; /// Attempt to create a new query ID and register it as a query that is yet to respond. fn new_query( responder: impl Into, - timeout: T::BlockNumber, + timeout: BlockNumberFor, match_querier: impl Into, ) -> Self::QueryId { Self::do_new_query(responder, None, timeout, match_querier).into() @@ -1538,7 +1540,7 @@ impl Pallet { fn do_new_query( responder: impl Into, maybe_notify: Option<(u8, u8)>, - timeout: T::BlockNumber, + timeout: BlockNumberFor, match_querier: impl Into, ) -> u64 { QueryCounter::::mutate(|q| { @@ -1583,7 +1585,7 @@ impl Pallet { message: &mut Xcm<()>, responder: impl Into, notify: impl Into<::RuntimeCall>, - timeout: T::BlockNumber, + timeout: BlockNumberFor, ) -> Result<(), XcmError> { let responder = responder.into(); let destination = T::UniversalLocation::get() @@ -1603,7 +1605,7 @@ impl Pallet { pub fn new_notify_query( responder: impl Into, notify: impl Into<::RuntimeCall>, - timeout: T::BlockNumber, + timeout: BlockNumberFor, match_querier: impl Into, ) -> u64 { let notify = notify.into().using_encoded(|mut bytes| Decode::decode(&mut bytes)).expect( diff --git a/xcm/pallet-xcm/src/mock.rs b/xcm/pallet-xcm/src/mock.rs index 2d3cc385c230..b56b1af82def 100644 --- a/xcm/pallet-xcm/src/mock.rs +++ b/xcm/pallet-xcm/src/mock.rs @@ -24,7 +24,7 @@ use frame_system::EnsureRoot; use polkadot_parachain::primitives::Id as ParaId; use polkadot_runtime_parachains::origin; use sp_core::H256; -use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; +use sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage}; pub use sp_std::{cell::RefCell, fmt::Debug, marker::PhantomData}; use xcm::prelude::*; use xcm_builder::{ @@ -40,7 +40,6 @@ use crate::{self as pallet_xcm, TestWeightInfo}; pub type AccountId = AccountId32; pub type Balance = u128; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; #[frame_support::pallet] @@ -132,15 +131,12 @@ pub mod pallet_test_notifier { } construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Storage, Config, Event}, + System: frame_system::{Pallet, Call, Storage, Config, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, ParasOrigin: origin::{Pallet, Origin}, - XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config}, + XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config}, TestNotifier: pallet_test_notifier::{Pallet, Call, Event}, } ); @@ -204,13 +200,12 @@ parameter_types! { impl frame_system::Config for Test { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type BlockWeights = (); @@ -384,17 +379,15 @@ pub(crate) fn buy_limited_execution( pub(crate) fn new_test_ext_with_balances( balances: Vec<(AccountId, Balance)>, ) -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances } .assimilate_storage(&mut t) .unwrap(); - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, - &mut t, - ) - .unwrap(); + pallet_xcm::GenesisConfig:: { safe_xcm_version: Some(2), ..Default::default() } + .assimilate_storage(&mut t) + .unwrap(); let mut ext = sp_io::TestExternalities::new(t); ext.execute_with(|| System::set_block_number(1)); diff --git a/xcm/xcm-builder/tests/mock/mod.rs b/xcm/xcm-builder/tests/mock/mod.rs index 6c2c8f222add..f799be7e4013 100644 --- a/xcm/xcm-builder/tests/mock/mod.rs +++ b/xcm/xcm-builder/tests/mock/mod.rs @@ -22,7 +22,7 @@ use frame_support::{ use frame_system::EnsureRoot; use parity_scale_codec::Encode; use primitive_types::H256; -use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; +use sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage}; use sp_std::cell::RefCell; use polkadot_parachain::primitives::Id as ParaId; @@ -77,13 +77,12 @@ parameter_types! { impl frame_system::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type BlockWeights = (); @@ -244,16 +243,12 @@ impl pallet_xcm::Config for Runtime { impl origin::Config for Runtime {} -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { - System: frame_system::{Pallet, Call, Storage, Config, Event}, + System: frame_system::{Pallet, Call, Storage, Config, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, ParasOrigin: origin::{Pallet, Origin}, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin}, @@ -261,7 +256,7 @@ construct_runtime!( ); pub fn kusama_like_with_balances(balances: Vec<(AccountId, Balance)>) -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances } .assimilate_storage(&mut t) diff --git a/xcm/xcm-executor/integration-tests/src/lib.rs b/xcm/xcm-executor/integration-tests/src/lib.rs index 95138250cca9..111833e67cfb 100644 --- a/xcm/xcm-executor/integration-tests/src/lib.rs +++ b/xcm/xcm-executor/integration-tests/src/lib.rs @@ -19,8 +19,8 @@ use frame_support::{codec::Encode, dispatch::GetDispatchInfo, weights::Weight}; use polkadot_test_client::{ - BlockBuilderExt, ClientBlockImportExt, DefaultTestClientBuilderExt, ExecutionStrategy, - InitPolkadotBlockBuilder, TestClientBuilder, TestClientBuilderExt, + BlockBuilderExt, ClientBlockImportExt, DefaultTestClientBuilderExt, InitPolkadotBlockBuilder, + TestClientBuilder, TestClientBuilderExt, }; use polkadot_test_runtime::{pallet_test_notifier, xcm_config::XcmConfig}; use polkadot_test_service::construct_extrinsic; @@ -32,9 +32,7 @@ use xcm_executor::traits::WeightBounds; #[test] fn basic_buy_fees_message_executes() { sp_tracing::try_init_simple(); - let mut client = TestClientBuilder::new() - .set_execution_strategy(ExecutionStrategy::AlwaysWasm) - .build(); + let mut client = TestClientBuilder::new().build(); let msg = Xcm(vec![ WithdrawAsset((Parent, 100).into()), @@ -75,9 +73,7 @@ fn basic_buy_fees_message_executes() { #[test] fn transact_recursion_limit_works() { sp_tracing::try_init_simple(); - let mut client = TestClientBuilder::new() - .set_execution_strategy(ExecutionStrategy::AlwaysWasm) - .build(); + let mut client = TestClientBuilder::new().build(); let mut msg = Xcm(vec![ClearOrigin]); let max_weight = ::Weigher::weight(&mut msg).unwrap(); @@ -132,9 +128,7 @@ fn query_response_fires() { use polkadot_test_runtime::RuntimeEvent::TestNotifier; sp_tracing::try_init_simple(); - let mut client = TestClientBuilder::new() - .set_execution_strategy(ExecutionStrategy::AlwaysWasm) - .build(); + let mut client = TestClientBuilder::new().build(); let mut block_builder = client.init_polkadot_block_builder(); @@ -216,9 +210,7 @@ fn query_response_elicits_handler() { use polkadot_test_runtime::RuntimeEvent::TestNotifier; sp_tracing::try_init_simple(); - let mut client = TestClientBuilder::new() - .set_execution_strategy(ExecutionStrategy::AlwaysWasm) - .build(); + let mut client = TestClientBuilder::new().build(); let mut block_builder = client.init_polkadot_block_builder(); diff --git a/xcm/xcm-simulator/example/src/lib.rs b/xcm/xcm-simulator/example/src/lib.rs index 704d24c3fc71..1f6956485a84 100644 --- a/xcm/xcm-simulator/example/src/lib.rs +++ b/xcm/xcm-simulator/example/src/lib.rs @@ -18,6 +18,7 @@ mod parachain; mod relay_chain; use frame_support::sp_tracing; +use sp_runtime::BuildStorage; use xcm::prelude::*; use xcm_executor::traits::ConvertLocation; use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; @@ -93,7 +94,7 @@ pub fn parent_account_account_id(who: sp_runtime::AccountId32) -> parachain::Acc pub fn para_ext(para_id: u32) -> sp_io::TestExternalities { use parachain::{MsgQueue, Runtime, System}; - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], @@ -113,7 +114,7 @@ pub fn para_ext(para_id: u32) -> sp_io::TestExternalities { pub fn relay_ext() -> sp_io::TestExternalities { use relay_chain::{Runtime, RuntimeOrigin, System, Uniques}; - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![ diff --git a/xcm/xcm-simulator/example/src/parachain.rs b/xcm/xcm-simulator/example/src/parachain.rs index 875904ddecd9..9c4cbe8fcb2d 100644 --- a/xcm/xcm-simulator/example/src/parachain.rs +++ b/xcm/xcm-simulator/example/src/parachain.rs @@ -27,7 +27,6 @@ use frame_support::{ use frame_system::EnsureRoot; use sp_core::{ConstU32, H256}; use sp_runtime::{ - testing::Header, traits::{Get, Hash, IdentityLookup}, AccountId32, }; @@ -67,13 +66,12 @@ parameter_types! { impl frame_system::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type BlockWeights = (); @@ -449,16 +447,12 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; } -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { - System: frame_system::{Pallet, Call, Storage, Config, Event}, + System: frame_system::{Pallet, Call, Storage, Config, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, MsgQueue: mock_msg_queue::{Pallet, Storage, Event}, PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin}, diff --git a/xcm/xcm-simulator/example/src/relay_chain.rs b/xcm/xcm-simulator/example/src/relay_chain.rs index b82e2c9cc306..6f0e92dc91b9 100644 --- a/xcm/xcm-simulator/example/src/relay_chain.rs +++ b/xcm/xcm-simulator/example/src/relay_chain.rs @@ -24,7 +24,7 @@ use frame_support::{ use frame_system::EnsureRoot; use sp_core::{ConstU32, H256}; -use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; +use sp_runtime::{traits::IdentityLookup, AccountId32}; use polkadot_parachain::primitives::Id as ParaId; use polkadot_runtime_parachains::{ @@ -52,13 +52,12 @@ parameter_types! { impl frame_system::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type BlockWeights = (); @@ -239,7 +238,6 @@ parameter_types! { impl origin::Config for Runtime {} -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; parameter_types! { @@ -284,12 +282,9 @@ impl pallet_message_queue::Config for Runtime { } construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { - System: frame_system::{Pallet, Call, Storage, Config, Event}, + System: frame_system::{Pallet, Call, Storage, Config, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, ParasOrigin: origin::{Pallet, Origin}, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin}, diff --git a/xcm/xcm-simulator/fuzzer/src/fuzz.rs b/xcm/xcm-simulator/fuzzer/src/fuzz.rs index b23386d79120..441b9f4d2861 100644 --- a/xcm/xcm-simulator/fuzzer/src/fuzz.rs +++ b/xcm/xcm-simulator/fuzzer/src/fuzz.rs @@ -20,7 +20,7 @@ mod relay_chain; use codec::DecodeLimit; use polkadot_core_primitives::AccountId; use polkadot_parachain::primitives::Id as ParaId; -use sp_runtime::traits::AccountIdConversion; +use sp_runtime::{traits::AccountIdConversion, BuildStorage}; use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; use frame_support::assert_ok; @@ -111,7 +111,7 @@ pub fn para_account_id(id: u32) -> relay_chain::AccountId { pub fn para_ext(para_id: u32) -> sp_io::TestExternalities { use parachain::{MsgQueue, Runtime, System}; - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: (0..6).map(|i| ([i; 32].into(), INITIAL_BALANCE)).collect(), @@ -130,7 +130,7 @@ pub fn para_ext(para_id: u32) -> sp_io::TestExternalities { pub fn relay_ext() -> sp_io::TestExternalities { use relay_chain::{Runtime, System}; - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); let mut balances: Vec<(AccountId, u128)> = vec![]; balances.append(&mut (1..=3).map(|i| (para_account_id(i), INITIAL_BALANCE)).collect()); diff --git a/xcm/xcm-simulator/fuzzer/src/parachain.rs b/xcm/xcm-simulator/fuzzer/src/parachain.rs index 26438f02f45f..26379ed8dc8e 100644 --- a/xcm/xcm-simulator/fuzzer/src/parachain.rs +++ b/xcm/xcm-simulator/fuzzer/src/parachain.rs @@ -26,7 +26,6 @@ use frame_support::{ use frame_system::EnsureRoot; use sp_core::{ConstU32, H256}; use sp_runtime::{ - testing::Header, traits::{Hash, IdentityLookup}, AccountId32, }; @@ -56,13 +55,12 @@ parameter_types! { impl frame_system::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type BlockWeights = (); @@ -347,16 +345,12 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; } -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { - System: frame_system::{Pallet, Call, Storage, Config, Event}, + System: frame_system::{Pallet, Call, Storage, Config, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, MsgQueue: mock_msg_queue::{Pallet, Storage, Event}, PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin}, diff --git a/xcm/xcm-simulator/fuzzer/src/relay_chain.rs b/xcm/xcm-simulator/fuzzer/src/relay_chain.rs index ef1339097f5a..32f3b8aa83fb 100644 --- a/xcm/xcm-simulator/fuzzer/src/relay_chain.rs +++ b/xcm/xcm-simulator/fuzzer/src/relay_chain.rs @@ -24,7 +24,7 @@ use frame_support::{ use frame_system::EnsureRoot; use sp_core::{ConstU32, H256}; -use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; +use sp_runtime::{traits::IdentityLookup, AccountId32}; use polkadot_parachain::primitives::Id as ParaId; use polkadot_runtime_parachains::{ @@ -51,13 +51,12 @@ parameter_types! { impl frame_system::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type BlockWeights = (); @@ -203,7 +202,6 @@ parameter_types! { impl origin::Config for Runtime {} -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; parameter_types! { @@ -252,12 +250,9 @@ impl pallet_message_queue::Config for Runtime { } construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { - System: frame_system::{Pallet, Call, Storage, Config, Event}, + System: frame_system::{Pallet, Call, Storage, Config, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, ParasOrigin: origin::{Pallet, Origin}, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin},