diff --git a/Cargo.lock b/Cargo.lock index 9ccadef955fb..765c025ff027 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -42,7 +42,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cipher", "cpufeatures", "opaque-debug 0.3.0", @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.51" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" [[package]] name = "approx" @@ -130,15 +130,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] - [[package]] name = "arrayvec" version = "0.5.2" @@ -273,7 +264,7 @@ checksum = "83137067e3a2a6a06d67168e49e68a0957d215410473a740cea95a2425c0b7c6" dependencies = [ "async-io", "blocking", - "cfg-if 1.0.0", + "cfg-if", "event-listener", "futures-lite", "libc", @@ -386,7 +377,7 @@ checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object 0.27.1", @@ -435,7 +426,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "async-trait", @@ -472,7 +463,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "beefy-gadget", "beefy-primitives", @@ -492,7 +483,7 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "beefy-primitives", "sp-api", @@ -502,7 +493,7 @@ dependencies = [ [[package]] name = "beefy-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "scale-info", @@ -571,16 +562,6 @@ dependencies = [ "digest 0.10.3", ] -[[package]] -name = "blake2-rfc" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", -] - [[package]] name = "blake2b_simd" version = "1.0.0" @@ -612,7 +593,7 @@ dependencies = [ "arrayref", "arrayvec 0.7.2", "cc", - "cfg-if 1.0.0", + "cfg-if", "constant_time_eq", "digest 0.10.3", ] @@ -785,9 +766,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] @@ -810,12 +791,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -830,11 +805,11 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chacha20" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b72a433d0cf2aef113ba70f62634c56fddb0f244e6377185c56a7cadbd8f91" +checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cipher", "cpufeatures", "zeroize", @@ -842,9 +817,9 @@ dependencies = [ [[package]] name = "chacha20poly1305" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b84ed6d1d5f7aa9bdde921a5090e0ca4d934d250ea3b402a5fab3a994e28a2a" +checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ "aead", "chacha20", @@ -890,11 +865,11 @@ dependencies = [ [[package]] name = "ckb-merkle-mountain-range" -version = "0.3.2" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f061f97d64fd1822664bdfb722f7ae5469a97b77567390f7442be5b5dc82a5b" +checksum = "56ccb671c5921be8a84686e6212ca184cb1d7c51cadcdbfcbd1cc3f042f5dfb8" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", ] [[package]] @@ -957,6 +932,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + [[package]] name = "color-eyre" version = "0.6.1" @@ -992,9 +977,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "722e23542a15cea1f65d4a1419c4cfd7a26706c70871a13a04238ca3f40f1661" [[package]] name = "constant_time_eq" @@ -1039,7 +1024,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "931ab2a3e6330a07900b8e7ca4e106cdcbb93f2b9a52df55e54ee53d8305b55d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1155,7 +1140,7 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1164,7 +1149,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -1174,7 +1159,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] @@ -1185,7 +1170,7 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", "lazy_static", "memoffset", @@ -1198,7 +1183,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -1208,7 +1193,7 @@ version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ff1f980957787286a554052d03c7aee98d99cc32e09f6d45f0a814133c87978" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -1220,9 +1205,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.4", "rand_core 0.6.3", @@ -1318,6 +1303,50 @@ dependencies = [ "zeroize", ] +[[package]] +name = "cxx" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "data-encoding" version = "2.3.2" @@ -1355,11 +1384,12 @@ dependencies = [ [[package]] name = "der" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f" dependencies = [ "const-oid", + "zeroize", ] [[package]] @@ -1442,7 +1472,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -1546,9 +1576,9 @@ checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf" [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -1581,15 +1611,15 @@ dependencies = [ [[package]] name = "ed25519-zebra" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403ef3e961ab98f0ba902771d29f842058578bb1ce7e3c59dad5a6a93e784c69" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ "curve25519-dalek 3.2.0", + "hashbrown", "hex", "rand_core 0.6.3", "sha2 0.9.8", - "thiserror", "zeroize", ] @@ -1601,13 +1631,14 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.3", "ff", "generic-array 0.14.4", "group", @@ -1623,7 +1654,7 @@ version = "0.8.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1848,7 +1879,7 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc04871e5ae3aa2952d552dae6b291b3099723bf779a8054281c1366a54613ef" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "log", "serde", @@ -1860,9 +1891,9 @@ dependencies = [ [[package]] name = "ff" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2958d04124b9f27f175eaeb9a9f383d026098aa837eadd8ba22c11f13a05b9e" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.3", "subtle", @@ -1884,7 +1915,7 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "windows-sys 0.36.1", @@ -1942,7 +1973,7 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crc32fast", "libc", "libz-sys", @@ -1982,7 +2013,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", ] @@ -2006,7 +2037,7 @@ checksum = "85dcb89d2b10c5f6133de2efd8c11959ce9dbb46a2f7a4cab208c4eeda6ce1ab" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -2029,7 +2060,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "Inflector", "array-bytes", @@ -2070,6 +2101,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-state-machine", + "sp-std", "sp-storage", "sp-trie", "tempfile", @@ -2080,7 +2112,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2091,7 +2123,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2107,7 +2139,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -2127,7 +2159,7 @@ version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "parity-scale-codec", "scale-info", "serde", @@ -2136,7 +2168,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "bitflags", "frame-metadata", @@ -2168,7 +2200,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "Inflector", "cfg-expr", @@ -2182,7 +2214,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2194,7 +2226,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "proc-macro2", "quote", @@ -2204,7 +2236,7 @@ dependencies = [ [[package]] name = "frame-support-test" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-support-test-pallet", @@ -2227,7 +2259,7 @@ dependencies = [ [[package]] name = "frame-support-test-pallet" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -2238,7 +2270,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "log", @@ -2256,7 +2288,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -2271,7 +2303,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "sp-api", @@ -2280,7 +2312,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "parity-scale-codec", @@ -2451,7 +2483,7 @@ dependencies = [ [[package]] name = "generate-bags" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "chrono", "frame-election-provider-support", @@ -2498,7 +2530,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", @@ -2511,7 +2543,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.10.0+wasi-snapshot-preview1", ] @@ -2584,9 +2616,9 @@ dependencies = [ [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", "rand_core 0.6.3", @@ -2697,6 +2729,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.3", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -2716,7 +2757,7 @@ checksum = "848e9c511092e0daa0a35a63e8e6e475a3e8f870741448b9f6028d69b142f18e" dependencies = [ "arbitrary", "lazy_static", - "memmap2 0.5.0", + "memmap2", "rustc_version", ] @@ -2739,7 +2780,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", - "itoa 1.0.1", + "itoa", ] [[package]] @@ -2795,7 +2836,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.1", + "itoa", "pin-project-lite 0.2.7", "socket2", "tokio", @@ -2923,7 +2964,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -2982,15 +3023,9 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "itoa" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "jobserver" @@ -3156,14 +3191,14 @@ dependencies = [ [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.2", ] [[package]] @@ -3225,7 +3260,6 @@ dependencies = [ "pallet-session-benchmarking", "pallet-society", "pallet-staking", - "pallet-staking-reward-fn", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", @@ -3379,7 +3413,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] @@ -3483,7 +3517,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "lru 0.8.0", + "lru", "prost", "prost-build", "prost-codec", @@ -3797,6 +3831,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] + [[package]] name = "linked-hash-map" version = "0.5.4" @@ -3843,25 +3886,16 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "serde", "value-bag", ] [[package]] name = "lru" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" -dependencies = [ - "hashbrown", -] - -[[package]] -name = "lru" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936d98d2ddd79c18641c6709e7bb09981449694e402d1a0f0f657ea8d61f4a51" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ "hashbrown", ] @@ -3877,9 +3911,9 @@ dependencies = [ [[package]] name = "lz4" -version = "1.23.2" +version = "1.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac20ed6991e01bf6a2e68cc73df2b389707403662a8ba89f68511fb340f724c" +checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1" dependencies = [ "libc", "lz4-sys", @@ -3887,9 +3921,9 @@ dependencies = [ [[package]] name = "lz4-sys" -version = "1.9.2" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca79aa95d8b3226213ad454d328369853be3a1382d89532a854f4d69640acae" +checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" dependencies = [ "cc", "libc", @@ -3964,15 +3998,6 @@ dependencies = [ "rustix", ] -[[package]] -name = "memmap2" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723e3ebdcdc5c023db1df315364573789f8857c11b631a2fdfad7c00f5c046b4" -dependencies = [ - "libc", -] - [[package]] name = "memmap2" version = "0.5.0" @@ -4008,7 +4033,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce95ae042940bad7e312857b929ee3d11b8f799a80cb7b9c7ec5125516906395" dependencies = [ - "lru 0.8.0", + "lru", ] [[package]] @@ -4091,7 +4116,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2be9a9090bc1cac2930688fa9478092a64c6a92ddc6ae0692d46b37d9cab709" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "downcast", "fragile", "lazy_static", @@ -4106,7 +4131,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86d702a0530a0141cf4ed147cf5ec7be6f2c187d4e37fcbefc39cf34116bfe8f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "proc-macro2", "quote", "syn", @@ -4202,7 +4227,7 @@ dependencies = [ "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.0", + "num-rational", "num-traits", "rand 0.8.5", "rand_distr", @@ -4328,7 +4353,7 @@ checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" dependencies = [ "bitflags", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", ] @@ -4340,17 +4365,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", ] -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - [[package]] name = "nohash-hasher" version = "0.2.0" @@ -4383,17 +4402,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-bigint" version = "0.4.3" @@ -4416,12 +4424,12 @@ dependencies = [ [[package]] name = "num-format" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" +checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" dependencies = [ - "arrayvec 0.4.12", - "itoa 0.4.8", + "arrayvec 0.7.2", + "itoa", ] [[package]] @@ -4436,24 +4444,12 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint 0.2.6", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", - "num-bigint 0.4.3", + "num-bigint", "num-integer", "num-traits", ] @@ -4524,7 +4520,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -4615,7 +4611,7 @@ checksum = "20448fd678ec04e6ea15bbe0476874af65e98a01515d667aa49f1434dc44ebf4" [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4629,7 +4625,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -4645,7 +4641,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -4660,7 +4656,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4684,7 +4680,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4704,7 +4700,7 @@ dependencies = [ [[package]] name = "pallet-bags-list-remote-tests" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-election-provider-support", "frame-support", @@ -4723,7 +4719,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4738,7 +4734,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "beefy-primitives", "frame-support", @@ -4754,7 +4750,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "beefy-merkle-tree", @@ -4777,7 +4773,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4795,7 +4791,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4814,7 +4810,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4831,7 +4827,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "assert_matches", "frame-benchmarking", @@ -4848,7 +4844,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4866,7 +4862,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4890,7 +4886,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4903,7 +4899,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4921,16 +4917,13 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", "frame-support", "frame-system", "log", - "pallet-balances", - "pallet-staking", - "pallet-timestamp", "parity-scale-codec", "scale-info", "sp-io", @@ -4942,7 +4935,7 @@ dependencies = [ [[package]] name = "pallet-gilt" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4957,7 +4950,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4980,7 +4973,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4996,7 +4989,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5016,7 +5009,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5033,7 +5026,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5050,7 +5043,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "ckb-merkle-mountain-range", "frame-benchmarking", @@ -5068,8 +5061,9 @@ dependencies = [ [[package]] name = "pallet-mmr-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ + "anyhow", "jsonrpsee", "parity-scale-codec", "serde", @@ -5083,7 +5077,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5099,7 +5093,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -5116,7 +5110,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5136,7 +5130,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "sp-api", @@ -5146,7 +5140,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -5163,7 +5157,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5186,7 +5180,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5203,7 +5197,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5218,7 +5212,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5236,7 +5230,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5251,7 +5245,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "assert_matches", "frame-benchmarking", @@ -5269,7 +5263,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5285,7 +5279,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -5306,7 +5300,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5322,7 +5316,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -5336,7 +5330,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5359,7 +5353,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5370,7 +5364,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "log", "sp-arithmetic", @@ -5396,7 +5390,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -5410,7 +5404,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5428,7 +5422,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5447,7 +5441,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-support", "frame-system", @@ -5463,7 +5457,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5473,23 +5467,25 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", + "sp-weights", ] [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", "sp-api", "sp-runtime", + "sp-weights", ] [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5506,7 +5502,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5522,7 +5518,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5537,7 +5533,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5598,19 +5594,19 @@ dependencies = [ [[package]] name = "parity-db" -version = "0.3.16" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb474d0ed0836e185cb998a6b140ed1073d1fbf27d690ecf9ede8030289382c" +checksum = "3a7511a0bec4a336b5929999d02b560d2439c993cccf98c26481484e811adc43" dependencies = [ - "blake2-rfc", + "blake2", "crc32fast", "fs2", "hex", "libc", "log", "lz4", - "memmap2 0.2.3", - "parking_lot 0.11.2", + "memmap2", + "parking_lot 0.12.1", "rand 0.8.5", "snap", ] @@ -5654,7 +5650,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "hashbrown", "impl-trait-for-tuples", "parity-util-mem-derive", @@ -5677,15 +5673,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "parity-wasm" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" -dependencies = [ - "byteorder", -] - [[package]] name = "parity-wasm" version = "0.45.0" @@ -5725,7 +5712,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall", @@ -5739,7 +5726,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -5875,13 +5862,12 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs8" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ "der", "spki", - "zeroize", ] [[package]] @@ -5969,7 +5955,7 @@ dependencies = [ "fatality", "futures", "futures-timer", - "lru 0.8.0", + "lru", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -5999,7 +5985,7 @@ dependencies = [ "futures", "futures-timer", "log", - "lru 0.8.0", + "lru", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -6139,7 +6125,7 @@ dependencies = [ "futures-timer", "indexmap", "lazy_static", - "lru 0.8.0", + "lru", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -6259,7 +6245,7 @@ dependencies = [ "futures-timer", "kvdb", "kvdb-memorydb", - "lru 0.8.0", + "lru", "merlin", "parity-scale-codec", "parking_lot 0.12.1", @@ -6363,6 +6349,7 @@ dependencies = [ "assert_matches", "async-trait", "futures", + "futures-timer", "parity-scale-codec", "polkadot-node-core-pvf", "polkadot-node-primitives", @@ -6428,7 +6415,7 @@ dependencies = [ "futures-timer", "kvdb", "kvdb-memorydb", - "lru 0.8.0", + "lru", "parity-scale-codec", "polkadot-node-primitives", "polkadot-node-subsystem", @@ -6712,10 +6699,11 @@ dependencies = [ "futures", "itertools", "kvdb", + "kvdb-memorydb", "kvdb-shared-tests", "lazy_static", "log", - "lru 0.8.0", + "lru", "parity-db", "parity-scale-codec", "parity-util-mem", @@ -6749,7 +6737,7 @@ dependencies = [ "femme", "futures", "futures-timer", - "lru 0.8.0", + "lru", "orchestra", "parity-util-mem", "parking_lot 0.12.1", @@ -6801,7 +6789,6 @@ name = "polkadot-primitives" version = "0.9.31" dependencies = [ "bitvec", - "frame-system", "hex-literal", "parity-scale-codec", "parity-util-mem", @@ -6821,8 +6808,6 @@ dependencies = [ "sp-runtime", "sp-staking", "sp-std", - "sp-trie", - "sp-version", ] [[package]] @@ -6987,6 +6972,7 @@ dependencies = [ "pallet-election-provider-multi-phase", "pallet-session", "pallet-staking", + "pallet-staking-reward-fn", "pallet-timestamp", "pallet-transaction-payment", "pallet-treasury", @@ -7070,6 +7056,7 @@ dependencies = [ "sc-keystore", "scale-info", "serde", + "serde_json", "sp-api", "sp-application-crypto", "sp-core", @@ -7106,7 +7093,7 @@ dependencies = [ "kvdb", "kvdb-rocksdb", "log", - "lru 0.8.0", + "lru", "pallet-babe", "pallet-im-online", "pallet-staking", @@ -7433,7 +7420,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "wepoll-ffi", @@ -7457,7 +7444,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "opaque-debug 0.3.0", "universal-hash", @@ -7470,7 +7457,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55f35f865aa964be21fcde114cbd1cfbd9bf8a471460ed965b0f84f96c711401" dependencies = [ "backtrace", - "cfg-if 1.0.0", + "cfg-if", "findshlibs", "lazy_static", "libc", @@ -7609,7 +7596,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7f64969ffd5dd8f39bd57a68ac53c163a095ed9d0fb707146da1b27025a3504" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fnv", "lazy_static", "memchr", @@ -7624,7 +7611,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c" dependencies = [ "dtoa", - "itoa 1.0.1", + "itoa", "parking_lot 0.12.1", "prometheus-client-derive-text-encode", ] @@ -7974,9 +7961,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.5" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -7994,9 +7981,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "remote-ext-tests-bags-list" @@ -8020,7 +8007,7 @@ dependencies = [ [[package]] name = "remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "env_logger 0.9.0", "log", @@ -8092,12 +8079,12 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac 0.11.0", + "hmac 0.12.1", "zeroize", ] @@ -8360,7 +8347,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "log", "sp-core", @@ -8371,7 +8358,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "futures", @@ -8398,7 +8385,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "futures-timer", @@ -8421,7 +8408,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -8437,10 +8424,10 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "impl-trait-for-tuples", - "memmap2 0.5.0", + "memmap2", "parity-scale-codec", "sc-chain-spec-derive", "sc-network-common", @@ -8454,7 +8441,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -8465,7 +8452,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "chrono", @@ -8505,7 +8492,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "fnv", "futures", @@ -8533,7 +8520,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "hash-db", "kvdb", @@ -8558,7 +8545,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "futures", @@ -8582,19 +8569,18 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "fork-tree", "futures", "log", "merlin", - "num-bigint 0.2.6", - "num-rational 0.2.4", + "num-bigint", + "num-rational", "num-traits", "parity-scale-codec", "parking_lot 0.12.1", - "rand 0.7.3", "sc-client-api", "sc-consensus", "sc-consensus-epochs", @@ -8624,7 +8610,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "jsonrpsee", @@ -8646,7 +8632,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "fork-tree", "parity-scale-codec", @@ -8659,7 +8645,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "futures", @@ -8683,10 +8669,10 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "lazy_static", - "lru 0.7.8", + "lru", "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", @@ -8710,7 +8696,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "environmental", "parity-scale-codec", @@ -8726,7 +8712,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "log", "parity-scale-codec", @@ -8741,14 +8727,14 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "once_cell", "parity-scale-codec", - "parity-wasm 0.45.0", + "parity-wasm", "rustix", "sc-allocator", "sc-executor-common", @@ -8761,7 +8747,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "ahash", "array-bytes", @@ -8802,7 +8788,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "finality-grandpa", "futures", @@ -8823,7 +8809,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "ansi_term", "futures", @@ -8840,7 +8826,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "async-trait", @@ -8855,7 +8841,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "async-trait", @@ -8873,7 +8859,7 @@ dependencies = [ "linked-hash-map", "linked_hash_set", "log", - "lru 0.7.8", + "lru", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", @@ -8902,7 +8888,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "cid", "futures", @@ -8922,7 +8908,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "bitflags", @@ -8948,14 +8934,14 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "ahash", "futures", "futures-timer", "libp2p", "log", - "lru 0.7.8", + "lru", "sc-network-common", "sc-peerset", "sp-runtime", @@ -8966,7 +8952,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "futures", @@ -8987,14 +8973,14 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "fork-tree", "futures", "libp2p", "log", - "lru 0.7.8", + "lru", "mockall", "parity-scale-codec", "prost", @@ -9017,7 +9003,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "futures", @@ -9036,7 +9022,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "bytes", @@ -9066,7 +9052,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "libp2p", @@ -9079,7 +9065,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -9088,7 +9074,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "hash-db", @@ -9118,7 +9104,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "jsonrpsee", @@ -9141,7 +9127,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "jsonrpsee", @@ -9154,7 +9140,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "hex", @@ -9173,7 +9159,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "directories", @@ -9244,7 +9230,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "log", "parity-scale-codec", @@ -9258,7 +9244,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -9277,7 +9263,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "libc", @@ -9296,7 +9282,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "chrono", "futures", @@ -9314,7 +9300,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "ansi_term", "atty", @@ -9345,7 +9331,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9356,7 +9342,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "futures", @@ -9383,7 +9369,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "futures", @@ -9397,7 +9383,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "futures-timer", @@ -9414,7 +9400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c46be926081c9f4dd5dd9b6f1d3e3229f2360bc6502dd8836f84a93b7c75e99a" dependencies = [ "bitvec", - "cfg-if 1.0.0", + "cfg-if", "derive_more", "parity-scale-codec", "scale-info-derive", @@ -9467,6 +9453,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + [[package]] name = "sct" version = "0.7.0" @@ -9479,10 +9471,11 @@ dependencies = [ [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array 0.14.4", "pkcs8", @@ -9605,7 +9598,7 @@ version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" dependencies = [ - "itoa 1.0.1", + "itoa", "ryu", "serde", ] @@ -9626,7 +9619,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.1", + "itoa", "ryu", "serde", ] @@ -9650,7 +9643,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", @@ -9662,7 +9655,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.3", ] @@ -9686,7 +9679,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", @@ -9698,7 +9691,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.3", ] @@ -9761,11 +9754,11 @@ dependencies = [ [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.9.0", + "digest 0.10.3", "rand_core 0.6.3", ] @@ -9871,7 +9864,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "hash-db", "log", @@ -9889,7 +9882,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "blake2", "proc-macro-crate", @@ -9901,7 +9894,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "scale-info", @@ -9914,7 +9907,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "integer-sqrt", "num-traits", @@ -9929,7 +9922,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "scale-info", @@ -9942,7 +9935,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "parity-scale-codec", @@ -9954,7 +9947,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "sp-api", @@ -9966,11 +9959,11 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "log", - "lru 0.7.8", + "lru", "parity-scale-codec", "parking_lot 0.12.1", "sp-api", @@ -9984,7 +9977,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "futures", @@ -10003,7 +9996,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "merlin", @@ -10026,7 +10019,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "scale-info", @@ -10040,7 +10033,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "scale-info", @@ -10053,7 +10046,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "base58", @@ -10099,7 +10092,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "blake2", "byteorder", @@ -10113,7 +10106,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "proc-macro2", "quote", @@ -10124,7 +10117,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -10133,7 +10126,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "proc-macro2", "quote", @@ -10143,7 +10136,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "environmental", "parity-scale-codec", @@ -10154,7 +10147,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "finality-grandpa", "log", @@ -10172,7 +10165,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -10186,7 +10179,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "bytes", "futures", @@ -10212,7 +10205,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "lazy_static", "sp-core", @@ -10223,7 +10216,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "futures", @@ -10240,7 +10233,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "thiserror", "zstd", @@ -10249,7 +10242,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "log", "parity-scale-codec", @@ -10260,12 +10253,13 @@ dependencies = [ "sp-debug-derive", "sp-runtime", "sp-std", + "thiserror", ] [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "scale-info", @@ -10279,7 +10273,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "sp-api", "sp-core", @@ -10289,7 +10283,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "backtrace", "lazy_static", @@ -10299,7 +10293,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "rustc-hash", "serde", @@ -10309,7 +10303,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "either", "hash256-std-hasher", @@ -10332,7 +10326,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -10350,7 +10344,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "Inflector", "proc-macro-crate", @@ -10362,7 +10356,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "log", "parity-scale-codec", @@ -10376,7 +10370,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "scale-info", @@ -10390,7 +10384,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "scale-info", @@ -10401,7 +10395,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "hash-db", "log", @@ -10423,12 +10417,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10441,7 +10435,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "log", "sp-core", @@ -10454,7 +10448,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "futures-timer", @@ -10470,7 +10464,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "sp-std", @@ -10482,7 +10476,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "sp-api", "sp-runtime", @@ -10491,7 +10485,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "log", @@ -10507,13 +10501,13 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "ahash", "hash-db", "hashbrown", "lazy_static", - "lru 0.7.8", + "lru", "memory-db", "nohash-hasher", "parity-scale-codec", @@ -10530,11 +10524,11 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "impl-serde", "parity-scale-codec", - "parity-wasm 0.45.0", + "parity-wasm", "scale-info", "serde", "sp-core-hashing-proc-macro", @@ -10547,7 +10541,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -10558,7 +10552,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "impl-trait-for-tuples", "log", @@ -10571,7 +10565,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -10592,9 +10586,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spki" -version = "0.5.4" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", "der", @@ -10786,7 +10780,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "platforms", ] @@ -10794,7 +10788,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -10815,7 +10809,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures-util", "hyper", @@ -10828,7 +10822,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "async-trait", "jsonrpsee", @@ -10841,7 +10835,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "jsonrpsee", "log", @@ -10862,7 +10856,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "array-bytes", "async-trait", @@ -10888,7 +10882,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "futures", "substrate-test-utils-derive", @@ -10898,7 +10892,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10909,7 +10903,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "ansi_term", "build-helper", @@ -10920,7 +10914,7 @@ dependencies = [ "tempfile", "toml", "walkdir", - "wasm-gc-api", + "wasm-opt", ] [[package]] @@ -10945,7 +10939,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e92a52f07eed9afba3d6f883652cde7cd75fcf327dd44e84f210958379158737" dependencies = [ "debugid", - "memmap2 0.5.0", + "memmap2", "stable_deref_trait", "uuid", ] @@ -11023,7 +11017,7 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", @@ -11156,18 +11150,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", @@ -11421,7 +11415,7 @@ version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite 0.2.7", "tracing-attributes", "tracing-core", @@ -11571,7 +11565,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26" dependencies = [ "async-trait", - "cfg-if 1.0.0", + "cfg-if", "data-encoding", "enum-as-inner", "futures-channel", @@ -11594,7 +11588,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "futures-util", "ipconfig", "lazy_static", @@ -11616,7 +11610,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#f5ed51def33950ac24709eb11940790ca446421d" +source = "git+https://github.com/paritytech/substrate?branch=master#a6da808575fe403ab2bd7f6cd009896cdc6fd71a" dependencies = [ "clap", "frame-try-runtime", @@ -11687,7 +11681,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "digest 0.10.3", "rand 0.8.5", "static_assertions", @@ -11909,7 +11903,7 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "serde", "serde_json", "wasm-bindgen-macro", @@ -11936,7 +11930,7 @@ version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -11972,23 +11966,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" [[package]] -name = "wasm-gc-api" -version = "0.1.11" +name = "wasm-instrument" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c32691b6c7e6c14e7f8fd55361a9088b507aa49620fcd06c09b3a1082186b9" +checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" dependencies = [ - "log", - "parity-wasm 0.32.0", - "rustc-demangle", + "parity-wasm", ] [[package]] -name = "wasm-instrument" -version = "0.3.0" +name = "wasm-opt" +version = "0.110.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" +checksum = "b68e8037b4daf711393f4be2056246d12d975651b14d581520ad5d1f19219cec" dependencies = [ - "parity-wasm 0.45.0", + "anyhow", + "libc", + "strum", + "strum_macros", + "tempfile", + "thiserror", + "wasm-opt-cxx-sys", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-cxx-sys" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91adbad477e97bba3fbd21dd7bfb594e7ad5ceb9169ab1c93ab9cb0ada636b6f" +dependencies = [ + "anyhow", + "cxx", + "cxx-build", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-sys" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4fa5a322a4e6ac22fd141f498d56afbdbf9df5debeac32380d2dcaa3e06941" +dependencies = [ + "anyhow", + "cc", + "cxx", + "cxx-build", + "regex", ] [[package]] @@ -12012,7 +12036,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc13b3c219ca9aafeec59150d80d89851df02e0061bc357b4d66fc55a8d38787" dependencies = [ - "parity-wasm 0.45.0", + "parity-wasm", "wasmi-validation", "wasmi_core", ] @@ -12023,7 +12047,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ - "parity-wasm 0.45.0", + "parity-wasm", ] [[package]] @@ -12035,7 +12059,7 @@ dependencies = [ "downcast-rs", "libm", "memory_units", - "num-rational 0.4.0", + "num-rational", "num-traits", ] @@ -12056,7 +12080,7 @@ checksum = "8a10dc9784d8c3a33c970e3939180424955f08af2e7f20368ec02685a0e8f065" dependencies = [ "anyhow", "bincode", - "cfg-if 1.0.0", + "cfg-if", "indexmap", "libc", "log", @@ -12082,7 +12106,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee4dbdc6daf68528cad1275ac91e3f51848ce9824385facc94c759f529decdf8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -12154,7 +12178,7 @@ dependencies = [ "addr2line", "anyhow", "bincode", - "cfg-if 1.0.0", + "cfg-if", "cpp_demangle", "gimli", "log", @@ -12189,7 +12213,7 @@ checksum = "ae79e0515160bd5abee5df50a16c4eb8db9f71b530fc988ae1d9ce34dcb8dd01" dependencies = [ "anyhow", "cc", - "cfg-if 1.0.0", + "cfg-if", "indexmap", "libc", "log", @@ -12740,9 +12764,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.4.3" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" dependencies = [ "zeroize_derive", ] diff --git a/node/client/src/lib.rs b/node/client/src/lib.rs index a254973b99c2..d2c119ba04a8 100644 --- a/node/client/src/lib.rs +++ b/node/client/src/lib.rs @@ -327,13 +327,13 @@ impl UsageProvider for Client { impl sc_client_api::BlockBackend for Client { fn block_body( &self, - id: &BlockId, + hash: ::Hash, ) -> sp_blockchain::Result::Extrinsic>>> { with_client! { self, client, { - client.block_body(id) + client.block_body(hash) } } } @@ -358,12 +358,15 @@ impl sc_client_api::BlockBackend for Client { } } - fn justifications(&self, id: &BlockId) -> sp_blockchain::Result> { + fn justifications( + &self, + hash: ::Hash, + ) -> sp_blockchain::Result> { with_client! { self, client, { - client.justifications(id) + client.justifications(hash) } } } @@ -383,7 +386,7 @@ impl sc_client_api::BlockBackend for Client { fn indexed_transaction( &self, - id: &::Hash, + id: ::Hash, ) -> sp_blockchain::Result>> { with_client! { self, @@ -396,7 +399,7 @@ impl sc_client_api::BlockBackend for Client { fn block_indexed_body( &self, - id: &BlockId, + id: ::Hash, ) -> sp_blockchain::Result>>> { with_client! { self, @@ -421,7 +424,7 @@ impl sc_client_api::BlockBackend for Client { impl sc_client_api::StorageProvider for Client { fn storage( &self, - hash: &::Hash, + hash: ::Hash, key: &StorageKey, ) -> sp_blockchain::Result> { with_client! { @@ -435,7 +438,7 @@ impl sc_client_api::StorageProvider for Client { fn storage_keys( &self, - hash: &::Hash, + hash: ::Hash, key_prefix: &StorageKey, ) -> sp_blockchain::Result> { with_client! { @@ -449,7 +452,7 @@ impl sc_client_api::StorageProvider for Client { fn storage_hash( &self, - hash: &::Hash, + hash: ::Hash, key: &StorageKey, ) -> sp_blockchain::Result::Hash>> { with_client! { @@ -463,7 +466,7 @@ impl sc_client_api::StorageProvider for Client { fn storage_pairs( &self, - hash: &::Hash, + hash: ::Hash, key_prefix: &StorageKey, ) -> sp_blockchain::Result> { with_client! { @@ -477,7 +480,7 @@ impl sc_client_api::StorageProvider for Client { fn storage_keys_iter<'a>( &self, - hash: &::Hash, + hash: ::Hash, prefix: Option<&'a StorageKey>, start_key: Option<&StorageKey>, ) -> sp_blockchain::Result< @@ -494,7 +497,7 @@ impl sc_client_api::StorageProvider for Client { fn child_storage( &self, - hash: &::Hash, + hash: ::Hash, child_info: &ChildInfo, key: &StorageKey, ) -> sp_blockchain::Result> { @@ -509,7 +512,7 @@ impl sc_client_api::StorageProvider for Client { fn child_storage_keys( &self, - hash: &::Hash, + hash: ::Hash, child_info: &ChildInfo, key_prefix: &StorageKey, ) -> sp_blockchain::Result> { @@ -524,7 +527,7 @@ impl sc_client_api::StorageProvider for Client { fn child_storage_keys_iter<'a>( &self, - hash: &::Hash, + hash: ::Hash, child_info: ChildInfo, prefix: Option<&'a StorageKey>, start_key: Option<&StorageKey>, @@ -542,7 +545,7 @@ impl sc_client_api::StorageProvider for Client { fn child_storage_hash( &self, - hash: &::Hash, + hash: ::Hash, child_info: &ChildInfo, key: &StorageKey, ) -> sp_blockchain::Result::Hash>> { diff --git a/node/core/approval-voting/src/approval_db/v1/mod.rs b/node/core/approval-voting/src/approval_db/v1/mod.rs index 03b7aa68f134..858bcb8c36fe 100644 --- a/node/core/approval-voting/src/approval_db/v1/mod.rs +++ b/node/core/approval-voting/src/approval_db/v1/mod.rs @@ -90,41 +90,45 @@ impl Backend for DbBackend { match op { BackendWriteOp::WriteStoredBlockRange(stored_block_range) => { tx.put_vec( - self.config.col_data, + self.config.col_approval_data, &STORED_BLOCKS_KEY, stored_block_range.encode(), ); }, BackendWriteOp::DeleteStoredBlockRange => { - tx.delete(self.config.col_data, &STORED_BLOCKS_KEY); + tx.delete(self.config.col_approval_data, &STORED_BLOCKS_KEY); }, BackendWriteOp::WriteBlocksAtHeight(h, blocks) => { - tx.put_vec(self.config.col_data, &blocks_at_height_key(h), blocks.encode()); + tx.put_vec( + self.config.col_approval_data, + &blocks_at_height_key(h), + blocks.encode(), + ); }, BackendWriteOp::DeleteBlocksAtHeight(h) => { - tx.delete(self.config.col_data, &blocks_at_height_key(h)); + tx.delete(self.config.col_approval_data, &blocks_at_height_key(h)); }, BackendWriteOp::WriteBlockEntry(block_entry) => { let block_entry: BlockEntry = block_entry.into(); tx.put_vec( - self.config.col_data, + self.config.col_approval_data, &block_entry_key(&block_entry.block_hash), block_entry.encode(), ); }, BackendWriteOp::DeleteBlockEntry(hash) => { - tx.delete(self.config.col_data, &block_entry_key(&hash)); + tx.delete(self.config.col_approval_data, &block_entry_key(&hash)); }, BackendWriteOp::WriteCandidateEntry(candidate_entry) => { let candidate_entry: CandidateEntry = candidate_entry.into(); tx.put_vec( - self.config.col_data, + self.config.col_approval_data, &candidate_entry_key(&candidate_entry.candidate.hash()), candidate_entry.encode(), ); }, BackendWriteOp::DeleteCandidateEntry(candidate_hash) => { - tx.delete(self.config.col_data, &candidate_entry_key(&candidate_hash)); + tx.delete(self.config.col_approval_data, &candidate_entry_key(&candidate_hash)); }, } } @@ -149,7 +153,9 @@ pub type Bitfield = BitVec; #[derive(Debug, Clone, Copy)] pub struct Config { /// The column family in the database where data is stored. - pub col_data: u32, + pub col_approval_data: u32, + /// The column of the database where rolling session window data is stored. + pub col_session_data: u32, } /// Details pertaining to our assignment on a block. @@ -243,10 +249,10 @@ pub type Result = std::result::Result; pub(crate) fn load_decode( store: &dyn Database, - col_data: u32, + col_approval_data: u32, key: &[u8], ) -> Result> { - match store.get(col_data, key)? { + match store.get(col_approval_data, key)? { None => Ok(None), Some(raw) => D::decode(&mut &raw[..]).map(Some).map_err(Into::into), } @@ -303,7 +309,7 @@ pub fn load_stored_blocks( store: &dyn Database, config: &Config, ) -> SubsystemResult> { - load_decode(store, config.col_data, STORED_BLOCKS_KEY) + load_decode(store, config.col_approval_data, STORED_BLOCKS_KEY) .map_err(|e| SubsystemError::with_origin("approval-voting", e)) } @@ -313,7 +319,7 @@ pub fn load_blocks_at_height( config: &Config, block_number: &BlockNumber, ) -> SubsystemResult> { - load_decode(store, config.col_data, &blocks_at_height_key(*block_number)) + load_decode(store, config.col_approval_data, &blocks_at_height_key(*block_number)) .map(|x| x.unwrap_or_default()) .map_err(|e| SubsystemError::with_origin("approval-voting", e)) } @@ -324,7 +330,7 @@ pub fn load_block_entry( config: &Config, block_hash: &Hash, ) -> SubsystemResult> { - load_decode(store, config.col_data, &block_entry_key(block_hash)) + load_decode(store, config.col_approval_data, &block_entry_key(block_hash)) .map(|u: Option| u.map(|v| v.into())) .map_err(|e| SubsystemError::with_origin("approval-voting", e)) } @@ -335,7 +341,7 @@ pub fn load_candidate_entry( config: &Config, candidate_hash: &CandidateHash, ) -> SubsystemResult> { - load_decode(store, config.col_data, &candidate_entry_key(candidate_hash)) + load_decode(store, config.col_approval_data, &candidate_entry_key(candidate_hash)) .map(|u: Option| u.map(|v| v.into())) .map_err(|e| SubsystemError::with_origin("approval-voting", e)) } diff --git a/node/core/approval-voting/src/approval_db/v1/tests.rs b/node/core/approval-voting/src/approval_db/v1/tests.rs index 548c64bcef03..06923c6a539f 100644 --- a/node/core/approval-voting/src/approval_db/v1/tests.rs +++ b/node/core/approval-voting/src/approval_db/v1/tests.rs @@ -28,9 +28,12 @@ use std::{collections::HashMap, sync::Arc}; use ::test_helpers::{dummy_candidate_receipt, dummy_candidate_receipt_bad_sig, dummy_hash}; const DATA_COL: u32 = 0; -const NUM_COLUMNS: u32 = 1; +const SESSION_DATA_COL: u32 = 1; -const TEST_CONFIG: Config = Config { col_data: DATA_COL }; +const NUM_COLUMNS: u32 = 2; + +const TEST_CONFIG: Config = + Config { col_approval_data: DATA_COL, col_session_data: SESSION_DATA_COL }; fn make_db() -> (DbBackend, Arc) { let db = kvdb_memorydb::create(NUM_COLUMNS); diff --git a/node/core/approval-voting/src/import.rs b/node/core/approval-voting/src/import.rs index df713143750f..20629dd022d4 100644 --- a/node/core/approval-voting/src/import.rs +++ b/node/core/approval-voting/src/import.rs @@ -632,14 +632,15 @@ pub(crate) mod tests { pub(crate) use sp_runtime::{Digest, DigestItem}; use std::{pin::Pin, sync::Arc}; - use crate::{ - approval_db::v1::Config as DatabaseConfig, criteria, BlockEntry, APPROVAL_SESSIONS, - }; + use crate::{approval_db::v1::Config as DatabaseConfig, criteria, BlockEntry}; const DATA_COL: u32 = 0; - const NUM_COLUMNS: u32 = 1; + const SESSION_DATA_COL: u32 = 1; + + const NUM_COLUMNS: u32 = 2; - const TEST_CONFIG: DatabaseConfig = DatabaseConfig { col_data: DATA_COL }; + const TEST_CONFIG: DatabaseConfig = + DatabaseConfig { col_approval_data: DATA_COL, col_session_data: SESSION_DATA_COL }; #[derive(Default)] struct MockClock; @@ -654,22 +655,23 @@ pub(crate) mod tests { } fn blank_state() -> State { + let db = kvdb_memorydb::create(NUM_COLUMNS); + let db = polkadot_node_subsystem_util::database::kvdb_impl::DbAdapter::new(db, &[]); + let db: Arc = Arc::new(db); State { session_window: None, keystore: Arc::new(LocalKeystore::in_memory()), slot_duration_millis: 6_000, clock: Box::new(MockClock::default()), assignment_criteria: Box::new(MockAssignmentCriteria), + db, + db_config: TEST_CONFIG, } } fn single_session_state(index: SessionIndex, info: SessionInfo) -> State { State { - session_window: Some(RollingSessionWindow::with_session_info( - APPROVAL_SESSIONS, - index, - vec![info], - )), + session_window: Some(RollingSessionWindow::with_session_info(index, vec![info])), ..blank_state() } } @@ -782,11 +784,8 @@ pub(crate) mod tests { .map(|(r, c, g)| (r.hash(), r.clone(), *c, *g)) .collect::>(); - let session_window = RollingSessionWindow::with_session_info( - APPROVAL_SESSIONS, - session, - vec![session_info], - ); + let session_window = + RollingSessionWindow::with_session_info(session, vec![session_info]); let header = header.clone(); Box::pin(async move { @@ -891,11 +890,8 @@ pub(crate) mod tests { .collect::>(); let test_fut = { - let session_window = RollingSessionWindow::with_session_info( - APPROVAL_SESSIONS, - session, - vec![session_info], - ); + let session_window = + RollingSessionWindow::with_session_info(session, vec![session_info]); let header = header.clone(); Box::pin(async move { @@ -1089,11 +1085,8 @@ pub(crate) mod tests { .map(|(r, c, g)| (r.hash(), r.clone(), *c, *g)) .collect::>(); - let session_window = Some(RollingSessionWindow::with_session_info( - APPROVAL_SESSIONS, - session, - vec![session_info], - )); + let session_window = + Some(RollingSessionWindow::with_session_info(session, vec![session_info])); let header = header.clone(); Box::pin(async move { @@ -1304,38 +1297,6 @@ pub(crate) mod tests { } ); - // Caching of sesssions needs sessoion of first unfinalied block. - assert_matches!( - handle.recv().await, - AllMessages::ChainApi(ChainApiMessage::FinalizedBlockNumber( - s_tx, - )) => { - let _ = s_tx.send(Ok(header.number)); - } - ); - - assert_matches!( - handle.recv().await, - AllMessages::ChainApi(ChainApiMessage::FinalizedBlockHash( - block_number, - s_tx, - )) => { - assert_eq!(block_number, header.number); - let _ = s_tx.send(Ok(Some(header.hash()))); - } - ); - - assert_matches!( - handle.recv().await, - AllMessages::RuntimeApi(RuntimeApiMessage::Request( - h, - RuntimeApiRequest::SessionIndexForChild(s_tx), - )) => { - assert_eq!(h, header.hash()); - let _ = s_tx.send(Ok(session)); - } - ); - // determine_new_blocks exits early as the parent_hash is in the DB assert_matches!( diff --git a/node/core/approval-voting/src/lib.rs b/node/core/approval-voting/src/lib.rs index cff420fa46b6..b96992df2c88 100644 --- a/node/core/approval-voting/src/lib.rs +++ b/node/core/approval-voting/src/lib.rs @@ -44,8 +44,7 @@ use polkadot_node_subsystem_util::{ database::Database, metrics::{self, prometheus}, rolling_session_window::{ - new_session_window_size, RollingSessionWindow, SessionWindowSize, SessionWindowUpdate, - SessionsUnavailable, + DatabaseParams, RollingSessionWindow, SessionWindowUpdate, SessionsUnavailable, }, TimeoutExt, }; @@ -97,8 +96,6 @@ use crate::{ #[cfg(test)] mod tests; -pub const APPROVAL_SESSIONS: SessionWindowSize = new_session_window_size!(6); - const APPROVAL_CHECKING_TIMEOUT: Duration = Duration::from_secs(120); /// How long are we willing to wait for approval signatures? /// @@ -118,7 +115,9 @@ const LOG_TARGET: &str = "parachain::approval-voting"; #[derive(Debug, Clone)] pub struct Config { /// The column family in the DB where approval-voting data is stored. - pub col_data: u32, + pub col_approval_data: u32, + /// The of the DB where rolling session info is stored. + pub col_session_data: u32, /// The slot duration of the consensus algorithm, in milliseconds. Should be evenly /// divisible by 500. pub slot_duration_millis: u64, @@ -358,7 +357,10 @@ impl ApprovalVotingSubsystem { keystore, slot_duration_millis: config.slot_duration_millis, db, - db_config: DatabaseConfig { col_data: config.col_data }, + db_config: DatabaseConfig { + col_approval_data: config.col_approval_data, + col_session_data: config.col_session_data, + }, mode: Mode::Syncing(sync_oracle), metrics, } @@ -367,7 +369,10 @@ impl ApprovalVotingSubsystem { /// Revert to the block corresponding to the specified `hash`. /// The operation is not allowed for blocks older than the last finalized one. pub fn revert_to(&self, hash: Hash) -> Result<(), SubsystemError> { - let config = approval_db::v1::Config { col_data: self.db_config.col_data }; + let config = approval_db::v1::Config { + col_approval_data: self.db_config.col_approval_data, + col_session_data: self.db_config.col_session_data, + }; let mut backend = approval_db::v1::DbBackend::new(self.db.clone(), config); let mut overlay = OverlayedBackend::new(&backend); @@ -378,6 +383,25 @@ impl ApprovalVotingSubsystem { } } +// Checks and logs approval vote db state. It is perfectly normal to start with an +// empty approval vote DB if we changed DB type or the node will sync from scratch. +fn db_sanity_check(db: Arc, config: DatabaseConfig) -> SubsystemResult<()> { + let backend = DbBackend::new(db, config); + let all_blocks = backend.load_all_blocks()?; + + if all_blocks.is_empty() { + gum::info!(target: LOG_TARGET, "Starting with an empty approval vote DB.",); + } else { + gum::debug!( + target: LOG_TARGET, + "Starting with {} blocks in approval vote DB.", + all_blocks.len() + ); + } + + Ok(()) +} + #[overseer::subsystem(ApprovalVoting, error = SubsystemError, prefix = self::overseer)] impl ApprovalVotingSubsystem { fn start(self, ctx: Context) -> SpawnedSubsystem { @@ -615,6 +639,9 @@ struct State { slot_duration_millis: u64, clock: Box, assignment_criteria: Box, + // Require for `RollingSessionWindow`. + db_config: DatabaseConfig, + db: Arc, } #[overseer::contextbounds(ApprovalVoting, prefix = self::overseer)] @@ -636,8 +663,17 @@ impl State { match session_window { None => { let sender = ctx.sender().clone(); - self.session_window = - Some(RollingSessionWindow::new(sender, APPROVAL_SESSIONS, head).await?); + self.session_window = Some( + RollingSessionWindow::new( + sender, + head, + DatabaseParams { + db: self.db.clone(), + db_column: self.db_config.col_session_data, + }, + ) + .await?, + ); Ok(None) }, Some(mut session_window) => { @@ -732,12 +768,18 @@ async fn run( where B: Backend, { + if let Err(err) = db_sanity_check(subsystem.db.clone(), subsystem.db_config.clone()) { + gum::warn!(target: LOG_TARGET, ?err, "Could not run approval vote DB sanity check"); + } + let mut state = State { session_window: None, keystore: subsystem.keystore, slot_duration_millis: subsystem.slot_duration_millis, clock, assignment_criteria, + db_config: subsystem.db_config, + db: subsystem.db, }; let mut wakeups = Wakeups::default(); diff --git a/node/core/approval-voting/src/tests.rs b/node/core/approval-voting/src/tests.rs index d5c8d3c01da4..b9063c8ade25 100644 --- a/node/core/approval-voting/src/tests.rs +++ b/node/core/approval-voting/src/tests.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . +use crate::tests::test_constants::TEST_CONFIG; + use super::*; use polkadot_node_primitives::{ approval::{ @@ -111,9 +113,12 @@ fn make_sync_oracle(val: bool) -> (Box, TestSyncOracleHan pub mod test_constants { use crate::approval_db::v1::Config as DatabaseConfig; const DATA_COL: u32 = 0; - pub(crate) const NUM_COLUMNS: u32 = 1; + const SESSION_DATA_COL: u32 = 1; + + pub(crate) const NUM_COLUMNS: u32 = 2; - pub(crate) const TEST_CONFIG: DatabaseConfig = DatabaseConfig { col_data: DATA_COL }; + pub(crate) const TEST_CONFIG: DatabaseConfig = + DatabaseConfig { col_approval_data: DATA_COL, col_session_data: SESSION_DATA_COL }; } struct MockSupportsParachains; @@ -487,8 +492,9 @@ fn test_harness>( context, ApprovalVotingSubsystem::with_config( Config { - col_data: test_constants::TEST_CONFIG.col_data, + col_approval_data: test_constants::TEST_CONFIG.col_approval_data, slot_duration_millis: SLOT_DURATION_MILLIS, + col_session_data: TEST_CONFIG.col_session_data, }, Arc::new(db), Arc::new(keystore), @@ -810,38 +816,38 @@ async fn import_block( } ); - assert_matches!( - overseer_recv(overseer).await, - AllMessages::ChainApi(ChainApiMessage::FinalizedBlockNumber( - s_tx, - )) => { - let _ = s_tx.send(Ok(number)); - } - ); + if !fork { + assert_matches!( + overseer_recv(overseer).await, + AllMessages::ChainApi(ChainApiMessage::FinalizedBlockNumber( + s_tx, + )) => { + let _ = s_tx.send(Ok(number)); + } + ); - assert_matches!( - overseer_recv(overseer).await, - AllMessages::ChainApi(ChainApiMessage::FinalizedBlockHash( - block_number, - s_tx, - )) => { - assert_eq!(block_number, number); - let _ = s_tx.send(Ok(Some(hashes[number as usize].0))); - } - ); + assert_matches!( + overseer_recv(overseer).await, + AllMessages::ChainApi(ChainApiMessage::FinalizedBlockHash( + block_number, + s_tx, + )) => { + assert_eq!(block_number, number); + let _ = s_tx.send(Ok(Some(hashes[number as usize].0))); + } + ); - assert_matches!( - overseer_recv(overseer).await, - AllMessages::RuntimeApi(RuntimeApiMessage::Request( - h, - RuntimeApiRequest::SessionIndexForChild(s_tx), - )) => { - assert_eq!(h, hashes[number as usize].0); - let _ = s_tx.send(Ok(number.into())); - } - ); + assert_matches!( + overseer_recv(overseer).await, + AllMessages::RuntimeApi(RuntimeApiMessage::Request( + h, + RuntimeApiRequest::SessionIndexForChild(s_tx), + )) => { + assert_eq!(h, hashes[number as usize].0); + let _ = s_tx.send(Ok(number.into())); + } + ); - if !fork { assert_matches!( overseer_recv(overseer).await, AllMessages::RuntimeApi( diff --git a/node/core/candidate-validation/Cargo.toml b/node/core/candidate-validation/Cargo.toml index 8634cfe5a75e..105d7c1a21dc 100644 --- a/node/core/candidate-validation/Cargo.toml +++ b/node/core/candidate-validation/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" [dependencies] async-trait = "0.1.57" futures = "0.3.21" +futures-timer = "3.0.2" gum = { package = "tracing-gum", path = "../../gum" } sp-maybe-compressed-blob = { package = "sp-maybe-compressed-blob", git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/node/core/candidate-validation/src/lib.rs b/node/core/candidate-validation/src/lib.rs index c3775ba1c453..a82a0feb78a0 100644 --- a/node/core/candidate-validation/src/lib.rs +++ b/node/core/candidate-validation/src/lib.rs @@ -60,6 +60,12 @@ mod tests; const LOG_TARGET: &'static str = "parachain::candidate-validation"; +/// The amount of time to wait before retrying after an AmbiguousWorkerDeath validation error. +#[cfg(not(test))] +const PVF_EXECUTION_RETRY_DELAY: Duration = Duration::from_secs(3); +#[cfg(test)] +const PVF_EXECUTION_RETRY_DELAY: Duration = Duration::from_millis(200); + /// Configuration for the candidate validation subsystem #[derive(Clone)] pub struct Config { @@ -490,7 +496,7 @@ where } async fn validate_candidate_exhaustive( - mut validation_backend: impl ValidationBackend, + mut validation_backend: impl ValidationBackend + Send, persisted_validation_data: PersistedValidationData, validation_code: ValidationCode, candidate_receipt: CandidateReceipt, @@ -551,7 +557,7 @@ async fn validate_candidate_exhaustive( }; let result = validation_backend - .validate_candidate(raw_validation_code.to_vec(), timeout, params) + .validate_candidate_with_retry(raw_validation_code.to_vec(), timeout, params) .await; if let Err(ref error) = result { @@ -604,45 +610,63 @@ async fn validate_candidate_exhaustive( #[async_trait] trait ValidationBackend { async fn validate_candidate( + &mut self, + pvf: Pvf, + timeout: Duration, + encoded_params: Vec, + ) -> Result; + + async fn validate_candidate_with_retry( &mut self, raw_validation_code: Vec, timeout: Duration, params: ValidationParams, - ) -> Result; + ) -> Result { + // Construct the PVF a single time, since it is an expensive operation. Cloning it is cheap. + let pvf = Pvf::from_code(raw_validation_code); + + let validation_result = + self.validate_candidate(pvf.clone(), timeout, params.encode()).await; + + // If we get an AmbiguousWorkerDeath error, retry once after a brief delay, on the + // assumption that the conditions that caused this error may have been transient. + if let Err(ValidationError::InvalidCandidate(WasmInvalidCandidate::AmbiguousWorkerDeath)) = + validation_result + { + // Wait a brief delay before retrying. + futures_timer::Delay::new(PVF_EXECUTION_RETRY_DELAY).await; + // Encode the params again when re-trying. We expect the retry case to be relatively + // rare, and we want to avoid unconditionally cloning data. + self.validate_candidate(pvf, timeout, params.encode()).await + } else { + validation_result + } + } async fn precheck_pvf(&mut self, pvf: Pvf) -> Result<(), PrepareError>; } #[async_trait] impl ValidationBackend for ValidationHost { + /// Tries executing a PVF a single time (no retries). async fn validate_candidate( &mut self, - raw_validation_code: Vec, + pvf: Pvf, timeout: Duration, - params: ValidationParams, + encoded_params: Vec, ) -> Result { + let priority = polkadot_node_core_pvf::Priority::Normal; + let (tx, rx) = oneshot::channel(); - if let Err(err) = self - .execute_pvf( - Pvf::from_code(raw_validation_code), - timeout, - params.encode(), - polkadot_node_core_pvf::Priority::Normal, - tx, - ) - .await - { + if let Err(err) = self.execute_pvf(pvf, timeout, encoded_params, priority, tx).await { return Err(ValidationError::InternalError(format!( "cannot send pvf to the validation host: {:?}", err ))) } - let validation_result = rx - .await - .map_err(|_| ValidationError::InternalError("validation was cancelled".into()))?; - - validation_result + rx.await + .map_err(|_| ValidationError::InternalError("validation was cancelled".into()))? } async fn precheck_pvf(&mut self, pvf: Pvf) -> Result<(), PrepareError> { diff --git a/node/core/candidate-validation/src/tests.rs b/node/core/candidate-validation/src/tests.rs index ecac13d1440d..cf467cd5c057 100644 --- a/node/core/candidate-validation/src/tests.rs +++ b/node/core/candidate-validation/src/tests.rs @@ -345,12 +345,19 @@ fn check_does_not_match() { } struct MockValidateCandidateBackend { - result: Result, + result_list: Vec>, + num_times_called: usize, } impl MockValidateCandidateBackend { fn with_hardcoded_result(result: Result) -> Self { - Self { result } + Self { result_list: vec![result], num_times_called: 0 } + } + + fn with_hardcoded_result_list( + result_list: Vec>, + ) -> Self { + Self { result_list, num_times_called: 0 } } } @@ -358,11 +365,16 @@ impl MockValidateCandidateBackend { impl ValidationBackend for MockValidateCandidateBackend { async fn validate_candidate( &mut self, - _raw_validation_code: Vec, + _pvf: Pvf, _timeout: Duration, - _params: ValidationParams, + _encoded_params: Vec, ) -> Result { - self.result.clone() + // This is expected to panic if called more times than expected, indicating an error in the + // test. + let result = self.result_list[self.num_times_called].clone(); + self.num_times_called += 1; + + result } async fn precheck_pvf(&mut self, _pvf: Pvf) -> Result<(), PrepareError> { @@ -468,7 +480,7 @@ fn candidate_validation_bad_return_is_invalid() { let v = executor::block_on(validate_candidate_exhaustive( MockValidateCandidateBackend::with_hardcoded_result(Err( - ValidationError::InvalidCandidate(WasmInvalidCandidate::AmbiguousWorkerDeath), + ValidationError::InvalidCandidate(WasmInvalidCandidate::HardTimeout), )), validation_data, validation_code, @@ -479,6 +491,122 @@ fn candidate_validation_bad_return_is_invalid() { )) .unwrap(); + assert_matches!(v, ValidationResult::Invalid(InvalidCandidate::Timeout)); +} + +#[test] +fn candidate_validation_one_ambiguous_error_is_valid() { + let validation_data = PersistedValidationData { max_pov_size: 1024, ..Default::default() }; + + let pov = PoV { block_data: BlockData(vec![1; 32]) }; + let head_data = HeadData(vec![1, 1, 1]); + let validation_code = ValidationCode(vec![2; 16]); + + let descriptor = make_valid_candidate_descriptor( + ParaId::from(1_u32), + dummy_hash(), + validation_data.hash(), + pov.hash(), + validation_code.hash(), + head_data.hash(), + dummy_hash(), + Sr25519Keyring::Alice, + ); + + let check = perform_basic_checks( + &descriptor, + validation_data.max_pov_size, + &pov, + &validation_code.hash(), + ); + assert!(check.is_ok()); + + let validation_result = WasmValidationResult { + head_data, + new_validation_code: Some(vec![2, 2, 2].into()), + upward_messages: Vec::new(), + horizontal_messages: Vec::new(), + processed_downward_messages: 0, + hrmp_watermark: 0, + }; + + let commitments = CandidateCommitments { + head_data: validation_result.head_data.clone(), + upward_messages: validation_result.upward_messages.clone(), + horizontal_messages: validation_result.horizontal_messages.clone(), + new_validation_code: validation_result.new_validation_code.clone(), + processed_downward_messages: validation_result.processed_downward_messages, + hrmp_watermark: validation_result.hrmp_watermark, + }; + + let candidate_receipt = CandidateReceipt { descriptor, commitments_hash: commitments.hash() }; + + let v = executor::block_on(validate_candidate_exhaustive( + MockValidateCandidateBackend::with_hardcoded_result_list(vec![ + Err(ValidationError::InvalidCandidate(WasmInvalidCandidate::AmbiguousWorkerDeath)), + Ok(validation_result), + ]), + validation_data.clone(), + validation_code, + candidate_receipt, + Arc::new(pov), + Duration::from_secs(0), + &Default::default(), + )) + .unwrap(); + + assert_matches!(v, ValidationResult::Valid(outputs, used_validation_data) => { + assert_eq!(outputs.head_data, HeadData(vec![1, 1, 1])); + assert_eq!(outputs.upward_messages, Vec::::new()); + assert_eq!(outputs.horizontal_messages, Vec::new()); + assert_eq!(outputs.new_validation_code, Some(vec![2, 2, 2].into())); + assert_eq!(outputs.hrmp_watermark, 0); + assert_eq!(used_validation_data, validation_data); + }); +} + +#[test] +fn candidate_validation_multiple_ambiguous_errors_is_invalid() { + let validation_data = PersistedValidationData { max_pov_size: 1024, ..Default::default() }; + + let pov = PoV { block_data: BlockData(vec![1; 32]) }; + let validation_code = ValidationCode(vec![2; 16]); + + let descriptor = make_valid_candidate_descriptor( + ParaId::from(1_u32), + dummy_hash(), + validation_data.hash(), + pov.hash(), + validation_code.hash(), + dummy_hash(), + dummy_hash(), + Sr25519Keyring::Alice, + ); + + let check = perform_basic_checks( + &descriptor, + validation_data.max_pov_size, + &pov, + &validation_code.hash(), + ); + assert!(check.is_ok()); + + let candidate_receipt = CandidateReceipt { descriptor, commitments_hash: Hash::zero() }; + + let v = executor::block_on(validate_candidate_exhaustive( + MockValidateCandidateBackend::with_hardcoded_result_list(vec![ + Err(ValidationError::InvalidCandidate(WasmInvalidCandidate::AmbiguousWorkerDeath)), + Err(ValidationError::InvalidCandidate(WasmInvalidCandidate::AmbiguousWorkerDeath)), + ]), + validation_data, + validation_code, + candidate_receipt, + Arc::new(pov), + Duration::from_secs(0), + &Default::default(), + )) + .unwrap(); + assert_matches!(v, ValidationResult::Invalid(InvalidCandidate::ExecutionError(_))); } @@ -779,9 +907,9 @@ impl MockPreCheckBackend { impl ValidationBackend for MockPreCheckBackend { async fn validate_candidate( &mut self, - _raw_validation_code: Vec, + _pvf: Pvf, _timeout: Duration, - _params: ValidationParams, + _encoded_params: Vec, ) -> Result { unreachable!() } diff --git a/node/core/dispute-coordinator/src/db/v1.rs b/node/core/dispute-coordinator/src/db/v1.rs index 2c643d341de2..bb1456a59745 100644 --- a/node/core/dispute-coordinator/src/db/v1.rs +++ b/node/core/dispute-coordinator/src/db/v1.rs @@ -99,10 +99,10 @@ impl DbBackend { encoded = ?candidate_votes_session_prefix(index), "Cleaning votes for session index" ); - tx.delete_prefix(self.config.col_data, &candidate_votes_session_prefix(index)); + tx.delete_prefix(self.config.col_dispute_data, &candidate_votes_session_prefix(index)); } // New watermark: - tx.put_vec(self.config.col_data, CLEANED_VOTES_WATERMARK_KEY, clean_until.encode()); + tx.put_vec(self.config.col_dispute_data, CLEANED_VOTES_WATERMARK_KEY, clean_until.encode()); Ok(()) } } @@ -148,21 +148,32 @@ impl Backend for DbBackend { self.add_vote_cleanup_tx(&mut tx, session)?; // Actually write the earliest session. - tx.put_vec(self.config.col_data, EARLIEST_SESSION_KEY, session.encode()); + tx.put_vec( + self.config.col_dispute_data, + EARLIEST_SESSION_KEY, + session.encode(), + ); }, BackendWriteOp::WriteRecentDisputes(recent_disputes) => { - tx.put_vec(self.config.col_data, RECENT_DISPUTES_KEY, recent_disputes.encode()); + tx.put_vec( + self.config.col_dispute_data, + RECENT_DISPUTES_KEY, + recent_disputes.encode(), + ); }, BackendWriteOp::WriteCandidateVotes(session, candidate_hash, votes) => { gum::trace!(target: LOG_TARGET, ?session, "Writing candidate votes"); tx.put_vec( - self.config.col_data, + self.config.col_dispute_data, &candidate_votes_key(session, &candidate_hash), votes.encode(), ); }, BackendWriteOp::DeleteCandidateVotes(session, candidate_hash) => { - tx.delete(self.config.col_data, &candidate_votes_key(session, &candidate_hash)); + tx.delete( + self.config.col_dispute_data, + &candidate_votes_key(session, &candidate_hash), + ); }, } } @@ -195,7 +206,9 @@ fn candidate_votes_session_prefix(session: SessionIndex) -> [u8; 15 + 4] { #[derive(Debug, Clone)] pub struct ColumnConfiguration { /// The column in the key-value DB where data is stored. - pub col_data: u32, + pub col_dispute_data: u32, + /// The column in the key-value DB where session data is stored. + pub col_session_data: u32, } /// Tracked votes on candidates, for the purposes of dispute resolution. @@ -257,8 +270,12 @@ impl From for crate::error::Error { /// Result alias for DB errors. pub type Result = std::result::Result; -fn load_decode(db: &dyn Database, col_data: u32, key: &[u8]) -> Result> { - match db.get(col_data, key)? { +fn load_decode( + db: &dyn Database, + col_dispute_data: u32, + key: &[u8], +) -> Result> { + match db.get(col_dispute_data, key)? { None => Ok(None), Some(raw) => D::decode(&mut &raw[..]).map(Some).map_err(Into::into), } @@ -271,7 +288,7 @@ pub(crate) fn load_candidate_votes( session: SessionIndex, candidate_hash: &CandidateHash, ) -> SubsystemResult> { - load_decode(db, config.col_data, &candidate_votes_key(session, candidate_hash)) + load_decode(db, config.col_dispute_data, &candidate_votes_key(session, candidate_hash)) .map_err(|e| SubsystemError::with_origin("dispute-coordinator", e)) } @@ -280,7 +297,7 @@ pub(crate) fn load_earliest_session( db: &dyn Database, config: &ColumnConfiguration, ) -> SubsystemResult> { - load_decode(db, config.col_data, EARLIEST_SESSION_KEY) + load_decode(db, config.col_dispute_data, EARLIEST_SESSION_KEY) .map_err(|e| SubsystemError::with_origin("dispute-coordinator", e)) } @@ -289,7 +306,7 @@ pub(crate) fn load_recent_disputes( db: &dyn Database, config: &ColumnConfiguration, ) -> SubsystemResult> { - load_decode(db, config.col_data, RECENT_DISPUTES_KEY) + load_decode(db, config.col_dispute_data, RECENT_DISPUTES_KEY) .map_err(|e| SubsystemError::with_origin("dispute-coordinator", e)) } @@ -347,7 +364,7 @@ fn load_cleaned_votes_watermark( db: &dyn Database, config: &ColumnConfiguration, ) -> FatalResult> { - load_decode(db, config.col_data, CLEANED_VOTES_WATERMARK_KEY) + load_decode(db, config.col_dispute_data, CLEANED_VOTES_WATERMARK_KEY) .map_err(|e| FatalError::DbReadFailed(e)) } @@ -362,7 +379,7 @@ mod tests { let db = kvdb_memorydb::create(1); let db = polkadot_node_subsystem_util::database::kvdb_impl::DbAdapter::new(db, &[0]); let store = Arc::new(db); - let config = ColumnConfiguration { col_data: 0 }; + let config = ColumnConfiguration { col_dispute_data: 0, col_session_data: 1 }; DbBackend::new(store, config, Metrics::default()) } diff --git a/node/core/dispute-coordinator/src/lib.rs b/node/core/dispute-coordinator/src/lib.rs index 6289eb2f11a2..03abd8f59d60 100644 --- a/node/core/dispute-coordinator/src/lib.rs +++ b/node/core/dispute-coordinator/src/lib.rs @@ -35,7 +35,8 @@ use polkadot_node_subsystem::{ overseer, ActivatedLeaf, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError, }; use polkadot_node_subsystem_util::{ - database::Database, rolling_session_window::RollingSessionWindow, + database::Database, + rolling_session_window::{DatabaseParams, RollingSessionWindow}, }; use polkadot_primitives::v2::{ScrapedOnChainVotes, ValidatorIndex, ValidatorPair}; @@ -117,12 +118,17 @@ pub struct DisputeCoordinatorSubsystem { #[derive(Debug, Clone, Copy)] pub struct Config { /// The data column in the store to use for dispute data. - pub col_data: u32, + pub col_dispute_data: u32, + /// The data column in the store to use for session data. + pub col_session_data: u32, } impl Config { fn column_config(&self) -> db::v1::ColumnConfiguration { - db::v1::ColumnConfiguration { col_data: self.col_data } + db::v1::ColumnConfiguration { + col_dispute_data: self.col_dispute_data, + col_session_data: self.col_session_data, + } } } @@ -199,17 +205,21 @@ impl DisputeCoordinatorSubsystem { B: Backend + 'static, { loop { - let (first_leaf, rolling_session_window) = match get_rolling_session_window(ctx).await { - Ok(Some(update)) => update, - Ok(None) => { - gum::info!(target: LOG_TARGET, "received `Conclude` signal, exiting"); - return Ok(None) - }, - Err(e) => { - e.split()?.log(); - continue - }, - }; + let db_params = + DatabaseParams { db: self.store.clone(), db_column: self.config.col_session_data }; + + let (first_leaf, rolling_session_window) = + match get_rolling_session_window(ctx, db_params).await { + Ok(Some(update)) => update, + Ok(None) => { + gum::info!(target: LOG_TARGET, "received `Conclude` signal, exiting"); + return Ok(None) + }, + Err(e) => { + e.split()?.log(); + continue + }, + }; let mut overlay_db = OverlayedBackend::new(&mut backend); let (participations, votes, spam_slots, ordering_provider) = match self @@ -352,12 +362,13 @@ impl DisputeCoordinatorSubsystem { #[overseer::contextbounds(DisputeCoordinator, prefix = self::overseer)] async fn get_rolling_session_window( ctx: &mut Context, + db_params: DatabaseParams, ) -> Result> { if let Some(leaf) = { wait_for_first_leaf(ctx) }.await? { let sender = ctx.sender().clone(); Ok(Some(( leaf.clone(), - RollingSessionWindow::new(sender, DISPUTE_WINDOW, leaf.hash) + RollingSessionWindow::new(sender, leaf.hash, db_params) .await .map_err(JfyiError::RollingSessionWindow)?, ))) diff --git a/node/core/dispute-coordinator/src/tests.rs b/node/core/dispute-coordinator/src/tests.rs index c6fe328d9537..a1ad315d2ea0 100644 --- a/node/core/dispute-coordinator/src/tests.rs +++ b/node/core/dispute-coordinator/src/tests.rs @@ -176,7 +176,7 @@ impl Default for TestState { let db = kvdb_memorydb::create(1); let db = polkadot_node_subsystem_util::database::kvdb_impl::DbAdapter::new(db, &[]); let db = Arc::new(db); - let config = Config { col_data: 0 }; + let config = Config { col_dispute_data: 0, col_session_data: 1 }; let genesis_header = Header { parent_hash: Hash::zero(), @@ -251,6 +251,7 @@ impl TestState { session: SessionIndex, ) { // Order of messages is not fixed (different on initializing): + #[derive(Debug)] struct FinishedSteps { got_session_information: bool, got_scraping_information: bool, @@ -268,7 +269,8 @@ impl TestState { let mut finished_steps = FinishedSteps::new(); while !finished_steps.is_done() { - match overseer_recv(virtual_overseer).await { + let recv = overseer_recv(virtual_overseer).await; + match recv { AllMessages::RuntimeApi(RuntimeApiMessage::Request( h, RuntimeApiRequest::SessionIndexForChild(tx), @@ -282,36 +284,38 @@ impl TestState { let _ = tx.send(Ok(session)); // Queries for fetching earliest unfinalized block session. See `RollingSessionWindow`. - assert_matches!( - overseer_recv(virtual_overseer).await, - AllMessages::ChainApi(ChainApiMessage::FinalizedBlockNumber( - s_tx, - )) => { - let _ = s_tx.send(Ok(block_number)); - } - ); + if self.known_session.is_none() { + assert_matches!( + overseer_recv(virtual_overseer).await, + AllMessages::ChainApi(ChainApiMessage::FinalizedBlockNumber( + s_tx, + )) => { + let _ = s_tx.send(Ok(block_number)); + } + ); - assert_matches!( - overseer_recv(virtual_overseer).await, - AllMessages::ChainApi(ChainApiMessage::FinalizedBlockHash( - number, - s_tx, - )) => { - assert_eq!(block_number, number); - let _ = s_tx.send(Ok(Some(block_hash))); - } - ); + assert_matches!( + overseer_recv(virtual_overseer).await, + AllMessages::ChainApi(ChainApiMessage::FinalizedBlockHash( + number, + s_tx, + )) => { + assert_eq!(block_number, number); + let _ = s_tx.send(Ok(Some(block_hash))); + } + ); - assert_matches!( - overseer_recv(virtual_overseer).await, - AllMessages::RuntimeApi(RuntimeApiMessage::Request( - h, - RuntimeApiRequest::SessionIndexForChild(s_tx), - )) => { - assert_eq!(h, block_hash); - let _ = s_tx.send(Ok(session)); - } - ); + assert_matches!( + overseer_recv(virtual_overseer).await, + AllMessages::RuntimeApi(RuntimeApiMessage::Request( + h, + RuntimeApiRequest::SessionIndexForChild(s_tx), + )) => { + assert_eq!(h, block_hash); + let _ = s_tx.send(Ok(session)); + } + ); + } // No queries, if subsystem knows about this session already. if self.known_session == Some(session) { @@ -754,6 +758,7 @@ fn approval_vote_import_works() { let approval_votes = [(ValidatorIndex(4), approval_vote.into_validator_signature())] .into_iter() .collect(); + handle_approval_vote_request(&mut virtual_overseer, &candidate_hash1, approval_votes) .await; @@ -2255,6 +2260,7 @@ fn resume_dispute_with_local_statement() { }, }) .await; + handle_approval_vote_request(&mut virtual_overseer, &candidate_hash, HashMap::new()) .await; @@ -2469,6 +2475,7 @@ fn resume_dispute_with_local_statement_without_local_key() { test_state }) }); + // No keys: test_state.subsystem_keystore = make_keystore(vec![Sr25519Keyring::Two.to_seed()].into_iter()).into(); diff --git a/node/core/pvf/src/artifacts.rs b/node/core/pvf/src/artifacts.rs index 49d1be75fed4..038d8e803299 100644 --- a/node/core/pvf/src/artifacts.rs +++ b/node/core/pvf/src/artifacts.rs @@ -96,17 +96,29 @@ pub enum ArtifactState { /// That means that the artifact should be accessible through the path obtained by the artifact /// id (unless, it was removed externally). Prepared { - /// The time when the artifact was the last time needed. + /// The time when the artifact was last needed. /// /// This is updated when we get the heads up for this artifact or when we just discover /// this file. last_time_needed: SystemTime, }, /// A task to prepare this artifact is scheduled. - Preparing { waiting_for_response: Vec }, + Preparing { + /// List of result senders that are waiting for a response. + waiting_for_response: Vec, + /// The number of times this artifact has failed to prepare. + num_failures: u32, + }, /// The code couldn't be compiled due to an error. Such artifacts /// never reach the executor and stay in the host's memory. - FailedToProcess(PrepareError), + FailedToProcess { + /// Keep track of the last time that processing this artifact failed. + last_time_failed: SystemTime, + /// The number of times this artifact has failed to prepare. + num_failures: u32, + /// The last error encountered for preparation. + error: PrepareError, + }, } /// A container of all known artifact ids and their states. @@ -120,7 +132,7 @@ impl Artifacts { /// /// The recognized artifacts will be filled in the table and unrecognized will be removed. pub async fn new(cache_path: &Path) -> Self { - // Make sure that the cache path directory and all it's parents are created. + // Make sure that the cache path directory and all its parents are created. // First delete the entire cache. Nodes are long-running so this should populate shortly. let _ = async_std::fs::remove_dir_all(cache_path).await; let _ = async_std::fs::create_dir_all(cache_path).await; @@ -150,7 +162,7 @@ impl Artifacts { // See the precondition. always!(self .artifacts - .insert(artifact_id, ArtifactState::Preparing { waiting_for_response }) + .insert(artifact_id, ArtifactState::Preparing { waiting_for_response, num_failures: 0 }) .is_none()); } diff --git a/node/core/pvf/src/execute/queue.rs b/node/core/pvf/src/execute/queue.rs index 23ed115b7f09..b4c6a66b7719 100644 --- a/node/core/pvf/src/execute/queue.rs +++ b/node/core/pvf/src/execute/queue.rs @@ -247,13 +247,13 @@ fn handle_job_finish( gum::debug!( target: LOG_TARGET, validation_code_hash = ?artifact_id.code_hash, + ?worker, worker_rip = idle_worker.is_none(), - ?result, - "job finished.", + "execute worker concluded", ); - // First we send the result. It may fail due the other end of the channel being dropped, that's - // legitimate and we don't treat that as an error. + // First we send the result. It may fail due to the other end of the channel being dropped, + // that's legitimate and we don't treat that as an error. let _ = result_tx.send(result); // Then, we should deal with the worker: @@ -305,7 +305,7 @@ async fn spawn_worker_task(program_path: PathBuf, spawn_timeout: Duration) -> Qu Err(err) => { gum::warn!(target: LOG_TARGET, "failed to spawn an execute worker: {:?}", err); - // Assume that the failure intermittent and retry after a delay. + // Assume that the failure is intermittent and retry after a delay. Delay::new(Duration::from_secs(3)).await; }, } diff --git a/node/core/pvf/src/executor_intf.rs b/node/core/pvf/src/executor_intf.rs index 55e94922ed26..6827fb636eac 100644 --- a/node/core/pvf/src/executor_intf.rs +++ b/node/core/pvf/src/executor_intf.rs @@ -129,7 +129,7 @@ impl Executor { // 2. It cannot and does not limit the stack space consumed by Rust code. // // Meaning that if the wasm code leaves no stack space for Rust code, then the Rust code - // and that will abort the process as well. + // will abort and that will abort the process as well. // // Typically on Linux the main thread gets the stack size specified by the `ulimit` and // typically it's configured to 8 MiB. Rust's spawned threads are 2 MiB. OTOH, the diff --git a/node/core/pvf/src/host.rs b/node/core/pvf/src/host.rs index 6670ea48d4ec..5c29072da1c3 100644 --- a/node/core/pvf/src/host.rs +++ b/node/core/pvf/src/host.rs @@ -22,6 +22,7 @@ use crate::{ artifacts::{ArtifactId, ArtifactPathId, ArtifactState, Artifacts}, + error::PrepareError, execute, metrics::Metrics, prepare, PrepareResult, Priority, Pvf, ValidationError, LOG_TARGET, @@ -38,15 +39,26 @@ use std::{ time::{Duration, SystemTime}, }; -/// The time period after which the precheck preparation worker is considered unresponsive and will -/// be killed. +/// For prechecking requests, the time period after which the preparation worker is considered +/// unresponsive and will be killed. // NOTE: If you change this make sure to fix the buckets of `pvf_preparation_time` metric. -pub const PRECHECK_COMPILATION_TIMEOUT: Duration = Duration::from_secs(60); +pub const PRECHECK_PREPARATION_TIMEOUT: Duration = Duration::from_secs(60); -/// The time period after which the execute preparation worker is considered unresponsive and will -/// be killed. +/// For execution and heads-up requests, the time period after which the preparation worker is +/// considered unresponsive and will be killed. More lenient than the timeout for prechecking to +/// prevent honest validators from timing out on valid PVFs. // NOTE: If you change this make sure to fix the buckets of `pvf_preparation_time` metric. -pub const EXECUTE_COMPILATION_TIMEOUT: Duration = Duration::from_secs(180); +pub const LENIENT_PREPARATION_TIMEOUT: Duration = Duration::from_secs(360); + +/// The time period after which a failed preparation artifact is considered ready to be retried. +/// Note that we will only retry if another request comes in after this cooldown has passed. +#[cfg(not(test))] +pub const PREPARE_FAILURE_COOLDOWN: Duration = Duration::from_secs(15 * 60); +#[cfg(test)] +pub const PREPARE_FAILURE_COOLDOWN: Duration = Duration::from_millis(200); + +/// The amount of times we will retry failed prepare jobs. +pub const NUM_PREPARE_RETRIES: u32 = 5; /// An alias to not spell the type for the oneshot sender for the PVF execution result. pub(crate) type ResultSender = oneshot::Sender>; @@ -96,7 +108,13 @@ impl ValidationHost { result_tx: ResultSender, ) -> Result<(), String> { self.to_host_tx - .send(ToHost::ExecutePvf { pvf, execution_timeout, params, priority, result_tx }) + .send(ToHost::ExecutePvf(ExecutePvfInputs { + pvf, + execution_timeout, + params, + priority, + result_tx, + })) .await .map_err(|_| "the inner loop hung up".to_string()) } @@ -116,20 +134,17 @@ impl ValidationHost { } enum ToHost { - PrecheckPvf { - pvf: Pvf, - result_tx: PrepareResultSender, - }, - ExecutePvf { - pvf: Pvf, - execution_timeout: Duration, - params: Vec, - priority: Priority, - result_tx: ResultSender, - }, - HeadsUp { - active_pvfs: Vec, - }, + PrecheckPvf { pvf: Pvf, result_tx: PrepareResultSender }, + ExecutePvf(ExecutePvfInputs), + HeadsUp { active_pvfs: Vec }, +} + +struct ExecutePvfInputs { + pvf: Pvf, + execution_timeout: Duration, + params: Vec, + priority: Priority, + result_tx: ResultSender, } /// Configuration for the validation host. @@ -360,6 +375,8 @@ async fn run( Some(to_host) => to_host, }; + // If the artifact failed before, it could be re-scheduled for preparation here if + // the preparation failure cooldown has elapsed. break_if_fatal!(handle_to_host( &cache_path, &mut artifacts, @@ -376,9 +393,9 @@ async fn run( // Note that preparation always succeeds. // // That's because the error conditions are written into the artifact and will be - // reported at the time of the execution. It potentially, but not necessarily, - // can be scheduled as a result of this function call, in case there are pending - // executions. + // reported at the time of the execution. It potentially, but not necessarily, can + // be scheduled for execution as a result of this function call, in case there are + // pending executions. // // We could be eager in terms of reporting and plumb the result from the preparation // worker but we don't for the sake of simplicity. @@ -406,32 +423,29 @@ async fn handle_to_host( ToHost::PrecheckPvf { pvf, result_tx } => { handle_precheck_pvf(artifacts, prepare_queue, pvf, result_tx).await?; }, - ToHost::ExecutePvf { pvf, execution_timeout, params, priority, result_tx } => { + ToHost::ExecutePvf(inputs) => { handle_execute_pvf( cache_path, artifacts, prepare_queue, execute_queue, awaiting_prepare, - pvf, - execution_timeout, - params, - priority, - result_tx, + inputs, ) .await?; }, - ToHost::HeadsUp { active_pvfs } => { - handle_heads_up(artifacts, prepare_queue, active_pvfs).await?; - }, + ToHost::HeadsUp { active_pvfs } => + handle_heads_up(artifacts, prepare_queue, active_pvfs).await?, } Ok(()) } -/// Handles PVF prechecking. +/// Handles PVF prechecking requests. /// /// This tries to prepare the PVF by compiling the WASM blob within a given timeout ([`PRECHECK_COMPILATION_TIMEOUT`]). +/// +/// If the prepare job failed previously, we may retry it under certain conditions. async fn handle_precheck_pvf( artifacts: &mut Artifacts, prepare_queue: &mut mpsc::Sender, @@ -446,10 +460,12 @@ async fn handle_precheck_pvf( *last_time_needed = SystemTime::now(); let _ = result_sender.send(Ok(())); }, - ArtifactState::Preparing { waiting_for_response } => + ArtifactState::Preparing { waiting_for_response, num_failures: _ } => waiting_for_response.push(result_sender), - ArtifactState::FailedToProcess(result) => { - let _ = result_sender.send(PrepareResult::Err(result.clone())); + ArtifactState::FailedToProcess { error, .. } => { + // Do not retry failed preparation if another pre-check request comes in. We do not retry pre-checking, + // anyway. + let _ = result_sender.send(PrepareResult::Err(error.clone())); }, } } else { @@ -459,7 +475,7 @@ async fn handle_precheck_pvf( prepare::ToQueue::Enqueue { priority: Priority::Normal, pvf, - compilation_timeout: PRECHECK_COMPILATION_TIMEOUT, + preparation_timeout: PRECHECK_PREPARATION_TIMEOUT, }, ) .await?; @@ -469,21 +485,22 @@ async fn handle_precheck_pvf( /// Handles PVF execution. /// -/// This will first try to prepare the PVF, if a prepared artifact does not already exist. If there is already a -/// preparation job, we coalesce the two preparation jobs. When preparing for execution, we use a more lenient timeout -/// ([`EXECUTE_COMPILATION_TIMEOUT`]) than when prechecking. +/// This will try to prepare the PVF, if a prepared artifact does not already exist. If there is already a +/// preparation job, we coalesce the two preparation jobs. +/// +/// If the prepare job failed previously, we may retry it under certain conditions. +/// +/// When preparing for execution, we use a more lenient timeout ([`EXECUTE_COMPILATION_TIMEOUT`]) +/// than when prechecking. async fn handle_execute_pvf( cache_path: &Path, artifacts: &mut Artifacts, prepare_queue: &mut mpsc::Sender, execute_queue: &mut mpsc::Sender, awaiting_prepare: &mut AwaitingPrepare, - pvf: Pvf, - execution_timeout: Duration, - params: Vec, - priority: Priority, - result_tx: ResultSender, + inputs: ExecutePvfInputs, ) -> Result<(), Fatal> { + let ExecutePvfInputs { pvf, execution_timeout, params, priority, result_tx } = inputs; let artifact_id = pvf.as_artifact_id(); if let Some(state) = artifacts.artifact_state_mut(&artifact_id) { @@ -491,6 +508,7 @@ async fn handle_execute_pvf( ArtifactState::Prepared { last_time_needed } => { *last_time_needed = SystemTime::now(); + // This artifact has already been prepared, send it to the execute queue. send_execute( execute_queue, execute::ToQueue::Enqueue { @@ -502,11 +520,29 @@ async fn handle_execute_pvf( ) .await?; }, - ArtifactState::Preparing { waiting_for_response: _ } => { + ArtifactState::Preparing { .. } => { awaiting_prepare.add(artifact_id, execution_timeout, params, result_tx); }, - ArtifactState::FailedToProcess(error) => { - let _ = result_tx.send(Err(ValidationError::from(error.clone()))); + ArtifactState::FailedToProcess { last_time_failed, num_failures, error } => { + if can_retry_prepare_after_failure(*last_time_failed, *num_failures, error) { + // If we are allowed to retry the failed prepare job, change the state to + // Preparing and re-queue this job. + *state = ArtifactState::Preparing { + waiting_for_response: Vec::new(), + num_failures: *num_failures, + }; + send_prepare( + prepare_queue, + prepare::ToQueue::Enqueue { + priority, + pvf, + preparation_timeout: LENIENT_PREPARATION_TIMEOUT, + }, + ) + .await?; + } else { + let _ = result_tx.send(Err(ValidationError::from(error.clone()))); + } }, } } else { @@ -518,11 +554,12 @@ async fn handle_execute_pvf( prepare::ToQueue::Enqueue { priority, pvf, - compilation_timeout: EXECUTE_COMPILATION_TIMEOUT, + preparation_timeout: LENIENT_PREPARATION_TIMEOUT, }, ) .await?; + // Add an execution request that will wait to run after this prepare job has finished. awaiting_prepare.add(artifact_id, execution_timeout, params, result_tx); } @@ -543,10 +580,28 @@ async fn handle_heads_up( ArtifactState::Prepared { last_time_needed, .. } => { *last_time_needed = now; }, - ArtifactState::Preparing { waiting_for_response: _ } => { + ArtifactState::Preparing { .. } => { // The artifact is already being prepared, so we don't need to do anything. }, - ArtifactState::FailedToProcess(_) => {}, + ArtifactState::FailedToProcess { last_time_failed, num_failures, error } => { + if can_retry_prepare_after_failure(*last_time_failed, *num_failures, error) { + // If we are allowed to retry the failed prepare job, change the state to + // Preparing and re-queue this job. + *state = ArtifactState::Preparing { + waiting_for_response: vec![], + num_failures: *num_failures, + }; + send_prepare( + prepare_queue, + prepare::ToQueue::Enqueue { + priority: Priority::Normal, + pvf: active_pvf, + preparation_timeout: LENIENT_PREPARATION_TIMEOUT, + }, + ) + .await?; + } + }, } } else { // It's not in the artifacts, so we need to enqueue a job to prepare it. @@ -557,7 +612,7 @@ async fn handle_heads_up( prepare::ToQueue::Enqueue { priority: Priority::Normal, pvf: active_pvf, - compilation_timeout: EXECUTE_COMPILATION_TIMEOUT, + preparation_timeout: LENIENT_PREPARATION_TIMEOUT, }, ) .await?; @@ -596,20 +651,26 @@ async fn handle_prepare_done( never!("the artifact is already prepared: {:?}", artifact_id); return Ok(()) }, - Some(ArtifactState::FailedToProcess(_)) => { + Some(ArtifactState::FailedToProcess { .. }) => { // The reasoning is similar to the above, the artifact cannot be // processed at this point. never!("the artifact is already processed unsuccessfully: {:?}", artifact_id); return Ok(()) }, - Some(state @ ArtifactState::Preparing { waiting_for_response: _ }) => state, + Some(state @ ArtifactState::Preparing { .. }) => state, }; - if let ArtifactState::Preparing { waiting_for_response } = state { + let num_failures = if let ArtifactState::Preparing { waiting_for_response, num_failures } = + state + { for result_sender in waiting_for_response.drain(..) { let _ = result_sender.send(result.clone()); } - } + num_failures + } else { + never!("The reasoning is similar to the above, the artifact can only be preparing at this point; qed"); + return Ok(()) + }; // It's finally time to dispatch all the execution requests that were waiting for this artifact // to be prepared. @@ -641,7 +702,11 @@ async fn handle_prepare_done( *state = match result { Ok(()) => ArtifactState::Prepared { last_time_needed: SystemTime::now() }, - Err(error) => ArtifactState::FailedToProcess(error.clone()), + Err(error) => ArtifactState::FailedToProcess { + last_time_failed: SystemTime::now(), + num_failures: *num_failures + 1, + error: error.clone(), + }, }; Ok(()) @@ -704,6 +769,24 @@ async fn sweeper_task(mut sweeper_rx: mpsc::Receiver) { } } +/// Check if the conditions to retry a prepare job have been met. +fn can_retry_prepare_after_failure( + last_time_failed: SystemTime, + num_failures: u32, + error: &PrepareError, +) -> bool { + use PrepareError::*; + match error { + // Gracefully returned an error, so it will probably be reproducible. Don't retry. + Prevalidation(_) | Preparation(_) => false, + // Retry if the retry cooldown has elapsed and if we have already retried less than + // `NUM_PREPARE_RETRIES` times. + Panic(_) | TimedOut | DidNotMakeIt => + SystemTime::now() >= last_time_failed + PREPARE_FAILURE_COOLDOWN && + num_failures <= NUM_PREPARE_RETRIES, + } +} + /// A stream that yields a pulse continuously at a given interval. fn pulse_every(interval: std::time::Duration) -> impl futures::Stream { futures::stream::unfold(interval, { @@ -831,6 +914,25 @@ mod tests { .await } + async fn poll_ensure_to_prepare_queue_is_empty(&mut self) { + use futures_timer::Delay; + + let to_prepare_queue_rx = &mut self.to_prepare_queue_rx; + run_until( + &mut self.run, + async { + futures::select! { + _ = Delay::new(Duration::from_millis(500)).fuse() => (), + _ = to_prepare_queue_rx.next().fuse() => { + panic!("the prepare queue is supposed to be empty") + } + } + } + .boxed(), + ) + .await + } + async fn poll_ensure_to_execute_queue_is_empty(&mut self) { use futures_timer::Delay; @@ -841,7 +943,7 @@ mod tests { futures::select! { _ = Delay::new(Duration::from_millis(500)).fuse() => (), _ = to_execute_queue_rx.next().fuse() => { - panic!("the execute queue supposed to be empty") + panic!("the execute queue is supposed to be empty") } } } @@ -1165,6 +1267,228 @@ mod tests { } } + // Test that multiple prechecking requests do not trigger preparation retries if the first one + // failed. + #[async_std::test] + async fn test_precheck_prepare_retry() { + let mut test = Builder::default().build(); + let mut host = test.host_handle(); + + // Submit a precheck request that fails. + let (result_tx, _result_rx) = oneshot::channel(); + host.precheck_pvf(Pvf::from_discriminator(1), result_tx).await.unwrap(); + + // The queue received the prepare request. + assert_matches!( + test.poll_and_recv_to_prepare_queue().await, + prepare::ToQueue::Enqueue { .. } + ); + // Send a PrepareError. + test.from_prepare_queue_tx + .send(prepare::FromQueue { + artifact_id: artifact_id(1), + result: Err(PrepareError::TimedOut), + }) + .await + .unwrap(); + + // Submit another precheck request. + let (result_tx_2, _result_rx_2) = oneshot::channel(); + host.precheck_pvf(Pvf::from_discriminator(1), result_tx_2).await.unwrap(); + + // Assert the prepare queue is empty. + test.poll_ensure_to_prepare_queue_is_empty().await; + + // Pause for enough time to reset the cooldown for this failed prepare request. + futures_timer::Delay::new(PREPARE_FAILURE_COOLDOWN).await; + + // Submit another precheck request. + let (result_tx_3, _result_rx_3) = oneshot::channel(); + host.precheck_pvf(Pvf::from_discriminator(1), result_tx_3).await.unwrap(); + + // Assert the prepare queue is empty - we do not retry for precheck requests. + test.poll_ensure_to_prepare_queue_is_empty().await; + } + + // Test that multiple execution requests trigger preparation retries if the first one failed due + // to a potentially non-reproducible error. + #[async_std::test] + async fn test_execute_prepare_retry() { + let mut test = Builder::default().build(); + let mut host = test.host_handle(); + + // Submit a execute request that fails. + let (result_tx, _result_rx) = oneshot::channel(); + host.execute_pvf( + Pvf::from_discriminator(1), + TEST_EXECUTION_TIMEOUT, + b"pvf".to_vec(), + Priority::Critical, + result_tx, + ) + .await + .unwrap(); + + // The queue received the prepare request. + assert_matches!( + test.poll_and_recv_to_prepare_queue().await, + prepare::ToQueue::Enqueue { .. } + ); + // Send a PrepareError. + test.from_prepare_queue_tx + .send(prepare::FromQueue { + artifact_id: artifact_id(1), + result: Err(PrepareError::TimedOut), + }) + .await + .unwrap(); + + // Submit another execute request. + let (result_tx_2, _result_rx_2) = oneshot::channel(); + host.execute_pvf( + Pvf::from_discriminator(1), + TEST_EXECUTION_TIMEOUT, + b"pvf".to_vec(), + Priority::Critical, + result_tx_2, + ) + .await + .unwrap(); + + // Assert the prepare queue is empty. + test.poll_ensure_to_prepare_queue_is_empty().await; + + // Pause for enough time to reset the cooldown for this failed prepare request. + futures_timer::Delay::new(PREPARE_FAILURE_COOLDOWN).await; + + // Submit another execute request. + let (result_tx_3, _result_rx_3) = oneshot::channel(); + host.execute_pvf( + Pvf::from_discriminator(1), + TEST_EXECUTION_TIMEOUT, + b"pvf".to_vec(), + Priority::Critical, + result_tx_3, + ) + .await + .unwrap(); + + // Assert the prepare queue contains the request. + assert_matches!( + test.poll_and_recv_to_prepare_queue().await, + prepare::ToQueue::Enqueue { .. } + ); + } + + // Test that multiple execution requests don't trigger preparation retries if the first one + // failed due to reproducible error (e.g. Prevalidation). + #[async_std::test] + async fn test_execute_prepare_no_retry() { + let mut test = Builder::default().build(); + let mut host = test.host_handle(); + + // Submit a execute request that fails. + let (result_tx, _result_rx) = oneshot::channel(); + host.execute_pvf( + Pvf::from_discriminator(1), + TEST_EXECUTION_TIMEOUT, + b"pvf".to_vec(), + Priority::Critical, + result_tx, + ) + .await + .unwrap(); + + // The queue received the prepare request. + assert_matches!( + test.poll_and_recv_to_prepare_queue().await, + prepare::ToQueue::Enqueue { .. } + ); + // Send a PrepareError. + test.from_prepare_queue_tx + .send(prepare::FromQueue { + artifact_id: artifact_id(1), + result: Err(PrepareError::Prevalidation("reproducible error".into())), + }) + .await + .unwrap(); + + // Submit another execute request. + let (result_tx_2, _result_rx_2) = oneshot::channel(); + host.execute_pvf( + Pvf::from_discriminator(1), + TEST_EXECUTION_TIMEOUT, + b"pvf".to_vec(), + Priority::Critical, + result_tx_2, + ) + .await + .unwrap(); + + // Assert the prepare queue is empty. + test.poll_ensure_to_prepare_queue_is_empty().await; + + // Pause for enough time to reset the cooldown for this failed prepare request. + futures_timer::Delay::new(PREPARE_FAILURE_COOLDOWN).await; + + // Submit another execute request. + let (result_tx_3, _result_rx_3) = oneshot::channel(); + host.execute_pvf( + Pvf::from_discriminator(1), + TEST_EXECUTION_TIMEOUT, + b"pvf".to_vec(), + Priority::Critical, + result_tx_3, + ) + .await + .unwrap(); + + // Assert the prepare queue is empty - we do not retry for prevalidation errors. + test.poll_ensure_to_prepare_queue_is_empty().await; + } + + // Test that multiple heads-up requests trigger preparation retries if the first one failed. + #[async_std::test] + async fn test_heads_up_prepare_retry() { + let mut test = Builder::default().build(); + let mut host = test.host_handle(); + + // Submit a heads-up request that fails. + host.heads_up(vec![Pvf::from_discriminator(1)]).await.unwrap(); + + // The queue received the prepare request. + assert_matches!( + test.poll_and_recv_to_prepare_queue().await, + prepare::ToQueue::Enqueue { .. } + ); + // Send a PrepareError. + test.from_prepare_queue_tx + .send(prepare::FromQueue { + artifact_id: artifact_id(1), + result: Err(PrepareError::TimedOut), + }) + .await + .unwrap(); + + // Submit another heads-up request. + host.heads_up(vec![Pvf::from_discriminator(1)]).await.unwrap(); + + // Assert the prepare queue is empty. + test.poll_ensure_to_prepare_queue_is_empty().await; + + // Pause for enough time to reset the cooldown for this failed prepare request. + futures_timer::Delay::new(PREPARE_FAILURE_COOLDOWN).await; + + // Submit another heads-up request. + host.heads_up(vec![Pvf::from_discriminator(1)]).await.unwrap(); + + // Assert the prepare queue contains the request. + assert_matches!( + test.poll_and_recv_to_prepare_queue().await, + prepare::ToQueue::Enqueue { .. } + ); + } + #[async_std::test] async fn cancellation() { let mut test = Builder::default().build(); diff --git a/node/core/pvf/src/metrics.rs b/node/core/pvf/src/metrics.rs index 547ee65f3e9d..20965ec7dbd7 100644 --- a/node/core/pvf/src/metrics.rs +++ b/node/core/pvf/src/metrics.rs @@ -155,8 +155,8 @@ impl metrics::Metrics for Metrics { "Time spent in preparing PVF artifacts in seconds", ) .buckets(vec![ - // This is synchronized with the PRECHECK_COMPILATION_TIMEOUT=60s - // and EXECUTE_COMPILATION_TIMEOUT=180s constants found in + // This is synchronized with the PRECHECK_PREPARATION_TIMEOUT=60s + // and LENIENT_PREPARATION_TIMEOUT=360s constants found in // src/prepare/worker.rs 0.1, 0.5, @@ -167,7 +167,10 @@ impl metrics::Metrics for Metrics { 20.0, 30.0, 60.0, - 180.0, + 120.0, + 240.0, + 360.0, + 480.0, ]), )?, registry, diff --git a/node/core/pvf/src/prepare/pool.rs b/node/core/pvf/src/prepare/pool.rs index fad6ed167614..9ba64be97555 100644 --- a/node/core/pvf/src/prepare/pool.rs +++ b/node/core/pvf/src/prepare/pool.rs @@ -65,7 +65,7 @@ pub enum ToPool { worker: Worker, code: Arc>, artifact_path: PathBuf, - compilation_timeout: Duration, + preparation_timeout: Duration, }, } @@ -210,7 +210,7 @@ fn handle_to_pool( metrics.prepare_worker().on_begin_spawn(); mux.push(spawn_worker_task(program_path.to_owned(), spawn_timeout).boxed()); }, - ToPool::StartWork { worker, code, artifact_path, compilation_timeout } => { + ToPool::StartWork { worker, code, artifact_path, preparation_timeout } => { if let Some(data) = spawned.get_mut(worker) { if let Some(idle) = data.idle.take() { let preparation_timer = metrics.time_preparation(); @@ -221,7 +221,7 @@ fn handle_to_pool( code, cache_path.to_owned(), artifact_path, - compilation_timeout, + preparation_timeout, preparation_timer, ) .boxed(), @@ -269,11 +269,11 @@ async fn start_work_task( code: Arc>, cache_path: PathBuf, artifact_path: PathBuf, - compilation_timeout: Duration, + preparation_timeout: Duration, _preparation_timer: Option, ) -> PoolEvent { let outcome = - worker::start_work(idle, code, &cache_path, artifact_path, compilation_timeout).await; + worker::start_work(idle, code, &cache_path, artifact_path, preparation_timeout).await; PoolEvent::StartWork(worker, outcome) } diff --git a/node/core/pvf/src/prepare/queue.rs b/node/core/pvf/src/prepare/queue.rs index a77b88e00345..ae0757d80461 100644 --- a/node/core/pvf/src/prepare/queue.rs +++ b/node/core/pvf/src/prepare/queue.rs @@ -33,7 +33,7 @@ pub enum ToQueue { /// /// Note that it is incorrect to enqueue the same PVF again without first receiving the /// [`FromQueue`] response. - Enqueue { priority: Priority, pvf: Pvf, compilation_timeout: Duration }, + Enqueue { priority: Priority, pvf: Pvf, preparation_timeout: Duration }, } /// A response from queue. @@ -80,7 +80,7 @@ struct JobData { priority: Priority, pvf: Pvf, /// The timeout for the preparation job. - compilation_timeout: Duration, + preparation_timeout: Duration, worker: Option, } @@ -208,8 +208,8 @@ impl Queue { async fn handle_to_queue(queue: &mut Queue, to_queue: ToQueue) -> Result<(), Fatal> { match to_queue { - ToQueue::Enqueue { priority, pvf, compilation_timeout } => { - handle_enqueue(queue, priority, pvf, compilation_timeout).await?; + ToQueue::Enqueue { priority, pvf, preparation_timeout } => { + handle_enqueue(queue, priority, pvf, preparation_timeout).await?; }, } Ok(()) @@ -219,13 +219,13 @@ async fn handle_enqueue( queue: &mut Queue, priority: Priority, pvf: Pvf, - compilation_timeout: Duration, + preparation_timeout: Duration, ) -> Result<(), Fatal> { gum::debug!( target: LOG_TARGET, validation_code_hash = ?pvf.code_hash, ?priority, - ?compilation_timeout, + ?preparation_timeout, "PVF is enqueued for preparation.", ); queue.metrics.prepare_enqueued(); @@ -247,7 +247,7 @@ async fn handle_enqueue( return Ok(()) } - let job = queue.jobs.insert(JobData { priority, pvf, compilation_timeout, worker: None }); + let job = queue.jobs.insert(JobData { priority, pvf, preparation_timeout, worker: None }); queue.artifact_id_to_job.insert(artifact_id, job); if let Some(available) = find_idle_worker(queue) { @@ -439,7 +439,7 @@ async fn assign(queue: &mut Queue, worker: Worker, job: Job) -> Result<(), Fatal worker, code: job_data.pvf.code.clone(), artifact_path, - compilation_timeout: job_data.compilation_timeout, + preparation_timeout: job_data.preparation_timeout, }, ) .await?; @@ -494,7 +494,7 @@ pub fn start( #[cfg(test)] mod tests { use super::*; - use crate::{error::PrepareError, host::PRECHECK_COMPILATION_TIMEOUT}; + use crate::{error::PrepareError, host::PRECHECK_PREPARATION_TIMEOUT}; use assert_matches::assert_matches; use futures::{future::BoxFuture, FutureExt}; use slotmap::SlotMap; @@ -612,7 +612,7 @@ mod tests { test.send_queue(ToQueue::Enqueue { priority: Priority::Normal, pvf: pvf(1), - compilation_timeout: PRECHECK_COMPILATION_TIMEOUT, + preparation_timeout: PRECHECK_PREPARATION_TIMEOUT, }); assert_eq!(test.poll_and_recv_to_pool().await, pool::ToPool::Spawn); @@ -626,12 +626,12 @@ mod tests { #[async_std::test] async fn dont_spawn_over_soft_limit_unless_critical() { let mut test = Test::new(2, 3); - let compilation_timeout = PRECHECK_COMPILATION_TIMEOUT; + let preparation_timeout = PRECHECK_PREPARATION_TIMEOUT; let priority = Priority::Normal; - test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(1), compilation_timeout }); - test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(2), compilation_timeout }); - test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(3), compilation_timeout }); + test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(1), preparation_timeout }); + test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(2), preparation_timeout }); + test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(3), preparation_timeout }); // Receive only two spawns. assert_eq!(test.poll_and_recv_to_pool().await, pool::ToPool::Spawn); @@ -655,7 +655,7 @@ mod tests { test.send_queue(ToQueue::Enqueue { priority: Priority::Critical, pvf: pvf(4), - compilation_timeout, + preparation_timeout, }); // 2 out of 2 are working, but there is a critical job incoming. That means that spawning @@ -666,12 +666,12 @@ mod tests { #[async_std::test] async fn cull_unwanted() { let mut test = Test::new(1, 2); - let compilation_timeout = PRECHECK_COMPILATION_TIMEOUT; + let preparation_timeout = PRECHECK_PREPARATION_TIMEOUT; test.send_queue(ToQueue::Enqueue { priority: Priority::Normal, pvf: pvf(1), - compilation_timeout, + preparation_timeout, }); assert_eq!(test.poll_and_recv_to_pool().await, pool::ToPool::Spawn); let w1 = test.workers.insert(()); @@ -682,7 +682,7 @@ mod tests { test.send_queue(ToQueue::Enqueue { priority: Priority::Critical, pvf: pvf(2), - compilation_timeout, + preparation_timeout, }); assert_eq!(test.poll_and_recv_to_pool().await, pool::ToPool::Spawn); @@ -701,10 +701,10 @@ mod tests { async fn worker_mass_die_out_doesnt_stall_queue() { let mut test = Test::new(2, 2); - let (priority, compilation_timeout) = (Priority::Normal, PRECHECK_COMPILATION_TIMEOUT); - test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(1), compilation_timeout }); - test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(2), compilation_timeout }); - test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(3), compilation_timeout }); + let (priority, preparation_timeout) = (Priority::Normal, PRECHECK_PREPARATION_TIMEOUT); + test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(1), preparation_timeout }); + test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(2), preparation_timeout }); + test.send_queue(ToQueue::Enqueue { priority, pvf: pvf(3), preparation_timeout }); assert_eq!(test.poll_and_recv_to_pool().await, pool::ToPool::Spawn); assert_eq!(test.poll_and_recv_to_pool().await, pool::ToPool::Spawn); @@ -734,7 +734,7 @@ mod tests { test.send_queue(ToQueue::Enqueue { priority: Priority::Normal, pvf: pvf(1), - compilation_timeout: PRECHECK_COMPILATION_TIMEOUT, + preparation_timeout: PRECHECK_PREPARATION_TIMEOUT, }); assert_eq!(test.poll_and_recv_to_pool().await, pool::ToPool::Spawn); @@ -759,7 +759,7 @@ mod tests { test.send_queue(ToQueue::Enqueue { priority: Priority::Normal, pvf: pvf(1), - compilation_timeout: PRECHECK_COMPILATION_TIMEOUT, + preparation_timeout: PRECHECK_PREPARATION_TIMEOUT, }); assert_eq!(test.poll_and_recv_to_pool().await, pool::ToPool::Spawn); diff --git a/node/core/pvf/src/prepare/worker.rs b/node/core/pvf/src/prepare/worker.rs index 77570b47360b..1cf512894740 100644 --- a/node/core/pvf/src/prepare/worker.rs +++ b/node/core/pvf/src/prepare/worker.rs @@ -65,7 +65,7 @@ pub async fn start_work( code: Arc>, cache_path: &Path, artifact_path: PathBuf, - compilation_timeout: Duration, + preparation_timeout: Duration, ) -> Outcome { let IdleWorker { mut stream, pid } = worker; @@ -100,7 +100,7 @@ pub async fn start_work( } let selected = - match async_std::future::timeout(compilation_timeout, framed_recv(&mut stream)).await { + match async_std::future::timeout(preparation_timeout, framed_recv(&mut stream)).await { Ok(Ok(response_bytes)) => { // Received bytes from worker within the time limit. // By convention we expect encoded `PrepareResult`. diff --git a/node/core/pvf/src/pvf.rs b/node/core/pvf/src/pvf.rs index 901cc1c70d6e..d06968a13d43 100644 --- a/node/core/pvf/src/pvf.rs +++ b/node/core/pvf/src/pvf.rs @@ -19,7 +19,7 @@ use polkadot_parachain::primitives::ValidationCodeHash; use sp_core::blake2_256; use std::{fmt, sync::Arc}; -/// A struct that carries code of a parachain validation function and it's hash. +/// A struct that carries code of a parachain validation function and its hash. /// /// Should be cheap to clone. #[derive(Clone)] diff --git a/node/core/pvf/src/worker_common.rs b/node/core/pvf/src/worker_common.rs index 8614b07d8166..572e3717832b 100644 --- a/node/core/pvf/src/worker_common.rs +++ b/node/core/pvf/src/worker_common.rs @@ -200,7 +200,7 @@ pub enum SpawnErr { /// This is a representation of a potentially running worker. Drop it and the process will be killed. /// /// A worker's handle is also a future that resolves when it's detected that the worker's process -/// has been terminated. Since the worker is running in another process it is obviously not necessarily +/// has been terminated. Since the worker is running in another process it is obviously not necessary /// to poll this future to make the worker run, it's only for termination detection. /// /// This future relies on the fact that a child process's stdout `fd` is closed upon it's termination. @@ -209,6 +209,7 @@ pub struct WorkerHandle { child: async_process::Child, #[pin] stdout: async_process::ChildStdout, + program: PathBuf, drop_box: Box<[u8]>, } @@ -233,6 +234,7 @@ impl WorkerHandle { Ok(WorkerHandle { child, stdout, + program: program.as_ref().to_path_buf(), // We don't expect the bytes to be ever read. But in case we do, we should not use a buffer // of a small size, because otherwise if the child process does return any data we will end up // issuing a syscall for each byte. We also prefer not to do allocate that on the stack, since @@ -267,9 +269,19 @@ impl futures::Future for WorkerHandle { cx.waker().wake_by_ref(); Poll::Pending }, - Err(_) => { + Err(err) => { // The implementation is guaranteed to not to return `WouldBlock` and Interrupted. This - // leaves us with a legit errors which we suppose were due to termination. + // leaves us with legit errors which we suppose were due to termination. + + // Log the status code. + gum::debug!( + target: LOG_TARGET, + worker_pid = %me.child.id(), + status_code = ?me.child.try_status(), + "pvf worker ({}): {:?}", + me.program.display(), + err, + ); Poll::Ready(()) }, } diff --git a/node/core/runtime-api/src/tests.rs b/node/core/runtime-api/src/tests.rs index 45286431e49d..81629d5b2754 100644 --- a/node/core/runtime-api/src/tests.rs +++ b/node/core/runtime-api/src/tests.rs @@ -89,7 +89,7 @@ sp_api::mock_impl_runtime_apis! { } fn availability_cores(&self) -> Vec { - let _ = self.availability_cores_wait.lock().unwrap(); + let _lock = self.availability_cores_wait.lock().unwrap(); self.availability_cores.clone() } diff --git a/node/primitives/src/lib.rs b/node/primitives/src/lib.rs index 4551ce9855e3..e75181b900e9 100644 --- a/node/primitives/src/lib.rs +++ b/node/primitives/src/lib.rs @@ -71,7 +71,7 @@ pub const BACKING_EXECUTION_TIMEOUT: Duration = Duration::from_secs(2); /// /// This is deliberately much longer than the backing execution timeout to /// ensure that in the absence of extremely large disparities between hardware, -/// blocks that pass backing are considerd executable by approval checkers or +/// blocks that pass backing are considered executable by approval checkers or /// dispute participants. pub const APPROVAL_EXECUTION_TIMEOUT: Duration = Duration::from_secs(12); @@ -90,9 +90,7 @@ pub const MAX_FINALITY_LAG: u32 = 500; pub struct SessionWindowSize(SessionIndex); #[macro_export] -/// Create a new checked `SessionWindowSize` -/// -/// which cannot be 0. +/// Create a new checked `SessionWindowSize` which cannot be 0. macro_rules! new_session_window_size { (0) => { compile_error!("Must be non zero"); diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 82109f2e6ce4..e6e073546a13 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -71,7 +71,8 @@ serde_json = "1.0.81" thiserror = "1.0.31" kvdb = "0.12.0" kvdb-rocksdb = { version = "0.16.0", optional = true } -parity-db = { version = "0.3.16", optional = true } +parity-db = { version = "0.4.2", optional = true } + async-trait = "0.1.57" lru = "0.8" diff --git a/node/service/chain-specs/kusama.json b/node/service/chain-specs/kusama.json index ec1b8aa0503a..5d369a723dfb 100644 --- a/node/service/chain-specs/kusama.json +++ b/node/service/chain-specs/kusama.json @@ -19,7 +19,9 @@ "/dns/kusama-bootnode-0.paritytech.net/tcp/30333/p2p/12D3KooWSueCPH3puP2PcvqPJdNaDNF3jMZjtJtDiSy35pWrbt5h", "/dns/kusama-bootnode-0.paritytech.net/tcp/30334/ws/p2p/12D3KooWSueCPH3puP2PcvqPJdNaDNF3jMZjtJtDiSy35pWrbt5h", "/dns/kusama-bootnode-1.paritytech.net/tcp/30333/p2p/12D3KooWQKqane1SqWJNWMQkbia9qiMWXkcHtAdfW5eVF8hbwEDw", - "/dns/kusama-bootnode.dwellir.com/tcp/30333/ws/p2p/12D3KooWFj2ndawdYyk2spc42Y2arYwb2TUoHLHFAsKuHRzWXwoJ" + "/dns/kusama-bootnode.dwellir.com/tcp/30333/ws/p2p/12D3KooWFj2ndawdYyk2spc42Y2arYwb2TUoHLHFAsKuHRzWXwoJ", + "/dns/boot.stake.plus/tcp/31333/p2p/12D3KooWLa1UyG5xLPds2GbiRBCTJjpsVwRWHWN7Dff14yiNJRpR", + "/dns/boot.stake.plus/tcp/31334/wss/p2p/12D3KooWLa1UyG5xLPds2GbiRBCTJjpsVwRWHWN7Dff14yiNJRpR" ], "telemetryEndpoints": [ [ diff --git a/node/service/chain-specs/polkadot.json b/node/service/chain-specs/polkadot.json index af4d42301c70..1a5ef94987de 100644 --- a/node/service/chain-specs/polkadot.json +++ b/node/service/chain-specs/polkadot.json @@ -19,7 +19,9 @@ "/dns/p2p.5.polkadot.network/tcp/30333/p2p/12D3KooWSRjL9LcEQd5u2fQTbyLxTEHq1tUFgQ6amXSp8Eu7TfKP", "/dns/cc1-0.parity.tech/tcp/30333/p2p/12D3KooWSz8r2WyCdsfWHgPyvD8GKQdJ1UAiRmrcrs8sQB3fe2KU", "/dns/cc1-1.parity.tech/tcp/30333/p2p/12D3KooWFN2mhgpkJsDBuNuE5427AcDrsib8EoqGMZmkxWwx3Md4", - "/dns/polkadot-bootnode.dwellir.com/tcp/30333/ws/p2p/12D3KooWKvdDyRKqUfSAaUCbYiLwKY8uK3wDWpCuy2FiDLbkPTDJ" + "/dns/polkadot-bootnode.dwellir.com/tcp/30333/ws/p2p/12D3KooWKvdDyRKqUfSAaUCbYiLwKY8uK3wDWpCuy2FiDLbkPTDJ", + "/dns/boot.stake.plus/tcp/30333/p2p/12D3KooWKT4ZHNxXH4icMjdrv7EwWBkfbz5duxE5sdJKKeWFYi5n", + "/dns/boot.stake.plus/tcp/30334/wss/p2p/12D3KooWKT4ZHNxXH4icMjdrv7EwWBkfbz5duxE5sdJKKeWFYi5n" ], "telemetryEndpoints": [ [ diff --git a/node/service/chain-specs/westend.json b/node/service/chain-specs/westend.json index c183622d66c9..03f1f5ecf6b0 100644 --- a/node/service/chain-specs/westend.json +++ b/node/service/chain-specs/westend.json @@ -11,7 +11,9 @@ "/dns/3.westend.paritytech.net/tcp/30333/p2p/12D3KooWGi1tCpKXLMYED9y28QXLnwgD4neYb1Arqq4QpeV1Sv3K", "/dns/3.westend.paritytech.net/tcp/30334/ws/p2p/12D3KooWGi1tCpKXLMYED9y28QXLnwgD4neYb1Arqq4QpeV1Sv3K", "/dns/westend-connect-0.polkadot.io/tcp/443/wss/p2p/12D3KooWNg8iUqhux7X7voNU9Nty5pzehrFJwkQwg1CJnqN3CTzE", - "/dns/westend-connect-1.polkadot.io/tcp/443/wss/p2p/12D3KooWAq2A7UNFS6725XFatD5QW7iYBezTLdAUx1SmRkxN79Ne" + "/dns/westend-connect-1.polkadot.io/tcp/443/wss/p2p/12D3KooWAq2A7UNFS6725XFatD5QW7iYBezTLdAUx1SmRkxN79Ne", + "/dns/boot.stake.plus/tcp/32333/p2p/12D3KooWK8fjVoSvMq5copQYMsdYreSGPGgcMbGMgbMDPfpf3sm7", + "/dns/boot.stake.plus/tcp/32334/wss/p2p/12D3KooWK8fjVoSvMq5copQYMsdYreSGPGgcMbGMgbMDPfpf3sm7" ], "telemetryEndpoints": [ [ diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 3619d05c7592..18218a8aba8e 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -943,7 +943,8 @@ where let parachains_db = open_database(&config.database)?; let approval_voting_config = ApprovalVotingConfig { - col_data: parachains_db::REAL_COLUMNS.col_approval_data, + col_approval_data: parachains_db::REAL_COLUMNS.col_approval_data, + col_session_data: parachains_db::REAL_COLUMNS.col_session_window_data, slot_duration_millis: slot_duration.as_millis() as u64, }; @@ -966,7 +967,8 @@ where }; let dispute_coordinator_config = DisputeCoordinatorConfig { - col_data: parachains_db::REAL_COLUMNS.col_dispute_coordinator_data, + col_dispute_data: parachains_db::REAL_COLUMNS.col_dispute_coordinator_data, + col_session_data: parachains_db::REAL_COLUMNS.col_session_window_data, }; let rpc_handlers = service::spawn_tasks(service::SpawnTasksParams { @@ -1537,7 +1539,8 @@ fn revert_chain_selection(db: Arc, hash: Hash) -> sp_blockchain::R fn revert_approval_voting(db: Arc, hash: Hash) -> sp_blockchain::Result<()> { let config = approval_voting_subsystem::Config { - col_data: parachains_db::REAL_COLUMNS.col_approval_data, + col_approval_data: parachains_db::REAL_COLUMNS.col_approval_data, + col_session_data: parachains_db::REAL_COLUMNS.col_session_window_data, slot_duration_millis: Default::default(), }; diff --git a/node/service/src/parachains_db/mod.rs b/node/service/src/parachains_db/mod.rs index de12a8ac1a32..74e7e13dc657 100644 --- a/node/service/src/parachains_db/mod.rs +++ b/node/service/src/parachains_db/mod.rs @@ -23,6 +23,7 @@ mod upgrade; const LOG_TARGET: &str = "parachain::db"; +/// Column configuration per version. #[cfg(any(test, feature = "full-node"))] pub(crate) mod columns { pub mod v0 { @@ -31,12 +32,17 @@ pub(crate) mod columns { pub mod v1 { pub const NUM_COLUMNS: u32 = 5; + } + pub mod v2 { + pub const NUM_COLUMNS: u32 = 6; pub const COL_AVAILABILITY_DATA: u32 = 0; pub const COL_AVAILABILITY_META: u32 = 1; pub const COL_APPROVAL_DATA: u32 = 2; pub const COL_CHAIN_SELECTION_DATA: u32 = 3; pub const COL_DISPUTE_COORDINATOR_DATA: u32 = 4; + pub const COL_SESSION_WINDOW_DATA: u32 = 5; + pub const ORDERED_COL: &[u32] = &[COL_AVAILABILITY_META, COL_CHAIN_SELECTION_DATA, COL_DISPUTE_COORDINATOR_DATA]; } @@ -56,16 +62,19 @@ pub struct ColumnsConfig { pub col_chain_selection_data: u32, /// The column used by dispute coordinator for data. pub col_dispute_coordinator_data: u32, + /// The column used for session window data. + pub col_session_window_data: u32, } /// The real columns used by the parachains DB. #[cfg(any(test, feature = "full-node"))] pub const REAL_COLUMNS: ColumnsConfig = ColumnsConfig { - col_availability_data: columns::v1::COL_AVAILABILITY_DATA, - col_availability_meta: columns::v1::COL_AVAILABILITY_META, - col_approval_data: columns::v1::COL_APPROVAL_DATA, - col_chain_selection_data: columns::v1::COL_CHAIN_SELECTION_DATA, - col_dispute_coordinator_data: columns::v1::COL_DISPUTE_COORDINATOR_DATA, + col_availability_data: columns::v2::COL_AVAILABILITY_DATA, + col_availability_meta: columns::v2::COL_AVAILABILITY_META, + col_approval_data: columns::v2::COL_APPROVAL_DATA, + col_chain_selection_data: columns::v2::COL_CHAIN_SELECTION_DATA, + col_dispute_coordinator_data: columns::v2::COL_DISPUTE_COORDINATOR_DATA, + col_session_window_data: columns::v2::COL_SESSION_WINDOW_DATA, }; #[derive(PartialEq)] @@ -83,11 +92,18 @@ pub struct CacheSizes { pub availability_meta: usize, /// Cache used by approval data. pub approval_data: usize, + /// Cache used by session window data + pub session_data: usize, } impl Default for CacheSizes { fn default() -> Self { - CacheSizes { availability_data: 25, availability_meta: 1, approval_data: 5 } + CacheSizes { + availability_data: 25, + availability_meta: 1, + approval_data: 5, + session_data: 1, + } } } @@ -106,17 +122,20 @@ pub fn open_creating_rocksdb( let path = root.join("parachains").join("db"); - let mut db_config = DatabaseConfig::with_columns(columns::v1::NUM_COLUMNS); + let mut db_config = DatabaseConfig::with_columns(columns::v2::NUM_COLUMNS); let _ = db_config .memory_budget - .insert(columns::v1::COL_AVAILABILITY_DATA, cache_sizes.availability_data); + .insert(columns::v2::COL_AVAILABILITY_DATA, cache_sizes.availability_data); + let _ = db_config + .memory_budget + .insert(columns::v2::COL_AVAILABILITY_META, cache_sizes.availability_meta); let _ = db_config .memory_budget - .insert(columns::v1::COL_AVAILABILITY_META, cache_sizes.availability_meta); + .insert(columns::v2::COL_APPROVAL_DATA, cache_sizes.approval_data); let _ = db_config .memory_budget - .insert(columns::v1::COL_APPROVAL_DATA, cache_sizes.approval_data); + .insert(columns::v2::COL_SESSION_WINDOW_DATA, cache_sizes.session_data); let path_str = path .to_str() @@ -127,7 +146,7 @@ pub fn open_creating_rocksdb( let db = Database::open(&db_config, &path_str)?; let db = polkadot_node_subsystem_util::database::kvdb_impl::DbAdapter::new( db, - columns::v1::ORDERED_COL, + columns::v2::ORDERED_COL, ); Ok(Arc::new(db)) @@ -147,12 +166,12 @@ pub fn open_creating_paritydb( std::fs::create_dir_all(&path_str)?; upgrade::try_upgrade_db(&path, DatabaseKind::ParityDB)?; - let db = parity_db::Db::open_or_create(&upgrade::paritydb_version_1_config(&path)) + let db = parity_db::Db::open_or_create(&upgrade::paritydb_version_2_config(&path)) .map_err(|err| io::Error::new(io::ErrorKind::Other, format!("{:?}", err)))?; let db = polkadot_node_subsystem_util::database::paritydb_impl::DbAdapter::new( db, - columns::v1::ORDERED_COL, + columns::v2::ORDERED_COL, ); Ok(Arc::new(db)) } diff --git a/node/service/src/parachains_db/upgrade.rs b/node/service/src/parachains_db/upgrade.rs index 73321ae04c09..01d4fb62f7f6 100644 --- a/node/service/src/parachains_db/upgrade.rs +++ b/node/service/src/parachains_db/upgrade.rs @@ -28,7 +28,7 @@ type Version = u32; const VERSION_FILE_NAME: &'static str = "parachain_db_version"; /// Current db version. -const CURRENT_VERSION: Version = 1; +const CURRENT_VERSION: Version = 2; #[derive(thiserror::Error, Debug)] pub enum Error { @@ -36,7 +36,7 @@ pub enum Error { Io(#[from] io::Error), #[error("The version file format is incorrect")] CorruptedVersionFile, - #[error("Future version (expected {current:?}, found {got:?})")] + #[error("Parachains DB has a future version (expected {current:?}, found {got:?})")] FutureVersion { current: Version, got: Version }, } @@ -56,6 +56,8 @@ pub(crate) fn try_upgrade_db(db_path: &Path, db_kind: DatabaseKind) -> Result<() match get_db_version(db_path)? { // 0 -> 1 migration Some(0) => migrate_from_version_0_to_1(db_path, db_kind)?, + // 1 -> 2 migration + Some(1) => migrate_from_version_1_to_2(db_path, db_kind)?, // Already at current version, do nothing. Some(CURRENT_VERSION) => (), // This is an arbitrary future version, we don't handle it. @@ -112,6 +114,19 @@ fn migrate_from_version_0_to_1(path: &Path, db_kind: DatabaseKind) -> Result<(), }) } +fn migrate_from_version_1_to_2(path: &Path, db_kind: DatabaseKind) -> Result<(), Error> { + gum::info!(target: LOG_TARGET, "Migrating parachains db from version 1 to version 2 ..."); + + match db_kind { + DatabaseKind::ParityDB => paritydb_migrate_from_version_1_to_2(path), + DatabaseKind::RocksDB => rocksdb_migrate_from_version_1_to_2(path), + } + .and_then(|result| { + gum::info!(target: LOG_TARGET, "Migration complete! "); + Ok(result) + }) +} + /// Migration from version 0 to version 1: /// * the number of columns has changed from 3 to 5; fn rocksdb_migrate_from_version_0_to_1(path: &Path) -> Result<(), Error> { @@ -129,6 +144,22 @@ fn rocksdb_migrate_from_version_0_to_1(path: &Path) -> Result<(), Error> { Ok(()) } +/// Migration from version 1 to version 2: +/// * the number of columns has changed from 5 to 6; +fn rocksdb_migrate_from_version_1_to_2(path: &Path) -> Result<(), Error> { + use kvdb_rocksdb::{Database, DatabaseConfig}; + + let db_path = path + .to_str() + .ok_or_else(|| super::other_io_error("Invalid database path".into()))?; + let db_cfg = DatabaseConfig::with_columns(super::columns::v1::NUM_COLUMNS); + let mut db = Database::open(&db_cfg, db_path)?; + + db.add_column()?; + + Ok(()) +} + // This currently clears columns which had their configs altered between versions. // The columns to be changed are constrained by the `allowed_columns` vector. fn paritydb_fix_columns( @@ -190,7 +221,18 @@ fn paritydb_fix_columns( pub(crate) fn paritydb_version_1_config(path: &Path) -> parity_db::Options { let mut options = parity_db::Options::with_columns(&path, super::columns::v1::NUM_COLUMNS as u8); - for i in columns::v1::ORDERED_COL { + for i in columns::v2::ORDERED_COL { + options.columns[*i as usize].btree_index = true; + } + + options +} + +/// Database configuration for version 2. +pub(crate) fn paritydb_version_2_config(path: &Path) -> parity_db::Options { + let mut options = + parity_db::Options::with_columns(&path, super::columns::v2::NUM_COLUMNS as u8); + for i in columns::v2::ORDERED_COL { options.columns[*i as usize].btree_index = true; } @@ -202,8 +244,8 @@ pub(crate) fn paritydb_version_1_config(path: &Path) -> parity_db::Options { pub(crate) fn paritydb_version_0_config(path: &Path) -> parity_db::Options { let mut options = parity_db::Options::with_columns(&path, super::columns::v1::NUM_COLUMNS as u8); - options.columns[super::columns::v1::COL_AVAILABILITY_META as usize].btree_index = true; - options.columns[super::columns::v1::COL_CHAIN_SELECTION_DATA as usize].btree_index = true; + options.columns[super::columns::v2::COL_AVAILABILITY_META as usize].btree_index = true; + options.columns[super::columns::v2::COL_CHAIN_SELECTION_DATA as usize].btree_index = true; options } @@ -218,17 +260,30 @@ fn paritydb_migrate_from_version_0_to_1(path: &Path) -> Result<(), Error> { paritydb_fix_columns( path, paritydb_version_1_config(path), - vec![super::columns::v1::COL_DISPUTE_COORDINATOR_DATA], + vec![super::columns::v2::COL_DISPUTE_COORDINATOR_DATA], )?; Ok(()) } +/// Migration from version 1 to version 2: +/// - add a new column for session information storage +fn paritydb_migrate_from_version_1_to_2(path: &Path) -> Result<(), Error> { + let mut options = paritydb_version_1_config(path); + + // Adds the session info column. + parity_db::Db::add_column(&mut options, Default::default()) + .map_err(|e| other_io_error(format!("Error adding column {:?}", e)))?; + + Ok(()) +} + #[cfg(test)] mod tests { + use super::{columns::v2::*, *}; + #[test] - fn test_paritydb_migrate_0_1() { - use super::{columns::v1::*, *}; + fn test_paritydb_migrate_0_to_1() { use parity_db::Db; let db_dir = tempfile::tempdir().unwrap(); @@ -246,13 +301,119 @@ mod tests { try_upgrade_db(&path, DatabaseKind::ParityDB).unwrap(); let db = Db::open(&paritydb_version_1_config(&path)).unwrap(); + assert_eq!(db.get(COL_DISPUTE_COORDINATOR_DATA as u8, b"1234").unwrap(), None); assert_eq!( - db.get(super::columns::v1::COL_DISPUTE_COORDINATOR_DATA as u8, b"1234").unwrap(), - None + db.get(COL_AVAILABILITY_META as u8, b"5678").unwrap(), + Some("somevalue".as_bytes().to_vec()) ); + } + + #[test] + fn test_paritydb_migrate_1_to_2() { + use parity_db::Db; + + let db_dir = tempfile::tempdir().unwrap(); + let path = db_dir.path(); + + // We need to properly set db version for upgrade to work. + fs::write(version_file_path(path), "1").expect("Failed to write DB version"); + + { + let db = Db::open_or_create(&paritydb_version_1_config(&path)).unwrap(); + + // Write some dummy data + db.commit(vec![( + COL_DISPUTE_COORDINATOR_DATA as u8, + b"1234".to_vec(), + Some(b"somevalue".to_vec()), + )]) + .unwrap(); + + assert_eq!(db.num_columns(), columns::v1::NUM_COLUMNS as u8); + } + + try_upgrade_db(&path, DatabaseKind::ParityDB).unwrap(); + + let db = Db::open(&paritydb_version_2_config(&path)).unwrap(); + + assert_eq!(db.num_columns(), columns::v2::NUM_COLUMNS as u8); + assert_eq!( - db.get(super::columns::v1::COL_AVAILABILITY_META as u8, b"5678").unwrap(), + db.get(COL_DISPUTE_COORDINATOR_DATA as u8, b"1234").unwrap(), Some("somevalue".as_bytes().to_vec()) ); + + // Test we can write the new column. + db.commit(vec![( + COL_SESSION_WINDOW_DATA as u8, + b"1337".to_vec(), + Some(b"0xdeadb00b".to_vec()), + )]) + .unwrap(); + + // Read back data from new column. + assert_eq!( + db.get(COL_SESSION_WINDOW_DATA as u8, b"1337").unwrap(), + Some("0xdeadb00b".as_bytes().to_vec()) + ); + } + + #[test] + fn test_rocksdb_migrate_1_to_2() { + use kvdb::{DBKey, DBOp}; + use kvdb_rocksdb::{Database, DatabaseConfig}; + use polkadot_node_subsystem_util::database::{ + kvdb_impl::DbAdapter, DBTransaction, KeyValueDB, + }; + + let db_dir = tempfile::tempdir().unwrap(); + let db_path = db_dir.path().to_str().unwrap(); + let db_cfg = DatabaseConfig::with_columns(super::columns::v1::NUM_COLUMNS); + let db = Database::open(&db_cfg, db_path).unwrap(); + assert_eq!(db.num_columns(), super::columns::v1::NUM_COLUMNS as u32); + + // We need to properly set db version for upgrade to work. + fs::write(version_file_path(db_dir.path()), "1").expect("Failed to write DB version"); + { + let db = DbAdapter::new(db, columns::v2::ORDERED_COL); + db.write(DBTransaction { + ops: vec![DBOp::Insert { + col: COL_DISPUTE_COORDINATOR_DATA, + key: DBKey::from_slice(b"1234"), + value: b"0xdeadb00b".to_vec(), + }], + }) + .unwrap(); + } + + try_upgrade_db(&db_dir.path(), DatabaseKind::RocksDB).unwrap(); + + let db_cfg = DatabaseConfig::with_columns(super::columns::v2::NUM_COLUMNS); + let db = Database::open(&db_cfg, db_path).unwrap(); + + assert_eq!(db.num_columns(), super::columns::v2::NUM_COLUMNS); + + let db = DbAdapter::new(db, columns::v2::ORDERED_COL); + + assert_eq!( + db.get(COL_DISPUTE_COORDINATOR_DATA, b"1234").unwrap(), + Some("0xdeadb00b".as_bytes().to_vec()) + ); + + // Test we can write the new column. + db.write(DBTransaction { + ops: vec![DBOp::Insert { + col: COL_SESSION_WINDOW_DATA, + key: DBKey::from_slice(b"1337"), + value: b"0xdeadb00b".to_vec(), + }], + }) + .unwrap(); + + // Read back data from new column. + assert_eq!( + db.get(COL_SESSION_WINDOW_DATA, b"1337").unwrap(), + Some("0xdeadb00b".as_bytes().to_vec()) + ); } } diff --git a/node/subsystem-util/Cargo.toml b/node/subsystem-util/Cargo.toml index ab886c0c4078..d390fd2b42cc 100644 --- a/node/subsystem-util/Cargo.toml +++ b/node/subsystem-util/Cargo.toml @@ -34,7 +34,7 @@ sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "maste kvdb = "0.12.0" parity-util-mem = { version = "0.12.0", default-features = false } -parity-db = { version = "0.3.13" } +parity-db = { version = "0.4.2"} [dev-dependencies] assert_matches = "1.4.0" @@ -46,3 +46,4 @@ lazy_static = "1.4.0" polkadot-primitives-test-helpers = { path = "../../primitives/test-helpers" } kvdb-shared-tests = "0.10.0" tempfile = "3.1.0" +kvdb-memorydb = "0.12.0" diff --git a/node/subsystem-util/src/rolling_session_window.rs b/node/subsystem-util/src/rolling_session_window.rs index 700feb2ccff8..beac31292b7d 100644 --- a/node/subsystem-util/src/rolling_session_window.rs +++ b/node/subsystem-util/src/rolling_session_window.rs @@ -19,8 +19,13 @@ //! This is useful for consensus components which need to stay up-to-date about recent sessions but don't //! care about the state of particular blocks. +use super::database::{DBTransaction, Database}; +use kvdb::{DBKey, DBOp}; + +use parity_scale_codec::{Decode, Encode}; pub use polkadot_node_primitives::{new_session_window_size, SessionWindowSize}; use polkadot_primitives::v2::{BlockNumber, Hash, SessionIndex, SessionInfo}; +use std::sync::Arc; use futures::channel::oneshot; use polkadot_node_subsystem::{ @@ -29,7 +34,11 @@ use polkadot_node_subsystem::{ overseer, }; +// The window size is equal to the `approval-voting` and `dispute-coordinator` constants that +// have been obsoleted. +const SESSION_WINDOW_SIZE: SessionWindowSize = new_session_window_size!(6); const LOG_TARGET: &str = "parachain::rolling-session-window"; +const STORED_ROLLING_SESSION_WINDOW: &[u8] = b"Rolling_session_window"; /// Sessions unavailable in state to cache. #[derive(Debug, Clone, thiserror::Error)] @@ -94,55 +103,176 @@ pub enum SessionWindowUpdate { Unchanged, } +/// A structure to store rolling session database parameters. +#[derive(Clone)] +pub struct DatabaseParams { + /// Database reference. + pub db: Arc, + /// The column which stores the rolling session info. + pub db_column: u32, +} /// A rolling window of sessions and cached session info. pub struct RollingSessionWindow { earliest_session: SessionIndex, session_info: Vec, window_size: SessionWindowSize, + // The option is just to enable some approval-voting tests to force feed sessions + // in the window without dealing with the DB. + db_params: Option, +} + +/// The rolling session data we persist in the database. +#[derive(Encode, Decode, Default)] +struct StoredWindow { + earliest_session: SessionIndex, + session_info: Vec, } impl RollingSessionWindow { /// Initialize a new session info cache with the given window size. + /// Invariant: The database always contains the earliest session. Then, + /// we can always extend the session info vector using chain state. pub async fn new( mut sender: Sender, - window_size: SessionWindowSize, block_hash: Hash, + db_params: DatabaseParams, ) -> Result where Sender: overseer::SubsystemSender + overseer::SubsystemSender, { + // At first, determine session window start using the chain state. let session_index = get_session_index_for_child(&mut sender, block_hash).await?; let earliest_non_finalized_block_session = Self::earliest_non_finalized_block_session(&mut sender).await?; // This will increase the session window to cover the full unfinalized chain. - let window_start = std::cmp::min( - session_index.saturating_sub(window_size.get() - 1), + let on_chain_window_start = std::cmp::min( + session_index.saturating_sub(SESSION_WINDOW_SIZE.get() - 1), earliest_non_finalized_block_session, ); - match load_all_sessions(&mut sender, block_hash, window_start, session_index).await { - Err(kind) => Err(SessionsUnavailable { - kind, - info: Some(SessionsUnavailableInfo { - window_start, - window_end: session_index, - block_hash, + // Fetch session information from DB. + let maybe_stored_window = Self::db_load(db_params.clone()); + + // Get the DB stored sessions and recompute window start based on DB data. + let (mut window_start, stored_sessions) = + if let Some(mut stored_window) = maybe_stored_window { + // Check if DB is ancient. + if earliest_non_finalized_block_session > + stored_window.earliest_session + stored_window.session_info.len() as u32 + { + // If ancient, we scrap it and fetch from chain state. + stored_window.session_info.clear(); + } + + // The session window might extend beyond the last finalized block, but that's fine as we'll prune it at + // next update. + let window_start = if stored_window.session_info.len() > 0 { + // If there is at least one entry in db, we always take the DB as source of truth. + stored_window.earliest_session + } else { + on_chain_window_start + }; + + (window_start, stored_window.session_info) + } else { + (on_chain_window_start, Vec::new()) + }; + + // Compute the amount of sessions missing from the window that will be fetched from chain state. + let sessions_missing_count = session_index + .saturating_sub(window_start) + .saturating_add(1) + .saturating_sub(stored_sessions.len() as u32); + + // Extend from chain state. + let sessions = if sessions_missing_count > 0 { + match extend_sessions_from_chain_state( + stored_sessions, + &mut sender, + block_hash, + &mut window_start, + session_index, + ) + .await + { + Err(kind) => Err(SessionsUnavailable { + kind, + info: Some(SessionsUnavailableInfo { + window_start, + window_end: session_index, + block_hash, + }), }), - }), - Ok(s) => Ok(Self { earliest_session: window_start, session_info: s, window_size }), + Ok(sessions) => Ok(sessions), + }? + } else { + // There are no new sessions to be fetched from chain state. + Vec::new() + }; + + Ok(Self { + earliest_session: window_start, + session_info: sessions, + window_size: SESSION_WINDOW_SIZE, + db_params: Some(db_params), + }) + } + + // Load session information from the parachains db. + fn db_load(db_params: DatabaseParams) -> Option { + match db_params.db.get(db_params.db_column, STORED_ROLLING_SESSION_WINDOW).ok()? { + None => None, + Some(raw) => { + let maybe_decoded = StoredWindow::decode(&mut &raw[..]).map(Some); + match maybe_decoded { + Ok(decoded) => decoded, + Err(err) => { + gum::warn!( + target: LOG_TARGET, + ?err, + "Failed decoding db entry; will start with onchain session infos and self-heal DB entry on next update." + ); + None + }, + } + }, + } + } + + // Saves/Updates all sessions in the database. + // TODO: https://github.com/paritytech/polkadot/issues/6144 + fn db_save(&mut self, stored_window: StoredWindow) { + if let Some(db_params) = self.db_params.as_ref() { + match db_params.db.write(DBTransaction { + ops: vec![DBOp::Insert { + col: db_params.db_column, + key: DBKey::from_slice(STORED_ROLLING_SESSION_WINDOW), + value: stored_window.encode(), + }], + }) { + Ok(_) => {}, + Err(err) => { + gum::warn!(target: LOG_TARGET, ?err, "Failed writing db entry"); + }, + } } } /// Initialize a new session info cache with the given window size and /// initial data. + /// This is only used in `approval voting` tests. pub fn with_session_info( - window_size: SessionWindowSize, earliest_session: SessionIndex, session_info: Vec, ) -> Self { - RollingSessionWindow { earliest_session, session_info, window_size } + RollingSessionWindow { + earliest_session, + session_info, + window_size: SESSION_WINDOW_SIZE, + db_params: None, + } } /// Access the session info for the given session index, if stored within the window. @@ -262,11 +392,6 @@ impl RollingSessionWindow { + overseer::SubsystemSender, { let session_index = get_session_index_for_child(sender, block_hash).await?; - let earliest_non_finalized_block_session = - Self::earliest_non_finalized_block_session(sender).await?; - - let old_window_start = self.earliest_session; - let latest = self.latest_session(); // Either cached or ancient. @@ -274,6 +399,10 @@ impl RollingSessionWindow { return Ok(SessionWindowUpdate::Unchanged) } + let earliest_non_finalized_block_session = + Self::earliest_non_finalized_block_session(sender).await?; + + let old_window_start = self.earliest_session; let old_window_end = latest; // Ensure we keep sessions up to last finalized block by adjusting the window start. @@ -283,16 +412,34 @@ impl RollingSessionWindow { earliest_non_finalized_block_session, ); - // keep some of the old window, if applicable. - let overlap_start = window_start.saturating_sub(old_window_start); + // Never look back past earliest session, since if sessions beyond were not needed or available + // in the past remains valid for the future (window only advances forward). + let mut window_start = std::cmp::max(window_start, self.earliest_session); + + let mut sessions = self.session_info.clone(); + let sessions_out_of_window = window_start.saturating_sub(old_window_start) as usize; - let fresh_start = if latest < window_start { window_start } else { latest + 1 }; + let sessions = if sessions_out_of_window < sessions.len() { + // Drop sessions based on how much the window advanced. + sessions.split_off((window_start as usize).saturating_sub(old_window_start as usize)) + } else { + // Window has jumped such that we need to fetch all sessions from on chain. + Vec::new() + }; - match load_all_sessions(sender, block_hash, fresh_start, session_index).await { + match extend_sessions_from_chain_state( + sessions, + sender, + block_hash, + &mut window_start, + session_index, + ) + .await + { Err(kind) => Err(SessionsUnavailable { kind, info: Some(SessionsUnavailableInfo { - window_start: fresh_start, + window_start, window_end: session_index, block_hash, }), @@ -305,15 +452,19 @@ impl RollingSessionWindow { new_window_end: session_index, }; - let outdated = std::cmp::min(overlap_start as usize, self.session_info.len()); - self.session_info.drain(..outdated); - self.session_info.extend(s); + self.session_info = s; + // we need to account for this case: // window_start ................................... session_index // old_window_start ........... latest let new_earliest = std::cmp::max(window_start, old_window_start); self.earliest_session = new_earliest; + // Update current window in DB. + self.db_save(StoredWindow { + earliest_session: self.earliest_session, + session_info: self.session_info.clone(), + }); Ok(update) }, } @@ -354,13 +505,23 @@ async fn get_session_index_for_child( } } -async fn load_all_sessions( +/// Attempts to extend db stored sessions with sessions missing between `start` and up to `end_inclusive`. +/// Runtime session info fetching errors are ignored if that doesn't create a gap in the window. +async fn extend_sessions_from_chain_state( + stored_sessions: Vec, sender: &mut impl overseer::SubsystemSender, block_hash: Hash, - start: SessionIndex, + window_start: &mut SessionIndex, end_inclusive: SessionIndex, ) -> Result, SessionsUnavailableReason> { - let mut v = Vec::new(); + // Start from the db sessions. + let mut sessions = stored_sessions; + // We allow session fetch failures only if we won't create a gap in the window by doing so. + // If `allow_failure` is set to true here, fetching errors are ignored until we get a first session. + let mut allow_failure = sessions.is_empty(); + + let start = *window_start + sessions.len() as u32; + for i in start..=end_inclusive { let (tx, rx) = oneshot::channel(); sender @@ -370,22 +531,58 @@ async fn load_all_sessions( )) .await; - let session_info = match rx.await { - Ok(Ok(Some(s))) => s, - Ok(Ok(None)) => return Err(SessionsUnavailableReason::Missing(i)), - Ok(Err(e)) => return Err(SessionsUnavailableReason::RuntimeApi(e)), - Err(canceled) => return Err(SessionsUnavailableReason::RuntimeApiUnavailable(canceled)), + match rx.await { + Ok(Ok(Some(session_info))) => { + // We do not allow failure anymore after having at least 1 session in window. + allow_failure = false; + sessions.push(session_info); + }, + Ok(Ok(None)) if !allow_failure => return Err(SessionsUnavailableReason::Missing(i)), + Ok(Ok(None)) => { + // Handle `allow_failure` true. + // If we didn't get the session, we advance window start. + *window_start += 1; + gum::debug!( + target: LOG_TARGET, + session = ?i, + "Session info missing from runtime." + ); + }, + Ok(Err(e)) if !allow_failure => return Err(SessionsUnavailableReason::RuntimeApi(e)), + Err(canceled) if !allow_failure => + return Err(SessionsUnavailableReason::RuntimeApiUnavailable(canceled)), + Ok(Err(err)) => { + // Handle `allow_failure` true. + // If we didn't get the session, we advance window start. + *window_start += 1; + gum::debug!( + target: LOG_TARGET, + session = ?i, + ?err, + "Error while fetching session information." + ); + }, + Err(err) => { + // Handle `allow_failure` true. + // If we didn't get the session, we advance window start. + *window_start += 1; + gum::debug!( + target: LOG_TARGET, + session = ?i, + ?err, + "Channel error while fetching session information." + ); + }, }; - - v.push(session_info); } - Ok(v) + Ok(sessions) } #[cfg(test)] mod tests { use super::*; + use crate::database::kvdb_impl::DbAdapter; use assert_matches::assert_matches; use polkadot_node_subsystem::{ messages::{AllMessages, AvailabilityRecoveryMessage}, @@ -395,7 +592,16 @@ mod tests { use polkadot_primitives::v2::Header; use sp_core::testing::TaskExecutor; - pub const TEST_WINDOW_SIZE: SessionWindowSize = new_session_window_size!(6); + const SESSION_DATA_COL: u32 = 0; + + const NUM_COLUMNS: u32 = 1; + + fn dummy_db_params() -> DatabaseParams { + let db = kvdb_memorydb::create(NUM_COLUMNS); + let db = DbAdapter::new(db, &[]); + let db: Arc = Arc::new(db); + DatabaseParams { db, db_column: SESSION_DATA_COL } + } fn dummy_session_info(index: SessionIndex) -> SessionInfo { SessionInfo { @@ -420,7 +626,10 @@ mod tests { session: SessionIndex, window: Option, expect_requests_from: SessionIndex, - ) { + db_params: Option, + ) -> RollingSessionWindow { + let db_params = db_params.unwrap_or(dummy_db_params()); + let header = Header { digest: Default::default(), extrinsics_root: Default::default(), @@ -448,9 +657,8 @@ mod tests { let test_fut = { Box::pin(async move { let window = match window { - None => RollingSessionWindow::new(sender.clone(), TEST_WINDOW_SIZE, hash) - .await - .unwrap(), + None => + RollingSessionWindow::new(sender.clone(), hash, db_params).await.unwrap(), Some(mut window) => { window.cache_session_info_for_head(sender, hash).await.unwrap(); window @@ -461,6 +669,8 @@ mod tests { window.session_info, (expected_start_session..=session).map(dummy_session_info).collect::>(), ); + + window }) }; @@ -522,12 +732,43 @@ mod tests { } }); - futures::executor::block_on(futures::future::join(test_fut, aux_fut)); + let (window, _) = futures::executor::block_on(futures::future::join(test_fut, aux_fut)); + window + } + + #[test] + fn cache_session_info_start_empty_db() { + let db_params = dummy_db_params(); + + let window = cache_session_info_test( + (10 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), + 10, + None, + (10 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), + Some(db_params.clone()), + ); + + let window = cache_session_info_test( + (11 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), + 11, + Some(window), + 11, + None, + ); + assert_eq!(window.session_info.len(), SESSION_WINDOW_SIZE.get() as usize); + + cache_session_info_test( + (11 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), + 12, + None, + 12, + Some(db_params), + ); } #[test] fn cache_session_info_first_early() { - cache_session_info_test(0, 1, None, 0); + cache_session_info_test(0, 1, None, 0, None); } #[test] @@ -535,19 +776,21 @@ mod tests { let window = RollingSessionWindow { earliest_session: 1, session_info: vec![dummy_session_info(1)], - window_size: TEST_WINDOW_SIZE, + window_size: SESSION_WINDOW_SIZE, + db_params: Some(dummy_db_params()), }; - cache_session_info_test(1, 2, Some(window), 2); + cache_session_info_test(1, 2, Some(window), 2, None); } #[test] fn cache_session_info_first_late() { cache_session_info_test( - (100 as SessionIndex).saturating_sub(TEST_WINDOW_SIZE.get() - 1), + (100 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), 100, None, - (100 as SessionIndex).saturating_sub(TEST_WINDOW_SIZE.get() - 1), + (100 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), + None, ); } @@ -560,48 +803,88 @@ mod tests { dummy_session_info(51), dummy_session_info(52), ], - window_size: TEST_WINDOW_SIZE, + window_size: SESSION_WINDOW_SIZE, + db_params: Some(dummy_db_params()), }; cache_session_info_test( - (100 as SessionIndex).saturating_sub(TEST_WINDOW_SIZE.get() - 1), + (100 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), 100, Some(window), - (100 as SessionIndex).saturating_sub(TEST_WINDOW_SIZE.get() - 1), + (100 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), + None, ); } #[test] fn cache_session_info_roll_full() { - let start = 99 - (TEST_WINDOW_SIZE.get() - 1); + let start = 99 - (SESSION_WINDOW_SIZE.get() - 1); let window = RollingSessionWindow { earliest_session: start, session_info: (start..=99).map(dummy_session_info).collect(), - window_size: TEST_WINDOW_SIZE, + window_size: SESSION_WINDOW_SIZE, + db_params: Some(dummy_db_params()), }; cache_session_info_test( - (100 as SessionIndex).saturating_sub(TEST_WINDOW_SIZE.get() - 1), + (100 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), 100, Some(window), 100, // should only make one request. + None, + ); + } + + #[test] + fn cache_session_info_roll_many_full_db() { + let db_params = dummy_db_params(); + let start = 97 - (SESSION_WINDOW_SIZE.get() - 1); + let window = RollingSessionWindow { + earliest_session: start, + session_info: (start..=97).map(dummy_session_info).collect(), + window_size: SESSION_WINDOW_SIZE, + db_params: Some(db_params.clone()), + }; + + cache_session_info_test( + (100 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), + 100, + Some(window), + 98, + None, + ); + + // We expect the session to be populated from DB, and only fetch 101 from on chain. + cache_session_info_test( + (100 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), + 101, + None, + 101, + Some(db_params.clone()), ); + + // Session warps in the future. + let window = cache_session_info_test(195, 200, None, 195, Some(db_params)); + + assert_eq!(window.session_info.len(), SESSION_WINDOW_SIZE.get() as usize); } #[test] fn cache_session_info_roll_many_full() { - let start = 97 - (TEST_WINDOW_SIZE.get() - 1); + let start = 97 - (SESSION_WINDOW_SIZE.get() - 1); let window = RollingSessionWindow { earliest_session: start, session_info: (start..=97).map(dummy_session_info).collect(), - window_size: TEST_WINDOW_SIZE, + window_size: SESSION_WINDOW_SIZE, + db_params: Some(dummy_db_params()), }; cache_session_info_test( - (100 as SessionIndex).saturating_sub(TEST_WINDOW_SIZE.get() - 1), + (100 as SessionIndex).saturating_sub(SESSION_WINDOW_SIZE.get() - 1), 100, Some(window), 98, + None, ); } @@ -611,7 +894,8 @@ mod tests { let window = RollingSessionWindow { earliest_session: start, session_info: (0..=1).map(dummy_session_info).collect(), - window_size: TEST_WINDOW_SIZE, + window_size: SESSION_WINDOW_SIZE, + db_params: Some(dummy_db_params()), }; cache_session_info_test( @@ -619,6 +903,7 @@ mod tests { 2, Some(window), 2, // should only make one request. + None, ); } @@ -628,14 +913,17 @@ mod tests { let window = RollingSessionWindow { earliest_session: start, session_info: (0..=1).map(dummy_session_info).collect(), - window_size: TEST_WINDOW_SIZE, + window_size: SESSION_WINDOW_SIZE, + db_params: Some(dummy_db_params()), }; - cache_session_info_test(0, 3, Some(window), 2); + let actual_window_size = window.session_info.len() as u32; + + cache_session_info_test(0, 3, Some(window), actual_window_size, None); } #[test] - fn any_session_stretch_for_unfinalized_chain() { + fn cache_session_fails_for_gap_in_window() { // Session index of the tip of our fake test chain. let session: SessionIndex = 100; let genesis_session: SessionIndex = 0; @@ -664,7 +952,8 @@ mod tests { let test_fut = { let sender = ctx.sender().clone(); Box::pin(async move { - let res = RollingSessionWindow::new(sender, TEST_WINDOW_SIZE, hash).await; + let res = RollingSessionWindow::new(sender, hash, dummy_db_params()).await; + assert!(res.is_err()); }) }; @@ -713,6 +1002,135 @@ mod tests { ); // Unfinalized chain starts at geneisis block, so session 0 is how far we stretch. + // First 50 sessions are missing. + for i in genesis_session..=50 { + assert_matches!( + handle.recv().await, + AllMessages::RuntimeApi(RuntimeApiMessage::Request( + h, + RuntimeApiRequest::SessionInfo(j, s_tx), + )) => { + assert_eq!(h, hash); + assert_eq!(i, j); + let _ = s_tx.send(Ok(None)); + } + ); + } + // next 10 sessions are present + for i in 51..=60 { + assert_matches!( + handle.recv().await, + AllMessages::RuntimeApi(RuntimeApiMessage::Request( + h, + RuntimeApiRequest::SessionInfo(j, s_tx), + )) => { + assert_eq!(h, hash); + assert_eq!(i, j); + let _ = s_tx.send(Ok(Some(dummy_session_info(i)))); + } + ); + } + // gap of 1 session + assert_matches!( + handle.recv().await, + AllMessages::RuntimeApi(RuntimeApiMessage::Request( + h, + RuntimeApiRequest::SessionInfo(j, s_tx), + )) => { + assert_eq!(h, hash); + assert_eq!(61, j); + let _ = s_tx.send(Ok(None)); + } + ); + }); + + futures::executor::block_on(futures::future::join(test_fut, aux_fut)); + } + + #[test] + fn any_session_stretch_with_failure_allowed_for_unfinalized_chain() { + // Session index of the tip of our fake test chain. + let session: SessionIndex = 100; + let genesis_session: SessionIndex = 0; + + let header = Header { + digest: Default::default(), + extrinsics_root: Default::default(), + number: 5, + state_root: Default::default(), + parent_hash: Default::default(), + }; + + let finalized_header = Header { + digest: Default::default(), + extrinsics_root: Default::default(), + number: 0, + state_root: Default::default(), + parent_hash: Default::default(), + }; + + let pool = TaskExecutor::new(); + let (mut ctx, mut handle) = make_subsystem_context::<(), _>(pool.clone()); + + let hash = header.hash(); + + let test_fut = { + let sender = ctx.sender().clone(); + Box::pin(async move { + let res = RollingSessionWindow::new(sender, hash, dummy_db_params()).await; + assert!(res.is_ok()); + let rsw = res.unwrap(); + // Since first 50 sessions are missing the earliest should be 50. + assert_eq!(rsw.earliest_session, 50); + assert_eq!(rsw.session_info.len(), 51); + }) + }; + + let aux_fut = Box::pin(async move { + assert_matches!( + handle.recv().await, + AllMessages::RuntimeApi(RuntimeApiMessage::Request( + h, + RuntimeApiRequest::SessionIndexForChild(s_tx), + )) => { + assert_eq!(h, hash); + let _ = s_tx.send(Ok(session)); + } + ); + + assert_matches!( + handle.recv().await, + AllMessages::ChainApi(ChainApiMessage::FinalizedBlockNumber( + s_tx, + )) => { + let _ = s_tx.send(Ok(finalized_header.number)); + } + ); + + assert_matches!( + handle.recv().await, + AllMessages::ChainApi(ChainApiMessage::FinalizedBlockHash( + block_number, + s_tx, + )) => { + assert_eq!(block_number, finalized_header.number); + let _ = s_tx.send(Ok(Some(finalized_header.hash()))); + } + ); + + assert_matches!( + handle.recv().await, + AllMessages::RuntimeApi(RuntimeApiMessage::Request( + h, + RuntimeApiRequest::SessionIndexForChild(s_tx), + )) => { + assert_eq!(h, finalized_header.hash()); + let _ = s_tx.send(Ok(0)); + } + ); + + // Unfinalized chain starts at geneisis block, so session 0 is how far we stretch. + // We also test if failure is allowed for 50 first missing sessions. for i in genesis_session..=session { assert_matches!( handle.recv().await, @@ -723,7 +1141,7 @@ mod tests { assert_eq!(h, hash); assert_eq!(i, j); - let _ = s_tx.send(Ok(if i == session { + let _ = s_tx.send(Ok(if i < 50 { None } else { Some(dummy_session_info(i)) @@ -739,7 +1157,7 @@ mod tests { #[test] fn any_session_unavailable_for_caching_means_no_change() { let session: SessionIndex = 6; - let start_session = session.saturating_sub(TEST_WINDOW_SIZE.get() - 1); + let start_session = session.saturating_sub(SESSION_WINDOW_SIZE.get() - 1); let header = Header { digest: Default::default(), @@ -765,7 +1183,7 @@ mod tests { let test_fut = { let sender = ctx.sender().clone(); Box::pin(async move { - let res = RollingSessionWindow::new(sender, TEST_WINDOW_SIZE, hash).await; + let res = RollingSessionWindow::new(sender, hash, dummy_db_params()).await; assert!(res.is_err()); }) }; @@ -857,7 +1275,7 @@ mod tests { Box::pin(async move { let sender = ctx.sender().clone(); let window = - RollingSessionWindow::new(sender, TEST_WINDOW_SIZE, hash).await.unwrap(); + RollingSessionWindow::new(sender, hash, dummy_db_params()).await.unwrap(); assert_eq!(window.earliest_session, session); assert_eq!(window.session_info, vec![dummy_session_info(session)]); diff --git a/node/test/service/src/lib.rs b/node/test/service/src/lib.rs index 8fe31ce2b5b4..831f0c85aaaa 100644 --- a/node/test/service/src/lib.rs +++ b/node/test/service/src/lib.rs @@ -27,7 +27,7 @@ use polkadot_node_subsystem::messages::{CollationGenerationMessage, CollatorProt use polkadot_overseer::Handle; use polkadot_primitives::v2::{Balance, CollatorPair, HeadData, Id as ParaId, ValidationCode}; use polkadot_runtime_common::BlockHashCount; -use polkadot_runtime_parachains::paras::ParaGenesisArgs; +use polkadot_runtime_parachains::paras::{ParaGenesisArgs, ParaKind}; use polkadot_service::{ ClientHandle, Error, ExecuteWithClient, FullClient, IsCollator, NewFull, PrometheusConfig, }; @@ -305,7 +305,7 @@ impl PolkadotTestNode { genesis: ParaGenesisArgs { genesis_head: genesis_head.into(), validation_code: validation_code.into(), - parachain: true, + para_kind: ParaKind::Parachain, }, }; diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 043e309d6786..b99ac7bc19e6 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -5,29 +5,28 @@ authors = ["Parity Technologies "] edition = "2021" [dependencies] -serde = { version = "1.0.137", optional = true, features = ["derive"] } -scale-info = { version = "2.1.2", default-features = false, features = ["bit-vec", "derive"] } +bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } +hex-literal = "0.3.4" parity-scale-codec = { version = "3.1.5", default-features = false, features = ["bit-vec", "derive"] } -primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +parity-util-mem = { version = "0.12.0", default-features = false, optional = true } +scale-info = { version = "2.1.2", default-features = false, features = ["bit-vec", "derive"] } +serde = { version = "1.0.137", optional = true, features = ["derive"] } + application-crypto = { package = "sp-application-crypto", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } +inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +runtime_primitives = { package = "sp-runtime", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -runtime_primitives = { package = "sp-runtime", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -polkadot-parachain = { path = "../parachain", default-features = false } +sp-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } +sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } + polkadot-core-primitives = { path = "../core-primitives", default-features = false } -trie = { package = "sp-trie", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -hex-literal = "0.3.4" -parity-util-mem = { version = "0.12.0", default-features = false, optional = true } +polkadot-parachain = { path = "../parachain", default-features = false } [features] default = ["std"] @@ -37,14 +36,12 @@ std = [ "scale-info/std", "primitives/std", "inherents/std", - "trie/std", "sp-api/std", "sp-authority-discovery/std", "sp-consensus-slots/std", "sp-keystore", "sp-std/std", "sp-io/std", - "sp-version/std", "sp-staking/std", "sp-arithmetic/std", "runtime_primitives/std", @@ -53,6 +50,5 @@ std = [ "polkadot-parachain/std", "polkadot-core-primitives/std", "bitvec/std", - "frame-system/std", ] runtime-benchmarks = [] diff --git a/roadmap/implementers-guide/README.md b/roadmap/implementers-guide/README.md index 367a756e0200..7f3f8cef7e63 100644 --- a/roadmap/implementers-guide/README.md +++ b/roadmap/implementers-guide/README.md @@ -1,9 +1,17 @@ # The Polkadot Parachain Host Implementers' Guide The implementers' guide is compiled from several source files with [`mdBook`](https://github.com/rust-lang/mdBook). -To view it live, locally, from the repo root: + +## Hosted build + +This is available [here](https://paritytech.github.io/polkadot/book/). + +## Local build + +To view it locally from the repo root: Ensure graphviz is installed: + ```sh brew install graphviz # for macOS sudo apt-get install graphviz # for Ubuntu/Debian @@ -12,7 +20,11 @@ sudo apt-get install graphviz # for Ubuntu/Debian Then install and build the book: ```sh -cargo install mdbook mdbook-linkcheck mdbook-graphviz mdbook-mermaid +cargo install mdbook mdbook-linkcheck mdbook-graphviz mdbook-mermaid mdbook-last-changed mdbook serve roadmap/implementers-guide open http://localhost:3000 ``` + +## Specification + +See also the Polkadot specification [hosted](https://spec.polkadot.network/), and its [source](https://github.com/w3f/polkadot-spec). diff --git a/roadmap/implementers-guide/book.toml b/roadmap/implementers-guide/book.toml index 8805ca4c38c3..0ced0e26f9a0 100644 --- a/roadmap/implementers-guide/book.toml +++ b/roadmap/implementers-guide/book.toml @@ -9,8 +9,14 @@ title = "The Polkadot Parachain Host Implementers' Guide" command = "mdbook-graphviz" [preprocessor.mermaid] command = "mdbook-mermaid" +[preprocessor.last-changed] +command = "mdbook-last-changed" +renderer = ["html"] [output.html] +additional-css = ["last-changed.css"] additional-js = ["mermaid.min.js", "mermaid-init.js"] +# Repository URL used in the last-changed link. +git-repository-url = "https://github.com/paritytech/polkadot" [output.linkcheck] diff --git a/roadmap/implementers-guide/last-changed.css b/roadmap/implementers-guide/last-changed.css new file mode 100644 index 000000000000..744dc6efc7ec --- /dev/null +++ b/roadmap/implementers-guide/last-changed.css @@ -0,0 +1,7 @@ +footer { + font-size: 0.8em; + text-align: center; + margin-top: 50px; + border-top: 1px solid black; + padding: 5px 0; +} diff --git a/roadmap/implementers-guide/src/glossary.md b/roadmap/implementers-guide/src/glossary.md index a64c5bd00a50..8612d8834cb8 100644 --- a/roadmap/implementers-guide/src/glossary.md +++ b/roadmap/implementers-guide/src/glossary.md @@ -2,44 +2,50 @@ Here you can find definitions of a bunch of jargon, usually specific to the Polkadot project. -- BABE: (Blind Assignment for Blockchain Extension). The algorithm validators use to safely extend the Relay Chain. See [the Polkadot wiki][0] for more information. -- Backable Candidate: A Parachain Candidate which is backed by a majority of validators assigned to a given parachain. -- Backed Candidate: A Backable Candidate noted in a relay-chain block -- Backing: A set of statements proving that a Parachain Candidate is backable. -- Collator: A node who generates Proofs-of-Validity (PoV) for blocks of a specific parachain. -- DMP: (Downward Message Passing). Message passing from the relay-chain to a parachain. Also there is a runtime parachains module with the same name. -- DMQ: (Downward Message Queue). A message queue for messages from the relay-chain down to a parachain. A parachain has +- **BABE:** (Blind Assignment for Blockchain Extension). The algorithm validators use to safely extend the Relay Chain. See [the Polkadot wiki][0] for more information. +- **Backable Candidate:** A Parachain Candidate which is backed by a majority of validators assigned to a given parachain. +- **Backed Candidate:** A Backable Candidate noted in a relay-chain block +- **Backing:** A set of statements proving that a Parachain Candidate is backable. +- **Collator:** A node who generates Proofs-of-Validity (PoV) for blocks of a specific parachain. +- **DMP:** (Downward Message Passing). Message passing from the relay-chain to a parachain. Also there is a runtime parachains module with the same name. +- **DMQ:** (Downward Message Queue). A message queue for messages from the relay-chain down to a parachain. A parachain has exactly one downward message queue. -- Extrinsic: An element of a relay-chain block which triggers a specific entry-point of a runtime module with given arguments. -- GRANDPA: (Ghost-based Recursive ANcestor Deriving Prefix Agreement). The algorithm validators use to guarantee finality of the Relay Chain. -- HRMP: (Horizontally Relay-routed Message Passing). A mechanism for message passing between parachains (hence horizontal) that leverages the relay-chain storage. Predates XCMP. Also there is a runtime parachains module with the same name. -- Inclusion Pipeline: The set of steps taken to carry a Parachain Candidate from authoring, to backing, to availability and full inclusion in an active fork of its parachain. -- Module: A component of the Runtime logic, encapsulating storage, routines, and entry-points. -- Module Entry Point: A recipient of new information presented to the Runtime. This may trigger routines. -- Module Routine: A piece of code executed within a module by block initialization, closing, or upon an entry point being triggered. This may execute computation, and read or write storage. -- MQC: (Message Queue Chain). A cryptographic data structure that resembles an append-only linked list which doesn't store original values but only their hashes. The whole structure is described by a single hash, referred as a "head". When a value is appended, it's contents hashed with the previous head creating a hash that becomes a new head. -- Node: A participant in the Polkadot network, who follows the protocols of communication and connection to other nodes. Nodes form a peer-to-peer network topology without a central authority. -- Parachain Candidate, or Candidate: A proposed block for inclusion into a parachain. -- Parablock: A block in a parachain. -- Parachain: A constituent chain secured by the Relay Chain's validators. -- Parachain Validators: A subset of validators assigned during a period of time to back candidates for a specific parachain -- Parathread: A parachain which is scheduled on a pay-as-you-go basis. -- PDK (Parachain Development Kit): A toolset that allows one to develop a parachain. Cumulus is a PDK. -- Preimage: In our context, if `H(X) = Y` where `H` is a hash function and `Y` is the hash, then `X` is the hash preimage. -- Proof-of-Validity (PoV): A stateless-client proof that a parachain candidate is valid, with respect to some validation function. -- Relay Parent: A block in the relay chain, referred to in a context where work is being done in the context of the state at this block. -- Router: The router module is a meta module that consists of three runtime modules responsible for routing messages between paras and the relay chain. The three separate runtime modules are: Dmp, Ump, Hrmp, each responsible for the respective part of message routing. -- Runtime: The relay-chain state machine. -- Runtime Module: See Module. -- Runtime API: A means for the node-side behavior to access structured information based on the state of a fork of the blockchain. -- Secondary Checker: A validator who has been randomly selected to perform secondary approval checks on a parablock which is pending approval. -- Subsystem: A long-running task which is responsible for carrying out a particular category of work. -- UMP: (Upward Message Passing) A vertical message passing mechanism from a parachain to the relay chain. -- Validator: Specially-selected node in the network who is responsible for validating parachain blocks and issuing attestations about their validity. -- Validation Function: A piece of Wasm code that describes the state-transition function of a parachain. -- VMP: (Vertical Message Passing) A family of mechanisms that are responsible for message exchange between the relay chain and parachains. -- XCMP (Cross-Chain Message Passing) A type of horizontal message passing (i.e. between parachains) that allows secure message passing directly between parachains and has minimal resource requirements from the relay chain, thus highly scalable. +- **Extrinsic:** An element of a relay-chain block which triggers a specific entry-point of a runtime module with given arguments. +- **GRANDPA:** (Ghost-based Recursive ANcestor Deriving Prefix Agreement). The algorithm validators use to guarantee finality of the Relay Chain. +- **HRMP:** (Horizontally Relay-routed Message Passing). A mechanism for message passing between parachains (hence horizontal) that leverages the relay-chain storage. Predates XCMP. Also there is a runtime parachains module with the same name. +- **Inclusion Pipeline:** The set of steps taken to carry a Parachain Candidate from authoring, to backing, to availability and full inclusion in an active fork of its parachain. +- **Module:** A component of the Runtime logic, encapsulating storage, routines, and entry-points. +- **Module Entry Point:** A recipient of new information presented to the Runtime. This may trigger routines. +- **Module Routine:** A piece of code executed within a module by block initialization, closing, or upon an entry point being triggered. This may execute computation, and read or write storage. +- **MQC:** (Message Queue Chain). A cryptographic data structure that resembles an append-only linked list which doesn't store original values but only their hashes. The whole structure is described by a single hash, referred as a "head". When a value is appended, it's contents hashed with the previous head creating a hash that becomes a new head. +- **Node:** A participant in the Polkadot network, who follows the protocols of communication and connection to other nodes. Nodes form a peer-to-peer network topology without a central authority. +- **Parachain Candidate, or Candidate:** A proposed block for inclusion into a parachain. +- **Parablock:** A block in a parachain. +- **Parachain:** A constituent chain secured by the Relay Chain's validators. +- **Parachain Validators:** A subset of validators assigned during a period of time to back candidates for a specific parachain +- **Parathread:** A parachain which is scheduled on a pay-as-you-go basis. +- **PDK (Parachain Development Kit):** A toolset that allows one to develop a parachain. Cumulus is a PDK. +- **Preimage:** In our context, if `H(X) = Y` where `H` is a hash function and `Y` is the hash, then `X` is the hash preimage. +- **Proof-of-Validity (PoV):** A stateless-client proof that a parachain candidate is valid, with respect to some validation function. +- **PVF:** Parachain Validation Function. The validation code that is run by validators on parachains or parathreads. +- **PVF Prechecking:** This is the process of initially checking the PVF when it is first added. We attempt preparation of the PVF and make sure it succeeds within a given timeout. +- **PVF Preparation:** This is the process of preparing the WASM blob and includes both prevalidation and compilation. As prevalidation is pretty minimal right now, preparation mostly consists of compilation. +- **Relay Parent:** A block in the relay chain, referred to in a context where work is being done in the context of the state at this block. +- **Router:** The router module is a meta module that consists of three runtime modules responsible for routing messages between paras and the relay chain. The three separate runtime modules are: Dmp, Ump, Hrmp, each responsible for the respective part of message routing. +- **Runtime:** The relay-chain state machine. +- **Runtime Module:** See Module. +- **Runtime API:** A means for the node-side behavior to access structured information based on the state of a fork of the blockchain. +- **Secondary Checker:** A validator who has been randomly selected to perform secondary approval checks on a parablock which is pending approval. +- **Subsystem:** A long-running task which is responsible for carrying out a particular category of work. +- **UMP:** (Upward Message Passing) A vertical message passing mechanism from a parachain to the relay chain. +- **Validator:** Specially-selected node in the network who is responsible for validating parachain blocks and issuing attestations about their validity. +- **Validation Function:** A piece of Wasm code that describes the state-transition function of a parachain. +- **VMP:** (Vertical Message Passing) A family of mechanisms that are responsible for message exchange between the relay chain and parachains. +- **XCMP:** (Cross-Chain Message Passing) A type of horizontal message passing (i.e. between parachains) that allows secure message passing directly between parachains and has minimal resource requirements from the relay chain, thus highly scalable. + +## See Also Also of use is the [Substrate Glossary](https://substrate.dev/docs/en/knowledgebase/getting-started/glossary). [0]: https://wiki.polkadot.network/docs/learn-consensus +[1]: #pvf diff --git a/roadmap/implementers-guide/src/pvf-prechecking.md b/roadmap/implementers-guide/src/pvf-prechecking.md index 1dc7611c0cef..4dce61d2a83b 100644 --- a/roadmap/implementers-guide/src/pvf-prechecking.md +++ b/roadmap/implementers-guide/src/pvf-prechecking.md @@ -1,32 +1,12 @@ # PVF Pre-checking Overview -> ⚠️ This discusses a mechanism that is currently under-development. Follow the progress under [#3211]. - -## Terms - -This functionality involves several processes which may be potentially -confusing: - -- **Prechecking:** This is the process of initially checking the PVF when it is - first added. We attempt *preparation* of the PVF and make sure it succeeds - within a given timeout. -- **Execution:** This actually executes the PVF. The node may not have the - artifact from prechecking, in which case this process also includes a - *preparation* job. The timeout for preparation here is more lenient than when - prechecking. -- **Preparation:** This is the process of preparing the WASM blob and includes - both *prevalidation* and *compilation*. As prevalidation is pretty minimal - right now, preparation mostly consists of compilation. Note that *prechecking* - just consists of preparation, whereas *execution* will also prepare the PVF if - the artifact is not already found. -- **Prevalidation:** Right now this just tries to deserialize the binary with - parity-wasm. It is a part of *preparation*. -- **Compilation:** This is the process of compiling a PVF from wasm code to - machine code. It is a part of *preparation*. +> ⚠️ This discusses a mechanism that is currently under-development. Follow the progress under [#3211][3211]. ## Motivation -Parachains' and parathreads' validation function is described by a wasm module that we refer to as a PVF. Since it's a wasm module the typical way of executing it is to compile it to machine code. Typically an optimizing compiler consists of algorithms that are able to optimize the resulting machine code heavily. However, while those algorithms perform quite well for a typical wasm code produced by standard toolchains (e.g. rustc/LLVM), those algorithms can be abused to consume a lot of resources. Moreover, since those algorithms are rather complex there is a lot of room for a bug that can crash the compiler. +Parachains' and parathreads' validation function is described by a wasm module that we refer to as a PVF. Since a PVF is a wasm module the typical way of executing it is to compile it to machine code. + +Typically an optimizing compiler consists of algorithms that are able to optimize the resulting machine code heavily. However, while those algorithms perform quite well for a typical wasm code produced by standard toolchains (e.g. rustc/LLVM), those algorithms can be abused to consume a lot of resources. Moreover, since those algorithms are rather complex there is a lot of room for a bug that can crash the compiler. If compilation of a Parachain Validation Function (PVF) takes too long or uses too much memory, this can leave a node in limbo as to whether a candidate of that parachain is valid or not. @@ -66,7 +46,19 @@ The logic described above is implemented by the [paras] module. On the node-side, there is a PVF pre-checking [subsystem][pvf-prechecker-subsystem] that scans the chain for new PVFs via using [runtime APIs][pvf-runtime-api]. Upon finding a new PVF, the subsystem will initiate a PVF pre-checking request and wait for the result. Whenever the result is obtained, the subsystem will use the [runtime API][pvf-runtime-api] to submit a vote for the PVF. The vote is an unsigned transaction. The vote will be distributed via the gossip similarly to a normal transaction. Eventually a block producer will include the vote into the block where it will be handled by the [runtime][paras]. -[#3211]: https://github.com/paritytech/polkadot/issues/3211 +## Pre-checking Summary + +Parachains' and parathreads' validation function is described by a wasm module that we refer to as a PVF. + +In order to make the PVF usable for candidate validation it has to be registered on-chain. + +As part of the registration process, it has to go through pre-checking. Pre-checking is a game of attempting preparation and reporting the results back on-chain. + +We define preparation as a process that: validates the consistency of the wasm binary (aka prevalidation) and the compilation of the wasm module into machine code (refered to as artifact). + +Besides pre-checking, preparation can also be triggered by execution, since a compiled artifact is needed for the execution. If an artifact already exists, execution will skip preparation. If it does do preparation, execution uses a more lenient timeout than preparation, to avoid the situation where honest validators fail on valid, pre-checked PVFs. + +[3211]: https://github.com/paritytech/polkadot/issues/3211 [paras]: runtime/paras.md [pvf-runtime-api]: runtime-api/pvf-prechecking.md [pvf-prechecker-subsystem]: node/utility/pvf-prechecker.md diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 9ee5de41188d..96f29eae9257 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -31,6 +31,7 @@ pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "m pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-staking-reward-fn = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -84,6 +85,7 @@ std = [ "pallet-beefy-mmr/std", "pallet-session/std", "pallet-staking/std", + "pallet-staking-reward-fn/std", "pallet-timestamp/std", "pallet-vesting/std", "pallet-transaction-payment/std", diff --git a/runtime/common/src/impls.rs b/runtime/common/src/impls.rs index 939b753092f5..2b10c79cfdff 100644 --- a/runtime/common/src/impls.rs +++ b/runtime/common/src/impls.rs @@ -18,6 +18,8 @@ use crate::NegativeImbalance; use frame_support::traits::{Currency, Imbalance, OnUnbalanced}; +use primitives::v2::Balance; +use sp_runtime::Perquintill; /// Logic for the author to get a portion of fees. pub struct ToAuthor(sp_std::marker::PhantomData); @@ -57,6 +59,45 @@ where } } +pub fn era_payout( + total_staked: Balance, + non_gilt_issuance: Balance, + max_annual_inflation: Perquintill, + period_fraction: Perquintill, + auctioned_slots: u64, +) -> (Balance, Balance) { + use pallet_staking_reward_fn::compute_inflation; + use sp_runtime::traits::Saturating; + + let min_annual_inflation = Perquintill::from_rational(25u64, 1000u64); + let delta_annual_inflation = max_annual_inflation.saturating_sub(min_annual_inflation); + + // 30% reserved for up to 60 slots. + let auction_proportion = Perquintill::from_rational(auctioned_slots.min(60), 200u64); + + // Therefore the ideal amount at stake (as a percentage of total issuance) is 75% less the + // amount that we expect to be taken up with auctions. + let ideal_stake = Perquintill::from_percent(75).saturating_sub(auction_proportion); + + let stake = Perquintill::from_rational(total_staked, non_gilt_issuance); + let falloff = Perquintill::from_percent(5); + let adjustment = compute_inflation(stake, ideal_stake, falloff); + let staking_inflation = + min_annual_inflation.saturating_add(delta_annual_inflation * adjustment); + + let max_payout = period_fraction * max_annual_inflation * non_gilt_issuance; + let staking_payout = (period_fraction * staking_inflation) * non_gilt_issuance; + let rest = max_payout.saturating_sub(staking_payout); + + let other_issuance = non_gilt_issuance.saturating_sub(total_staked); + if total_staked > other_issuance { + let _cap_rest = Perquintill::from_rational(other_issuance, total_staked) * staking_payout; + // We don't do anything with this, but if we wanted to, we could introduce a cap on the + // treasury amount with: `rest = rest.min(cap_rest);` + } + (staking_payout, rest) +} + #[cfg(test)] mod tests { use super::*; @@ -209,4 +250,44 @@ mod tests { assert_eq!(Balances::free_balance(Treasury::account_id()), 8); }); } + + #[test] + fn compute_inflation_should_give_sensible_results() { + assert_eq!( + pallet_staking_reward_fn::compute_inflation( + Perquintill::from_percent(75), + Perquintill::from_percent(75), + Perquintill::from_percent(5), + ), + Perquintill::one() + ); + assert_eq!( + pallet_staking_reward_fn::compute_inflation( + Perquintill::from_percent(50), + Perquintill::from_percent(75), + Perquintill::from_percent(5), + ), + Perquintill::from_rational(2u64, 3u64) + ); + assert_eq!( + pallet_staking_reward_fn::compute_inflation( + Perquintill::from_percent(80), + Perquintill::from_percent(75), + Perquintill::from_percent(5), + ), + Perquintill::from_rational(1u64, 2u64) + ); + } + + #[test] + fn era_payout_should_give_sensible_results() { + assert_eq!( + era_payout(75, 100, Perquintill::from_percent(10), Perquintill::one(), 0,), + (10, 0) + ); + assert_eq!( + era_payout(80, 100, Perquintill::from_percent(10), Perquintill::one(), 0,), + (6, 4) + ); + } } diff --git a/runtime/common/src/paras_registrar.rs b/runtime/common/src/paras_registrar.rs index 7245cd92d304..bfcc91e3ba71 100644 --- a/runtime/common/src/paras_registrar.rs +++ b/runtime/common/src/paras_registrar.rs @@ -35,6 +35,7 @@ use sp_std::{prelude::*, result}; use crate::traits::{OnSwap, Registrar}; pub use pallet::*; use parity_scale_codec::{Decode, Encode}; +use runtime_parachains::paras::ParaKind; use scale_info::TypeInfo; use sp_runtime::{ traits::{CheckedSub, Saturating}, @@ -570,7 +571,7 @@ impl Pallet { }; ensure!(paras::Pallet::::lifecycle(id).is_none(), Error::::AlreadyRegistered); let (genesis, deposit) = - Self::validate_onboarding_data(genesis_head, validation_code, false)?; + Self::validate_onboarding_data(genesis_head, validation_code, ParaKind::Parathread)?; let deposit = deposit_override.unwrap_or(deposit); if let Some(additional) = deposit.checked_sub(&deposited) { @@ -613,7 +614,7 @@ impl Pallet { fn validate_onboarding_data( genesis_head: HeadData, validation_code: ValidationCode, - parachain: bool, + para_kind: ParaKind, ) -> Result<(ParaGenesisArgs, BalanceOf), sp_runtime::DispatchError> { let config = configuration::Pallet::::config(); ensure!(validation_code.0.len() > 0, Error::::EmptyCode); @@ -628,7 +629,7 @@ impl Pallet { .saturating_add(per_byte_fee.saturating_mul((genesis_head.0.len() as u32).into())) .saturating_add(per_byte_fee.saturating_mul((validation_code.0.len() as u32).into())); - Ok((ParaGenesisArgs { genesis_head, validation_code, parachain }, deposit)) + Ok((ParaGenesisArgs { genesis_head, validation_code, para_kind }, deposit)) } /// Swap a parachain and parathread, which involves scheduling an appropriate lifecycle update. diff --git a/runtime/kusama/Cargo.toml b/runtime/kusama/Cargo.toml index 72500677c534..ec3de40ec5e6 100644 --- a/runtime/kusama/Cargo.toml +++ b/runtime/kusama/Cargo.toml @@ -72,7 +72,6 @@ pallet-session = { git = "https://github.com/paritytech/substrate", branch = "ma pallet-society = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-staking-reward-fn = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-system = {git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -170,7 +169,6 @@ std = [ "pallet-session/std", "pallet-society/std", "pallet-staking/std", - "pallet-staking-reward-fn/std", "pallet-timestamp/std", "pallet-tips/std", "pallet-treasury/std", diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 58fcbece44f0..3f77ece6c86a 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -26,6 +26,7 @@ use primitives::v2::{ CoreState, GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, Moment, Nonce, OccupiedCoreAssumption, PersistedValidationData, ScrapedOnChainVotes, SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, + LOWEST_PUBLIC_ID, }; use runtime_common::{ auctions, claims, crowdloan, impl_runtime_weights, impls::DealWithFees, paras_registrar, @@ -410,6 +411,9 @@ parameter_types! { pub const MaxElectableTargets: u16 = u16::MAX; pub NposSolutionPriority: TransactionPriority = Perbill::from_percent(90) * TransactionPriority::max_value(); + /// Setup election pallet to support maximum winners upto 2000. This will mean Staking Pallet + /// cannot have active validators higher than this count. + pub const MaxActiveValidators: u32 = 2000; } generate_solution_type!( @@ -428,6 +432,9 @@ impl onchain::Config for OnChainSeqPhragmen { type Solver = SequentialPhragmen; type DataProvider = Staking; type WeightInfo = weights::frame_election_provider_support::WeightInfo; + type MaxWinners = MaxActiveValidators; + type VotersBound = MaxElectingVoters; + type TargetsBound = MaxElectableTargets; } impl pallet_election_provider_multi_phase::MinerConfig for Runtime { @@ -475,10 +482,15 @@ impl pallet_election_provider_multi_phase::Config for Runtime { type MinerTxPriority = NposSolutionPriority; type DataProvider = Staking; #[cfg(feature = "fast-runtime")] - type Fallback = onchain::UnboundedExecution; + type Fallback = onchain::OnChainExecution; #[cfg(not(feature = "fast-runtime"))] - type Fallback = pallet_election_provider_multi_phase::NoFallback; - type GovernanceFallback = onchain::UnboundedExecution; + type Fallback = frame_election_provider_support::NoElection<( + AccountId, + BlockNumber, + Staking, + MaxActiveValidators, + )>; + type GovernanceFallback = onchain::OnChainExecution; type Solver = SequentialPhragmen< AccountId, pallet_election_provider_multi_phase::SolutionAccuracyOf, @@ -489,6 +501,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime { type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo; type MaxElectingVoters = MaxElectingVoters; type MaxElectableTargets = MaxElectableTargets; + type MaxWinners = MaxActiveValidators; } parameter_types! { @@ -504,45 +517,6 @@ impl pallet_bags_list::Config for Runtime { type Score = sp_npos_elections::VoteWeight; } -fn era_payout( - total_staked: Balance, - non_gilt_issuance: Balance, - max_annual_inflation: Perquintill, - period_fraction: Perquintill, - auctioned_slots: u64, -) -> (Balance, Balance) { - use pallet_staking_reward_fn::compute_inflation; - use sp_arithmetic::traits::Saturating; - - let min_annual_inflation = Perquintill::from_rational(25u64, 1000u64); - let delta_annual_inflation = max_annual_inflation.saturating_sub(min_annual_inflation); - - // 30% reserved for up to 60 slots. - let auction_proportion = Perquintill::from_rational(auctioned_slots.min(60), 200u64); - - // Therefore the ideal amount at stake (as a percentage of total issuance) is 75% less the amount that we expect - // to be taken up with auctions. - let ideal_stake = Perquintill::from_percent(75).saturating_sub(auction_proportion); - - let stake = Perquintill::from_rational(total_staked, non_gilt_issuance); - let falloff = Perquintill::from_percent(5); - let adjustment = compute_inflation(stake, ideal_stake, falloff); - let staking_inflation = - min_annual_inflation.saturating_add(delta_annual_inflation * adjustment); - - let max_payout = period_fraction * max_annual_inflation * non_gilt_issuance; - let staking_payout = (period_fraction * staking_inflation) * non_gilt_issuance; - let rest = max_payout.saturating_sub(staking_payout); - - let other_issuance = non_gilt_issuance.saturating_sub(total_staked); - if total_staked > other_issuance { - let _cap_rest = Perquintill::from_rational(other_issuance, total_staked) * staking_payout; - // We don't do anything with this, but if we wanted to, we could introduce a cap on the treasury amount - // with: `rest = rest.min(cap_rest);` - } - (staking_payout, rest) -} - pub struct EraPayout; impl pallet_staking::EraPayout for EraPayout { fn era_payout( @@ -550,13 +524,18 @@ impl pallet_staking::EraPayout for EraPayout { _total_issuance: Balance, era_duration_millis: u64, ) -> (Balance, Balance) { - // TODO: #3011 Update with proper auctioned slots tracking. - // This should be fine for the first year of parachains. - let auctioned_slots: u64 = auctions::Pallet::::auction_counter().into(); + // all para-ids that are currently active. + let auctioned_slots = Paras::parachains() + .into_iter() + // all active para-ids that do not belong to a system or common good chain is the number + // of parachains that we should take into account for inflation. + .filter(|i| *i >= LOWEST_PUBLIC_ID) + .count() as u64; + const MAX_ANNUAL_INFLATION: Perquintill = Perquintill::from_percent(10); const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100; - era_payout( + runtime_common::impls::era_payout( total_staked, Gilt::issuance().non_gilt, MAX_ANNUAL_INFLATION, @@ -573,7 +552,7 @@ parameter_types! { pub const BondingDuration: sp_staking::EraIndex = 28; // 27 eras in which slashes can be cancelled (slightly less than 7 days). pub const SlashDeferDuration: sp_staking::EraIndex = 27; - pub const MaxNominatorRewardedPerValidator: u32 = 256; + pub const MaxNominatorRewardedPerValidator: u32 = 512; pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); // 24 pub const MaxNominations: u32 = ::LIMIT as u32; @@ -586,7 +565,7 @@ impl pallet_staking::Config for Runtime { type UnixTime = Timestamp; type CurrencyToVote = CurrencyToVote; type ElectionProvider = ElectionProviderMultiPhase; - type GenesisElectionProvider = onchain::UnboundedExecution; + type GenesisElectionProvider = onchain::OnChainExecution; type RewardRemainder = Treasury; type RuntimeEvent = RuntimeEvent; type Slash = Treasury; @@ -612,13 +591,15 @@ impl pallet_staking::Config for Runtime { impl pallet_fast_unstake::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type DepositCurrency = Balances; + type Currency = Balances; + type BatchSize = frame_support::traits::ConstU32<64>; type Deposit = frame_support::traits::ConstU128<{ CENTS * 100 }>; type ControlOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; type WeightInfo = weights::pallet_fast_unstake::WeightInfo; + type Staking = Staking; } parameter_types! { @@ -868,7 +849,7 @@ parameter_types! { pub const DepositBase: Balance = deposit(1, 88); // Additional storage item size of 32 bytes. pub const DepositFactor: Balance = deposit(0, 32); - pub const MaxSignatories: u16 = 100; + pub const MaxSignatories: u32 = 100; } impl pallet_multisig::Config for Runtime { @@ -1284,11 +1265,10 @@ impl pallet_nomination_pools::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = weights::pallet_nomination_pools::WeightInfo; type Currency = Balances; - type CurrencyBalance = Balance; type RewardCounter = FixedU128; type BalanceToU256 = BalanceToU256; type U256ToBalance = U256ToBalance; - type StakingInterface = Staking; + type Staking = Staking; type PostUnbondingPoolsWindow = ConstU32<4>; type MaxMetadataLen = ConstU32<256>; // we use the same number of allowed unlocking chunks as with staking. @@ -1406,7 +1386,7 @@ 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} = 56, + Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, Dmp: parachains_dmp::{Pallet, Call, Storage} = 58, Ump: parachains_ump::{Pallet, Call, Storage, Event} = 59, @@ -1465,12 +1445,6 @@ pub type Executive = frame_executive::Executive< Runtime, AllPalletsWithSystem, ( - pallet_staking::migrations::v11::MigrateToV11< - Runtime, - VoterList, - StakingMigrationV11OldPallet, - >, - pallet_staking::migrations::v12::MigrateToV12, // "Bound uses of call" pallet_preimage::migration::v1::Migration, pallet_scheduler::migration::v3::MigrateToV4, @@ -1479,6 +1453,7 @@ pub type Executive = frame_executive::Executive< // "Properly migrate weights to v2" parachains_configuration::migration::v3::MigrateToV3, pallet_election_provider_multi_phase::migrations::v1::MigrateToV1, + pallet_fast_unstake::migrations::v1::MigrateToV1, ), >; /// The payload being signed in the transactions. @@ -1716,53 +1691,27 @@ sp_api::impl_runtime_apis! { } impl mmr::MmrApi for Runtime { - fn generate_proof(_block_number: BlockNumber) - -> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof), mmr::Error> - { - Err(mmr::Error::PalletNotIncluded) - } - - fn verify_proof(_leaf: mmr::EncodableOpaqueLeaf, _proof: mmr::Proof) - -> Result<(), mmr::Error> - { - Err(mmr::Error::PalletNotIncluded) - } - - fn verify_proof_stateless( - _root: Hash, - _leaf: mmr::EncodableOpaqueLeaf, - _proof: mmr::Proof - ) -> Result<(), mmr::Error> { - Err(mmr::Error::PalletNotIncluded) - } - fn mmr_root() -> Result { Err(mmr::Error::PalletNotIncluded) } - fn generate_batch_proof(_block_numbers: Vec) - -> Result<(Vec, mmr::BatchProof), mmr::Error> - { - Err(mmr::Error::PalletNotIncluded) - } - - fn generate_historical_batch_proof( + fn generate_proof( _block_numbers: Vec, - _best_known_block_number: BlockNumber, - ) -> Result<(Vec, mmr::BatchProof), mmr::Error> { + _best_known_block_number: Option, + ) -> Result<(Vec, mmr::Proof), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } - fn verify_batch_proof(_leaves: Vec, _proof: mmr::BatchProof) + fn verify_proof(_leaves: Vec, _proof: mmr::Proof) -> Result<(), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } - fn verify_batch_proof_stateless( + fn verify_proof_stateless( _root: Hash, _leaves: Vec, - _proof: mmr::BatchProof + _proof: mmr::Proof ) -> Result<(), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } diff --git a/runtime/kusama/src/tests.rs b/runtime/kusama/src/tests.rs index 12d02da131f8..ef09a9dc6131 100644 --- a/runtime/kusama/src/tests.rs +++ b/runtime/kusama/src/tests.rs @@ -137,40 +137,6 @@ fn nominator_limit() { println!("can support {} nominators to yield a weight of {}", active, weight_with(active)); } -#[test] -fn compute_inflation_should_give_sensible_results() { - assert_eq!( - pallet_staking_reward_fn::compute_inflation( - Perquintill::from_percent(75), - Perquintill::from_percent(75), - Perquintill::from_percent(5), - ), - Perquintill::one() - ); - assert_eq!( - pallet_staking_reward_fn::compute_inflation( - Perquintill::from_percent(50), - Perquintill::from_percent(75), - Perquintill::from_percent(5), - ), - Perquintill::from_rational(2u64, 3u64) - ); - assert_eq!( - pallet_staking_reward_fn::compute_inflation( - Perquintill::from_percent(80), - Perquintill::from_percent(75), - Perquintill::from_percent(5), - ), - Perquintill::from_rational(1u64, 2u64) - ); -} - -#[test] -fn era_payout_should_give_sensible_results() { - assert_eq!(era_payout(75, 100, Perquintill::from_percent(10), Perquintill::one(), 0,), (10, 0)); - assert_eq!(era_payout(80, 100, Perquintill::from_percent(10), Perquintill::one(), 0,), (6, 4)); -} - #[test] fn call_size() { RuntimeCall::assert_size_under(230); diff --git a/runtime/kusama/src/weights/pallet_multisig.rs b/runtime/kusama/src/weights/pallet_multisig.rs index 8734b8800cfa..b034fafcd8cc 100644 --- a/runtime/kusama/src/weights/pallet_multisig.rs +++ b/runtime/kusama/src/weights/pallet_multisig.rs @@ -16,8 +16,8 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-09-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-10-26, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -28,17 +28,17 @@ // --steps=50 // --repeat=20 // --pallet=pallet_multisig -// --extrinsic=* +// --extrinsic= // --execution=wasm // --wasm-execution=compiled // --header=./file_header.txt -// --output=./runtime/kusama/src/weights/ +// --output=runtime/kusama/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::{traits::Get, weights::{Weight}}; +use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; /// Weight functions for `pallet_multisig`. @@ -46,115 +46,81 @@ pub struct WeightInfo(PhantomData); impl pallet_multisig::WeightInfo for WeightInfo { /// The range of component `z` is `[0, 10000]`. fn as_multi_threshold_1(z: u32, ) -> Weight { - Weight::from_ref_time(14_892_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 14_233 nanoseconds. + Weight::from_ref_time(14_763_390 as u64) + // Standard Error: 2 + .saturating_add(Weight::from_ref_time(479 as u64).saturating_mul(z as u64)) } // Storage: Multisig Multisigs (r:1 w:1) // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) /// The range of component `s` is `[2, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_create(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(36_762_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(61_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 42_837 nanoseconds. + Weight::from_ref_time(34_846_149 as u64) + // Standard Error: 646 + .saturating_add(Weight::from_ref_time(89_482 as u64).saturating_mul(s as u64)) + // Standard Error: 6 + .saturating_add(Weight::from_ref_time(1_465 as u64).saturating_mul(z as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_create_store(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(38_454_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(70_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) /// The range of component `s` is `[3, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_approve(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(27_278_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(56_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 32_269 nanoseconds. + Weight::from_ref_time(25_447_784 as u64) + // Standard Error: 499 + .saturating_add(Weight::from_ref_time(74_525 as u64).saturating_mul(s as u64)) + // Standard Error: 4 + .saturating_add(Weight::from_ref_time(1_457 as u64).saturating_mul(z as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - /// The range of component `s` is `[3, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_approve_store(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(39_820_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(70_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) // Storage: System Account (r:1 w:1) /// The range of component `s` is `[2, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_complete(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(48_748_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(75_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + // Minimum execution time: 46_096 nanoseconds. + Weight::from_ref_time(37_139_587 as u64) + // Standard Error: 602 + .saturating_add(Weight::from_ref_time(104_199 as u64).saturating_mul(s as u64)) + // Standard Error: 5 + .saturating_add(Weight::from_ref_time(1_478 as u64).saturating_mul(z as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) /// The range of component `s` is `[2, 100]`. fn approve_as_multi_create(s: u32, ) -> Weight { - Weight::from_ref_time(32_837_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(97_000 as u64).saturating_mul(s as u64)) + // Minimum execution time: 31_572 nanoseconds. + Weight::from_ref_time(33_475_485 as u64) + // Standard Error: 972 + .saturating_add(Weight::from_ref_time(91_041 as u64).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:0) /// The range of component `s` is `[2, 100]`. fn approve_as_multi_approve(s: u32, ) -> Weight { - Weight::from_ref_time(23_222_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(92_000 as u64).saturating_mul(s as u64)) + // Minimum execution time: 21_861 nanoseconds. + Weight::from_ref_time(23_986_670 as u64) + // Standard Error: 660 + .saturating_add(Weight::from_ref_time(79_765 as u64).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_complete(s: u32, ) -> Weight { - Weight::from_ref_time(60_799_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(117_000 as u64).saturating_mul(s as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) /// The range of component `s` is `[2, 100]`. fn cancel_as_multi(s: u32, ) -> Weight { - Weight::from_ref_time(49_388_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(95_000 as u64).saturating_mul(s as u64)) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 31_375 nanoseconds. + Weight::from_ref_time(33_657_765 as u64) + // Standard Error: 931 + .saturating_add(Weight::from_ref_time(84_177 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } } diff --git a/runtime/parachains/Cargo.toml b/runtime/parachains/Cargo.toml index 4361f443d9a9..cb8b989ccdda 100644 --- a/runtime/parachains/Cargo.toml +++ b/runtime/parachains/Cargo.toml @@ -57,6 +57,7 @@ test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../pri sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" } thousands = "0.2.0" assert_matches = "1" +serde_json = "1.0.85" [features] default = ["std"] diff --git a/runtime/parachains/src/builder.rs b/runtime/parachains/src/builder.rs index f4bc58f2d4f2..9a1c16e6aa1d 100644 --- a/runtime/parachains/src/builder.rs +++ b/runtime/parachains/src/builder.rs @@ -16,6 +16,7 @@ use crate::{ configuration, inclusion, initializer, paras, + paras::ParaKind, paras_inherent::{self}, scheduler, session_info, shared, }; @@ -345,7 +346,7 @@ impl BenchBuilder { paras::ParaGenesisArgs { genesis_head: Self::mock_head_data(), validation_code: mock_validation_code(), - parachain: true, + para_kind: ParaKind::Parachain, }, ) .unwrap(); diff --git a/runtime/parachains/src/hrmp/benchmarking.rs b/runtime/parachains/src/hrmp/benchmarking.rs index 7ea14b1dc922..562e735e6a50 100644 --- a/runtime/parachains/src/hrmp/benchmarking.rs +++ b/runtime/parachains/src/hrmp/benchmarking.rs @@ -17,7 +17,7 @@ use crate::{ configuration::Pallet as Configuration, hrmp::{Pallet as Hrmp, *}, - paras::{Pallet as Paras, ParachainsCache}, + paras::{Pallet as Paras, ParaKind, ParachainsCache}, shared::Pallet as Shared, }; use frame_support::{assert_ok, traits::Currency}; @@ -31,7 +31,7 @@ fn register_parachain_with_balance(id: ParaId, balance: BalanceOf) &mut parachains, id, &crate::paras::ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: vec![1].into(), validation_code: vec![1].into(), }, diff --git a/runtime/parachains/src/hrmp/tests.rs b/runtime/parachains/src/hrmp/tests.rs index 9e0d0646d057..85cdc459ffb9 100644 --- a/runtime/parachains/src/hrmp/tests.rs +++ b/runtime/parachains/src/hrmp/tests.rs @@ -15,9 +15,12 @@ // along with Polkadot. If not, see . use super::*; -use crate::mock::{ - new_test_ext, Configuration, Hrmp, MockGenesisConfig, Paras, ParasShared, - RuntimeEvent as MockEvent, RuntimeOrigin, System, Test, +use crate::{ + mock::{ + new_test_ext, Configuration, Hrmp, MockGenesisConfig, Paras, ParasShared, + RuntimeEvent as MockEvent, RuntimeOrigin, System, Test, + }, + paras::ParaKind, }; use frame_support::{assert_noop, assert_ok, traits::Currency as _}; use primitives::v2::BlockNumber; @@ -130,7 +133,7 @@ fn register_parachain_with_balance(id: ParaId, balance: Balance) { assert_ok!(Paras::schedule_para_initialize( id, crate::paras::ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: vec![1].into(), validation_code: vec![1].into(), }, diff --git a/runtime/parachains/src/inclusion/tests.rs b/runtime/parachains/src/inclusion/tests.rs index de3199c366a7..00369fb67e75 100644 --- a/runtime/parachains/src/inclusion/tests.rs +++ b/runtime/parachains/src/inclusion/tests.rs @@ -22,7 +22,7 @@ use crate::{ new_test_ext, Configuration, MockGenesisConfig, ParaInclusion, Paras, ParasShared, System, Test, }, - paras::ParaGenesisArgs, + paras::{ParaGenesisArgs, ParaKind}, paras_inherent::DisputedBitfield, scheduler::AssignmentKind, }; @@ -51,18 +51,18 @@ fn default_config() -> HostConfiguration { config } -pub(crate) fn genesis_config(paras: Vec<(ParaId, bool)>) -> MockGenesisConfig { +pub(crate) fn genesis_config(paras: Vec<(ParaId, ParaKind)>) -> MockGenesisConfig { MockGenesisConfig { paras: paras::GenesisConfig { paras: paras .into_iter() - .map(|(id, is_chain)| { + .map(|(id, para_kind)| { ( id, ParaGenesisArgs { genesis_head: Vec::new().into(), validation_code: dummy_validation_code(), - parachain: is_chain, + para_kind, }, ) }) @@ -310,7 +310,11 @@ fn collect_pending_cleans_up_pending() { let chain_b = ParaId::from(2_u32); let thread_a = ParaId::from(3_u32); - let paras = vec![(chain_a, true), (chain_b, true), (thread_a, false)]; + let paras = vec![ + (chain_a, ParaKind::Parachain), + (chain_b, ParaKind::Parachain), + (thread_a, ParaKind::Parathread), + ]; new_test_ext(genesis_config(paras)).execute_with(|| { let default_candidate = TestCandidateBuilder::default().build(); >::insert( @@ -368,7 +372,11 @@ fn bitfield_checks() { let chain_b = ParaId::from(2_u32); let thread_a = ParaId::from(3_u32); - let paras = vec![(chain_a, true), (chain_b, true), (thread_a, false)]; + let paras = vec![ + (chain_a, ParaKind::Parachain), + (chain_b, ParaKind::Parachain), + (thread_a, ParaKind::Parathread), + ]; let validators = vec![ Sr25519Keyring::Alice, Sr25519Keyring::Bob, @@ -711,7 +719,11 @@ fn supermajority_bitfields_trigger_availability() { let chain_b = ParaId::from(2_u32); let thread_a = ParaId::from(3_u32); - let paras = vec![(chain_a, true), (chain_b, true), (thread_a, false)]; + let paras = vec![ + (chain_a, ParaKind::Parachain), + (chain_b, ParaKind::Parachain), + (thread_a, ParaKind::Parathread), + ]; let validators = vec![ Sr25519Keyring::Alice, Sr25519Keyring::Bob, @@ -899,7 +911,11 @@ fn candidate_checks() { // The block number of the relay-parent for testing. const RELAY_PARENT_NUM: BlockNumber = 4; - let paras = vec![(chain_a, true), (chain_b, true), (thread_a, false)]; + let paras = vec![ + (chain_a, ParaKind::Parachain), + (chain_b, ParaKind::Parachain), + (thread_a, ParaKind::Parathread), + ]; let validators = vec![ Sr25519Keyring::Alice, Sr25519Keyring::Bob, @@ -1442,7 +1458,11 @@ fn backing_works() { // The block number of the relay-parent for testing. const RELAY_PARENT_NUM: BlockNumber = 4; - let paras = vec![(chain_a, true), (chain_b, true), (thread_a, false)]; + let paras = vec![ + (chain_a, ParaKind::Parachain), + (chain_b, ParaKind::Parachain), + (thread_a, ParaKind::Parathread), + ]; let validators = vec![ Sr25519Keyring::Alice, Sr25519Keyring::Bob, @@ -1722,7 +1742,7 @@ fn can_include_candidate_with_ok_code_upgrade() { // The block number of the relay-parent for testing. const RELAY_PARENT_NUM: BlockNumber = 4; - let paras = vec![(chain_a, true)]; + let paras = vec![(chain_a, ParaKind::Parachain)]; let validators = vec![ Sr25519Keyring::Alice, Sr25519Keyring::Bob, @@ -1827,7 +1847,11 @@ fn session_change_wipes() { let chain_b = ParaId::from(2_u32); let thread_a = ParaId::from(3_u32); - let paras = vec![(chain_a, true), (chain_b, true), (thread_a, false)]; + let paras = vec![ + (chain_a, ParaKind::Parachain), + (chain_b, ParaKind::Parachain), + (thread_a, ParaKind::Parathread), + ]; let validators = vec![ Sr25519Keyring::Alice, Sr25519Keyring::Bob, diff --git a/runtime/parachains/src/initializer/tests.rs b/runtime/parachains/src/initializer/tests.rs index 7fdf8b6b4a57..d1d884200527 100644 --- a/runtime/parachains/src/initializer/tests.rs +++ b/runtime/parachains/src/initializer/tests.rs @@ -21,6 +21,7 @@ use crate::mock::{ use primitives::v2::{HeadData, Id as ParaId}; use test_helpers::dummy_validation_code; +use crate::paras::ParaKind; use frame_support::{ assert_ok, traits::{OnFinalize, OnInitialize}, @@ -90,7 +91,7 @@ fn scheduled_cleanup_performed() { let c = ParaId::from(123); let mock_genesis = crate::paras::ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: HeadData(vec![4, 5, 6]), validation_code: dummy_validation_code(), }; diff --git a/runtime/parachains/src/mock.rs b/runtime/parachains/src/mock.rs index bc576fa9d4a6..3e6ed79a77c2 100644 --- a/runtime/parachains/src/mock.rs +++ b/runtime/parachains/src/mock.rs @@ -377,7 +377,7 @@ std::thread_local! { static PROCESSED: RefCell> = RefCell::new(vec![]); } -/// Return which messages have been processed by `pocess_upward_message` and clear the buffer. +/// Return which messages have been processed by `process_upward_message` and clear the buffer. pub fn take_processed() -> Vec<(ParaId, UpwardMessage)> { PROCESSED.with(|opt_hook| std::mem::take(&mut *opt_hook.borrow_mut())) } diff --git a/runtime/parachains/src/paras/benchmarking/pvf_check.rs b/runtime/parachains/src/paras/benchmarking/pvf_check.rs index a89315c2857b..e1400ac4297d 100644 --- a/runtime/parachains/src/paras/benchmarking/pvf_check.rs +++ b/runtime/parachains/src/paras/benchmarking/pvf_check.rs @@ -140,7 +140,7 @@ where &mut parachains, id, &ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: HeadData(vec![1, 2, 3, 4]), validation_code: old_validation_code, }, @@ -159,7 +159,7 @@ where let r = Pallet::::schedule_para_initialize( id, ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: HeadData(vec![1, 2, 3, 4]), validation_code: validation_code(), }, diff --git a/runtime/parachains/src/paras/mod.rs b/runtime/parachains/src/paras/mod.rs index 273db30e2839..3c5744b96546 100644 --- a/runtime/parachains/src/paras/mod.rs +++ b/runtime/parachains/src/paras/mod.rs @@ -115,7 +115,7 @@ use primitives::v2::{ ConsensusLog, HeadData, Id as ParaId, PvfCheckStatement, SessionIndex, UpgradeGoAhead, UpgradeRestriction, ValidationCode, ValidationCodeHash, ValidatorSignature, }; -use scale_info::TypeInfo; +use scale_info::{Type, TypeInfo}; use sp_core::RuntimeDebug; use sp_runtime::{ traits::{AppVerify, One, Saturating}, @@ -291,8 +291,76 @@ pub struct ParaGenesisArgs { pub genesis_head: HeadData, /// The initial validation code to use. pub validation_code: ValidationCode, - /// True if parachain, false if parathread. - pub parachain: bool, + /// Parachain or Parathread. + #[cfg_attr(feature = "std", serde(rename = "parachain"))] + pub para_kind: ParaKind, +} + +/// Distinguishes between Parachain and Parathread +#[derive(PartialEq, Eq, Clone, RuntimeDebug)] +pub enum ParaKind { + Parathread, + Parachain, +} + +#[cfg(feature = "std")] +impl Serialize for ParaKind { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + match self { + ParaKind::Parachain => serializer.serialize_bool(true), + ParaKind::Parathread => serializer.serialize_bool(false), + } + } +} + +#[cfg(feature = "std")] +impl<'de> Deserialize<'de> for ParaKind { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + match serde::de::Deserialize::deserialize(deserializer) { + Ok(true) => Ok(ParaKind::Parachain), + Ok(false) => Ok(ParaKind::Parathread), + _ => Err(serde::de::Error::custom("invalid ParaKind serde representation")), + } + } +} + +// Manual encoding, decoding, and TypeInfo as the parakind field in ParaGenesisArgs used to be a bool +impl Encode for ParaKind { + fn size_hint(&self) -> usize { + true.size_hint() + } + + fn using_encoded R>(&self, f: F) -> R { + match self { + ParaKind::Parachain => true.using_encoded(f), + ParaKind::Parathread => false.using_encoded(f), + } + } +} + +impl Decode for ParaKind { + fn decode( + input: &mut I, + ) -> Result { + match bool::decode(input) { + Ok(true) => Ok(ParaKind::Parachain), + Ok(false) => Ok(ParaKind::Parathread), + _ => Err("Invalid ParaKind representation".into()), + } + } +} + +impl TypeInfo for ParaKind { + type Identity = bool; + fn type_info() -> Type { + bool::type_info() + } } /// This enum describes a reason why a particular PVF pre-checking vote was initiated. When the @@ -2021,11 +2089,12 @@ impl Pallet { id: ParaId, genesis_data: &ParaGenesisArgs, ) { - if genesis_data.parachain { - parachains.add(id); - ParaLifecycles::::insert(&id, ParaLifecycle::Parachain); - } else { - ParaLifecycles::::insert(&id, ParaLifecycle::Parathread); + match genesis_data.para_kind { + ParaKind::Parachain => { + parachains.add(id); + ParaLifecycles::::insert(&id, ParaLifecycle::Parachain); + }, + ParaKind::Parathread => ParaLifecycles::::insert(&id, ParaLifecycle::Parathread), } // HACK: see the notice in `schedule_para_initialize`. diff --git a/runtime/parachains/src/paras/tests.rs b/runtime/parachains/src/paras/tests.rs index 766fa00d01b3..f110e2a0d38a 100644 --- a/runtime/parachains/src/paras/tests.rs +++ b/runtime/parachains/src/paras/tests.rs @@ -222,7 +222,7 @@ fn schedule_para_init_rejects_empty_code() { Paras::schedule_para_initialize( 1000.into(), ParaGenesisArgs { - parachain: false, + para_kind: ParaKind::Parathread, genesis_head: dummy_head_data(), validation_code: ValidationCode(vec![]), } @@ -233,7 +233,7 @@ fn schedule_para_init_rejects_empty_code() { assert_ok!(Paras::schedule_para_initialize( 1000.into(), ParaGenesisArgs { - parachain: false, + para_kind: ParaKind::Parathread, genesis_head: dummy_head_data(), validation_code: ValidationCode(vec![1]), } @@ -248,7 +248,7 @@ fn para_past_code_pruning_in_initialize() { ( 0u32.into(), ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: dummy_head_data(), validation_code: dummy_validation_code(), }, @@ -256,7 +256,7 @@ fn para_past_code_pruning_in_initialize() { ( 1u32.into(), ParaGenesisArgs { - parachain: false, + para_kind: ParaKind::Parathread, genesis_head: dummy_head_data(), validation_code: dummy_validation_code(), }, @@ -316,7 +316,7 @@ fn note_new_head_sets_head() { let paras = vec![( 0u32.into(), ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: dummy_head_data(), validation_code: dummy_validation_code(), }, @@ -349,7 +349,7 @@ fn note_past_code_sets_up_pruning_correctly() { ( 0u32.into(), ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: dummy_head_data(), validation_code: dummy_validation_code(), }, @@ -357,7 +357,7 @@ fn note_past_code_sets_up_pruning_correctly() { ( 1u32.into(), ParaGenesisArgs { - parachain: false, + para_kind: ParaKind::Parathread, genesis_head: dummy_head_data(), validation_code: dummy_validation_code(), }, @@ -402,7 +402,7 @@ fn code_upgrade_applied_after_delay() { let paras = vec![( 0u32.into(), ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: dummy_head_data(), validation_code: original_code.clone(), }, @@ -505,7 +505,7 @@ fn code_upgrade_applied_after_delay_even_when_late() { let paras = vec![( 0u32.into(), ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: dummy_head_data(), validation_code: original_code.clone(), }, @@ -590,7 +590,7 @@ fn submit_code_change_when_not_allowed_is_err() { let paras = vec![( 0u32.into(), ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: dummy_head_data(), validation_code: vec![1, 2, 3].into(), }, @@ -658,7 +658,7 @@ fn upgrade_restriction_elapsed_doesnt_mean_can_upgrade() { let paras = vec![( 0u32.into(), ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: dummy_head_data(), validation_code: vec![1, 2, 3].into(), }, @@ -721,7 +721,7 @@ fn full_parachain_cleanup_storage() { let paras = vec![( 0u32.into(), ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: dummy_head_data(), validation_code: original_code.clone(), }, @@ -827,7 +827,7 @@ fn cannot_offboard_ongoing_pvf_check() { let paras = vec![( para_id, ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: Default::default(), validation_code: existing_code, }, @@ -900,7 +900,7 @@ fn para_incoming_at_session() { assert_ok!(Paras::schedule_para_initialize( b, ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: vec![1].into(), validation_code: code_b.clone(), }, @@ -909,7 +909,7 @@ fn para_incoming_at_session() { assert_ok!(Paras::schedule_para_initialize( a, ParaGenesisArgs { - parachain: false, + para_kind: ParaKind::Parathread, genesis_head: vec![2].into(), validation_code: code_a.clone(), }, @@ -918,7 +918,7 @@ fn para_incoming_at_session() { assert_ok!(Paras::schedule_para_initialize( c, ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: vec![3].into(), validation_code: code_c.clone(), }, @@ -994,7 +994,7 @@ fn code_hash_at_returns_up_to_end_of_code_retention_period() { let paras = vec![( 0u32.into(), ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: dummy_head_data(), validation_code: vec![1, 2, 3].into(), }, @@ -1084,7 +1084,7 @@ fn pvf_check_coalescing_onboarding_and_upgrade() { let paras = vec![( a, ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: Default::default(), validation_code: existing_code, }, @@ -1117,7 +1117,7 @@ fn pvf_check_coalescing_onboarding_and_upgrade() { assert_ok!(Paras::schedule_para_initialize( b, ParaGenesisArgs { - parachain: true, + para_kind: ParaKind::Parachain, genesis_head: vec![2].into(), validation_code: validation_code.clone(), }, @@ -1185,7 +1185,7 @@ fn pvf_check_onboarding_reject_on_expiry() { assert_ok!(Paras::schedule_para_initialize( a, ParaGenesisArgs { - parachain: false, + para_kind: ParaKind::Parathread, genesis_head: vec![2].into(), validation_code: validation_code.clone(), }, @@ -1224,7 +1224,7 @@ fn pvf_check_upgrade_reject() { let paras = vec![( a, ParaGenesisArgs { - parachain: false, + para_kind: ParaKind::Parathread, genesis_head: Default::default(), validation_code: old_code, }, @@ -1359,7 +1359,7 @@ fn pvf_check_submit_vote() { assert_ok!(Paras::schedule_para_initialize( 1000.into(), ParaGenesisArgs { - parachain: false, + para_kind: ParaKind::Parathread, genesis_head: vec![2].into(), validation_code: code_a.clone(), }, @@ -1446,7 +1446,7 @@ fn include_pvf_check_statement_refunds_weight() { let paras = vec![( a, ParaGenesisArgs { - parachain: false, + para_kind: ParaKind::Parathread, genesis_head: Default::default(), validation_code: old_code, }, @@ -1723,3 +1723,41 @@ fn verify_upgrade_restriction_signal_is_externally_accessible() { ); }); } + +#[test] +fn parakind_encodes_decodes_to_bool_scale() { + let chain_kind = ParaKind::Parachain.encode(); + let chain_bool = true.encode(); + assert_eq!(chain_kind, chain_bool); + + let chain_dec = ParaKind::decode(&mut chain_kind.as_slice()); + assert_eq!(chain_dec, Ok(ParaKind::Parachain)); + + let thread_kind = ParaKind::Parathread.encode(); + let thread_bool = false.encode(); + assert_eq!(thread_kind, thread_bool); + + let thread_dec = ParaKind::decode(&mut thread_kind.as_slice()); + assert_eq!(thread_dec, Ok(ParaKind::Parathread)); + + assert_eq!(bool::type_info(), ParaKind::type_info()); +} + +#[test] +fn parakind_encodes_decodes_to_bool_serde() { + let chain = ParaKind::Parachain; + let ser_chain = serde_json::to_string(&ParaKind::Parachain).unwrap(); + let de_chain: ParaKind = serde_json::from_str(&ser_chain).unwrap(); + assert_eq!(chain, de_chain); + + let ser_true = serde_json::to_string(&true).unwrap(); + assert_eq!(ser_true, ser_chain); + + let thread = ParaKind::Parathread; + let ser_thread = serde_json::to_string(&thread).unwrap(); + let de_thread: ParaKind = serde_json::from_str(&ser_thread).unwrap(); + assert_eq!(thread, de_thread); + + let ser_false = serde_json::to_string(&false).unwrap(); + assert_eq!(ser_false, ser_thread); +} diff --git a/runtime/parachains/src/scheduler/tests.rs b/runtime/parachains/src/scheduler/tests.rs index b2b5e4236dd5..40ff9db82871 100644 --- a/runtime/parachains/src/scheduler/tests.rs +++ b/runtime/parachains/src/scheduler/tests.rs @@ -26,16 +26,16 @@ use crate::{ mock::{ new_test_ext, Configuration, MockGenesisConfig, Paras, ParasShared, Scheduler, System, Test, }, - paras::ParaGenesisArgs, + paras::{ParaGenesisArgs, ParaKind}, }; -fn schedule_blank_para(id: ParaId, is_chain: bool) { +fn schedule_blank_para(id: ParaId, parakind: ParaKind) { assert_ok!(Paras::schedule_para_initialize( id, ParaGenesisArgs { genesis_head: Vec::new().into(), validation_code: vec![1, 2, 3].into(), - parachain: is_chain, + para_kind: parakind, } )); } @@ -122,7 +122,7 @@ fn add_parathread_claim_works() { let collator = CollatorId::from(Sr25519Keyring::Alice.public()); new_test_ext(genesis_config).execute_with(|| { - schedule_blank_para(thread_id, false); + schedule_blank_para(thread_id, ParaKind::Parathread); assert!(!Paras::is_parathread(thread_id)); @@ -203,7 +203,7 @@ fn cannot_add_claim_when_no_parathread_cores() { let collator = CollatorId::from(Sr25519Keyring::Alice.public()); new_test_ext(genesis_config).execute_with(|| { - schedule_blank_para(thread_id, false); + schedule_blank_para(thread_id, ParaKind::Parathread); assert!(!Paras::is_parathread(thread_id)); @@ -239,9 +239,9 @@ fn session_change_prunes_cores_beyond_retries_and_those_from_non_live_parathread // threads a, b, and c will be live in next session, but not d. { - schedule_blank_para(thread_a, false); - schedule_blank_para(thread_b, false); - schedule_blank_para(thread_c, false); + schedule_blank_para(thread_a, ParaKind::Parathread); + schedule_blank_para(thread_b, ParaKind::Parathread); + schedule_blank_para(thread_c, ParaKind::Parathread); } // set up a queue as if `n_cores` was 4 and with some with many retries. @@ -334,8 +334,8 @@ fn session_change_shuffles_validators() { let chain_b = ParaId::from(2_u32); // ensure that we have 5 groups by registering 2 parachains. - schedule_blank_para(chain_a, true); - schedule_blank_para(chain_b, true); + schedule_blank_para(chain_a, ParaKind::Parachain); + schedule_blank_para(chain_b, ParaKind::Parachain); run_to_block(1, |number| match number { 1 => Some(SessionChangeNotification { @@ -392,9 +392,9 @@ fn session_change_takes_only_max_per_core() { let chain_c = ParaId::from(3_u32); // ensure that we have 5 groups by registering 2 parachains. - schedule_blank_para(chain_a, true); - schedule_blank_para(chain_b, true); - schedule_blank_para(chain_c, false); + schedule_blank_para(chain_a, ParaKind::Parachain); + schedule_blank_para(chain_b, ParaKind::Parachain); + schedule_blank_para(chain_c, ParaKind::Parathread); run_to_block(1, |number| match number { 1 => Some(SessionChangeNotification { @@ -447,13 +447,13 @@ fn schedule_schedules() { assert_eq!(default_config().parathread_cores, 3); // register 2 parachains - schedule_blank_para(chain_a, true); - schedule_blank_para(chain_b, true); + schedule_blank_para(chain_a, ParaKind::Parachain); + schedule_blank_para(chain_b, ParaKind::Parachain); // and 3 parathreads - schedule_blank_para(thread_a, false); - schedule_blank_para(thread_b, false); - schedule_blank_para(thread_c, false); + schedule_blank_para(thread_a, ParaKind::Parathread); + schedule_blank_para(thread_b, ParaKind::Parathread); + schedule_blank_para(thread_c, ParaKind::Parathread); // start a new session to activate, 5 validators for 5 cores. run_to_block(1, |number| match number { @@ -574,15 +574,15 @@ fn schedule_schedules_including_just_freed() { assert_eq!(default_config().parathread_cores, 3); // register 2 parachains - schedule_blank_para(chain_a, true); - schedule_blank_para(chain_b, true); + schedule_blank_para(chain_a, ParaKind::Parachain); + schedule_blank_para(chain_b, ParaKind::Parachain); // and 5 parathreads - schedule_blank_para(thread_a, false); - schedule_blank_para(thread_b, false); - schedule_blank_para(thread_c, false); - schedule_blank_para(thread_d, false); - schedule_blank_para(thread_e, false); + schedule_blank_para(thread_a, ParaKind::Parathread); + schedule_blank_para(thread_b, ParaKind::Parathread); + schedule_blank_para(thread_c, ParaKind::Parathread); + schedule_blank_para(thread_d, ParaKind::Parathread); + schedule_blank_para(thread_e, ParaKind::Parathread); // start a new session to activate, 5 validators for 5 cores. run_to_block(1, |number| match number { @@ -743,9 +743,9 @@ fn schedule_clears_availability_cores() { assert_eq!(default_config().parathread_cores, 3); // register 3 parachains - schedule_blank_para(chain_a, true); - schedule_blank_para(chain_b, true); - schedule_blank_para(chain_c, true); + schedule_blank_para(chain_a, ParaKind::Parachain); + schedule_blank_para(chain_b, ParaKind::Parachain); + schedule_blank_para(chain_c, ParaKind::Parachain); // start a new session to activate, 5 validators for 5 cores. run_to_block(1, |number| match number { @@ -849,8 +849,8 @@ fn schedule_rotates_groups() { new_test_ext(genesis_config).execute_with(|| { assert_eq!(default_config().parathread_cores, 3); - schedule_blank_para(thread_a, false); - schedule_blank_para(thread_b, false); + schedule_blank_para(thread_a, ParaKind::Parathread); + schedule_blank_para(thread_b, ParaKind::Parathread); // start a new session to activate, 5 validators for 5 cores. run_to_block(1, |number| match number { @@ -921,8 +921,8 @@ fn parathread_claims_are_pruned_after_retries() { new_test_ext(genesis_config).execute_with(|| { assert_eq!(default_config().parathread_cores, 3); - schedule_blank_para(thread_a, false); - schedule_blank_para(thread_b, false); + schedule_blank_para(thread_a, ParaKind::Parathread); + schedule_blank_para(thread_b, ParaKind::Parathread); // start a new session to activate, 5 validators for 5 cores. run_to_block(1, |number| match number { @@ -978,8 +978,8 @@ fn availability_predicate_works() { let thread_a = ParaId::from(2_u32); new_test_ext(genesis_config).execute_with(|| { - schedule_blank_para(chain_a, true); - schedule_blank_para(thread_a, false); + schedule_blank_para(chain_a, ParaKind::Parachain); + schedule_blank_para(thread_a, ParaKind::Parathread); // start a new session with our chain & thread registered. run_to_block(1, |number| match number { @@ -1075,8 +1075,8 @@ fn next_up_on_available_uses_next_scheduled_or_none_for_thread() { let collator = CollatorId::from(Sr25519Keyring::Alice.public()); new_test_ext(genesis_config).execute_with(|| { - schedule_blank_para(thread_a, false); - schedule_blank_para(thread_b, false); + schedule_blank_para(thread_a, ParaKind::Parathread); + schedule_blank_para(thread_b, ParaKind::Parathread); // start a new session to activate, 5 validators for 5 cores. run_to_block(1, |number| match number { @@ -1147,8 +1147,8 @@ fn next_up_on_time_out_reuses_claim_if_nothing_queued() { let collator = CollatorId::from(Sr25519Keyring::Alice.public()); new_test_ext(genesis_config).execute_with(|| { - schedule_blank_para(thread_a, false); - schedule_blank_para(thread_b, false); + schedule_blank_para(thread_a, ParaKind::Parathread); + schedule_blank_para(thread_b, ParaKind::Parathread); // start a new session to activate, 5 validators for 5 cores. run_to_block(1, |number| match number { @@ -1222,7 +1222,7 @@ fn next_up_on_available_is_parachain_always() { let chain_a = ParaId::from(1_u32); new_test_ext(genesis_config).execute_with(|| { - schedule_blank_para(chain_a, true); + schedule_blank_para(chain_a, ParaKind::Parachain); // start a new session to activate, 5 validators for 5 cores. run_to_block(1, |number| match number { @@ -1276,7 +1276,7 @@ fn next_up_on_time_out_is_parachain_always() { let chain_a = ParaId::from(1_u32); new_test_ext(genesis_config).execute_with(|| { - schedule_blank_para(chain_a, true); + schedule_blank_para(chain_a, ParaKind::Parachain); // start a new session to activate, 5 validators for 5 cores. run_to_block(1, |number| match number { @@ -1330,8 +1330,8 @@ fn session_change_requires_reschedule_dropping_removed_paras() { let chain_b = ParaId::from(2_u32); // ensure that we have 5 groups by registering 2 parachains. - schedule_blank_para(chain_a, true); - schedule_blank_para(chain_b, true); + schedule_blank_para(chain_a, ParaKind::Parachain); + schedule_blank_para(chain_b, ParaKind::Parachain); run_to_block(1, |number| match number { 1 => Some(SessionChangeNotification { @@ -1409,8 +1409,8 @@ fn parathread_claims_are_pruned_after_deregistration() { new_test_ext(genesis_config).execute_with(|| { assert_eq!(default_config().parathread_cores, 3); - schedule_blank_para(thread_a, false); - schedule_blank_para(thread_b, false); + schedule_blank_para(thread_a, ParaKind::Parathread); + schedule_blank_para(thread_b, ParaKind::Parathread); // start a new session to activate, 5 validators for 5 cores. run_to_block(1, |number| match number { diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index e1a138ab5e0f..0f71a37f425f 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -58,6 +58,7 @@ use primitives::v2::{ CoreState, GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, Moment, Nonce, OccupiedCoreAssumption, PersistedValidationData, ScrapedOnChainVotes, SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, + LOWEST_PUBLIC_ID, }; use sp_core::OpaqueMetadata; use sp_mmr_primitives as mmr; @@ -405,6 +406,9 @@ parameter_types! { /// ... and all of the validators as electable targets. Whilst this is the case, we cannot and /// shall not increase the size of the validator intentions. pub const MaxElectableTargets: u16 = u16::MAX; + /// Setup election pallet to support maximum winners upto 1200. This will mean Staking Pallet + /// cannot have active validators higher than this count. + pub const MaxActiveValidators: u32 = 1200; } generate_solution_type!( @@ -423,6 +427,9 @@ impl onchain::Config for OnChainSeqPhragmen { type Solver = SequentialPhragmen; type DataProvider = Staking; type WeightInfo = weights::frame_election_provider_support::WeightInfo; + type MaxWinners = MaxActiveValidators; + type VotersBound = MaxElectingVoters; + type TargetsBound = MaxElectableTargets; } impl pallet_election_provider_multi_phase::MinerConfig for Runtime { @@ -470,10 +477,15 @@ impl pallet_election_provider_multi_phase::Config for Runtime { type MinerTxPriority = NposSolutionPriority; type DataProvider = Staking; #[cfg(feature = "fast-runtime")] - type Fallback = onchain::UnboundedExecution; + type Fallback = onchain::OnChainExecution; #[cfg(not(feature = "fast-runtime"))] - type Fallback = pallet_election_provider_multi_phase::NoFallback; - type GovernanceFallback = onchain::UnboundedExecution; + type Fallback = frame_election_provider_support::NoElection<( + AccountId, + BlockNumber, + Staking, + MaxActiveValidators, + )>; + type GovernanceFallback = onchain::OnChainExecution; type Solver = SequentialPhragmen< AccountId, pallet_election_provider_multi_phase::SolutionAccuracyOf, @@ -487,6 +499,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime { type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo; type MaxElectingVoters = MaxElectingVoters; type MaxElectableTargets = MaxElectableTargets; + type MaxWinners = MaxActiveValidators; } parameter_types! { @@ -525,7 +538,7 @@ parameter_types! { pub const BondingDuration: sp_staking::EraIndex = 28; pub const SlashDeferDuration: sp_staking::EraIndex = 27; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; - pub const MaxNominatorRewardedPerValidator: u32 = 256; + pub const MaxNominatorRewardedPerValidator: u32 = 512; pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); // 16 pub const MaxNominations: u32 = ::LIMIT as u32; @@ -536,6 +549,35 @@ type SlashCancelOrigin = EitherOfDiverse< pallet_collective::EnsureProportionAtLeast, >; +pub struct EraPayout; +impl pallet_staking::EraPayout for EraPayout { + fn era_payout( + total_staked: Balance, + total_issuance: Balance, + era_duration_millis: u64, + ) -> (Balance, Balance) { + // all para-ids that are not active. + let auctioned_slots = Paras::parachains() + .into_iter() + // all active para-ids that do not belong to a system or common good chain is the number + // of parachains that we should take into account for inflation. + .filter(|i| *i >= LOWEST_PUBLIC_ID) + .count() as u64; + + const MAX_ANNUAL_INFLATION: Perquintill = Perquintill::from_percent(10); + const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100; + + runtime_common::impls::era_payout( + total_staked, + // Polkadot has no notion of gilts, the entire issuance is non-guilt. + total_issuance, + MAX_ANNUAL_INFLATION, + Perquintill::from_rational(era_duration_millis, MILLISECONDS_PER_YEAR), + auctioned_slots, + ) + } +} + impl pallet_staking::Config for Runtime { type MaxNominations = MaxNominations; type Currency = Balances; @@ -552,12 +594,12 @@ impl pallet_staking::Config for Runtime { // A super-majority of the council can cancel the slash. type SlashCancelOrigin = SlashCancelOrigin; type SessionInterface = Self; - type EraPayout = pallet_staking::ConvertCurve; + type EraPayout = EraPayout; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type OffendingValidatorsThreshold = OffendingValidatorsThreshold; type NextNewSession = Session; type ElectionProvider = ElectionProviderMultiPhase; - type GenesisElectionProvider = onchain::UnboundedExecution; + type GenesisElectionProvider = onchain::OnChainExecution; type VoterList = VoterList; type TargetList = UseValidatorsMap; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; @@ -569,13 +611,15 @@ impl pallet_staking::Config for Runtime { impl pallet_fast_unstake::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type DepositCurrency = Balances; + type Currency = Balances; + type BatchSize = frame_support::traits::ConstU32<64>; type Deposit = frame_support::traits::ConstU128<{ UNITS }>; type ControlOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; type WeightInfo = weights::pallet_fast_unstake::WeightInfo; + type Staking = Staking; } parameter_types! { @@ -1018,7 +1062,7 @@ parameter_types! { pub const DepositBase: Balance = deposit(1, 88); // Additional storage item size of 32 bytes. pub const DepositFactor: Balance = deposit(0, 32); - pub const MaxSignatories: u16 = 100; + pub const MaxSignatories: u32 = 100; } impl pallet_multisig::Config for Runtime { @@ -1378,11 +1422,10 @@ parameter_types! { impl pallet_nomination_pools::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Currency = Balances; - type CurrencyBalance = Balance; type RewardCounter = FixedU128; type BalanceToU256 = runtime_common::BalanceToU256; type U256ToBalance = runtime_common::U256ToBalance; - type StakingInterface = Staking; + type Staking = Staking; type PostUnbondingPoolsWindow = frame_support::traits::ConstU32<4>; type MaxMetadataLen = frame_support::traits::ConstU32<256>; // we use the same number of allowed unlocking chunks as with staking. @@ -1498,7 +1541,7 @@ 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} = 56, + Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, Dmp: parachains_dmp::{Pallet, Call, Storage} = 58, Ump: parachains_ump::{Pallet, Call, Storage, Event} = 59, @@ -1558,12 +1601,6 @@ pub type Executive = frame_executive::Executive< Runtime, AllPalletsWithSystem, ( - pallet_staking::migrations::v11::MigrateToV11< - Runtime, - VoterList, - StakingMigrationV11OldPallet, - >, - pallet_staking::migrations::v12::MigrateToV12, // "Bound uses of call" pallet_preimage::migration::v1::Migration, pallet_scheduler::migration::v3::MigrateToV4, @@ -1572,6 +1609,7 @@ pub type Executive = frame_executive::Executive< // "Properly migrate weights to v2" parachains_configuration::migration::v3::MigrateToV3, pallet_election_provider_multi_phase::migrations::v1::MigrateToV1, + pallet_fast_unstake::migrations::v1::MigrateToV1, ), >; @@ -1810,53 +1848,27 @@ sp_api::impl_runtime_apis! { } impl mmr::MmrApi for Runtime { - fn generate_proof(_block_number: BlockNumber) - -> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof), mmr::Error> - { - Err(mmr::Error::PalletNotIncluded) - } - - fn verify_proof(_leaf: mmr::EncodableOpaqueLeaf, _proof: mmr::Proof) - -> Result<(), mmr::Error> - { - Err(mmr::Error::PalletNotIncluded) - } - - fn verify_proof_stateless( - _root: Hash, - _leaf: mmr::EncodableOpaqueLeaf, - _proof: mmr::Proof - ) -> Result<(), mmr::Error> { - Err(mmr::Error::PalletNotIncluded) - } - fn mmr_root() -> Result { Err(mmr::Error::PalletNotIncluded) } - fn generate_batch_proof(_block_numbers: Vec) - -> Result<(Vec, mmr::BatchProof), mmr::Error> - { - Err(mmr::Error::PalletNotIncluded) - } - - fn generate_historical_batch_proof( + fn generate_proof( _block_numbers: Vec, - _best_known_block_number: BlockNumber, - ) -> Result<(Vec, mmr::BatchProof), mmr::Error> { + _best_known_block_number: Option, + ) -> Result<(Vec, mmr::Proof), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } - fn verify_batch_proof(_leaves: Vec, _proof: mmr::BatchProof) + fn verify_proof(_leaves: Vec, _proof: mmr::Proof) -> Result<(), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } - fn verify_batch_proof_stateless( + fn verify_proof_stateless( _root: Hash, _leaves: Vec, - _proof: mmr::BatchProof + _proof: mmr::Proof ) -> Result<(), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } diff --git a/runtime/polkadot/src/weights/pallet_multisig.rs b/runtime/polkadot/src/weights/pallet_multisig.rs index 669eac53c453..cd8a795eeaa3 100644 --- a/runtime/polkadot/src/weights/pallet_multisig.rs +++ b/runtime/polkadot/src/weights/pallet_multisig.rs @@ -16,8 +16,8 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-09-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-10-26, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -28,17 +28,17 @@ // --steps=50 // --repeat=20 // --pallet=pallet_multisig -// --extrinsic=* +// --extrinsic= // --execution=wasm // --wasm-execution=compiled // --header=./file_header.txt -// --output=./runtime/polkadot/src/weights/ +// --output=runtime/polkadot/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::{traits::Get, weights::{Weight}}; +use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; /// Weight functions for `pallet_multisig`. @@ -46,115 +46,81 @@ pub struct WeightInfo(PhantomData); impl pallet_multisig::WeightInfo for WeightInfo { /// The range of component `z` is `[0, 10000]`. fn as_multi_threshold_1(z: u32, ) -> Weight { - Weight::from_ref_time(14_564_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 14_333 nanoseconds. + Weight::from_ref_time(14_680_513 as u64) + // Standard Error: 3 + .saturating_add(Weight::from_ref_time(478 as u64).saturating_mul(z as u64)) } // Storage: Multisig Multisigs (r:1 w:1) // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) /// The range of component `s` is `[2, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_create(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(36_007_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(60_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 41_940 nanoseconds. + Weight::from_ref_time(34_164_952 as u64) + // Standard Error: 758 + .saturating_add(Weight::from_ref_time(84_361 as u64).saturating_mul(s as u64)) + // Standard Error: 7 + .saturating_add(Weight::from_ref_time(1_515 as u64).saturating_mul(z as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_create_store(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(37_644_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) /// The range of component `s` is `[3, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_approve(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(26_146_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(56_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 32_061 nanoseconds. + Weight::from_ref_time(25_242_175 as u64) + // Standard Error: 488 + .saturating_add(Weight::from_ref_time(74_544 as u64).saturating_mul(s as u64)) + // Standard Error: 4 + .saturating_add(Weight::from_ref_time(1_451 as u64).saturating_mul(z as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - /// The range of component `s` is `[3, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_approve_store(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(38_712_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(67_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) // Storage: System Account (r:1 w:1) /// The range of component `s` is `[2, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_complete(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(47_690_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(72_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + // Minimum execution time: 45_799 nanoseconds. + Weight::from_ref_time(36_673_371 as u64) + // Standard Error: 602 + .saturating_add(Weight::from_ref_time(105_602 as u64).saturating_mul(s as u64)) + // Standard Error: 5 + .saturating_add(Weight::from_ref_time(1_489 as u64).saturating_mul(z as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) /// The range of component `s` is `[2, 100]`. fn approve_as_multi_create(s: u32, ) -> Weight { - Weight::from_ref_time(32_053_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(95_000 as u64).saturating_mul(s as u64)) + // Minimum execution time: 30_746 nanoseconds. + Weight::from_ref_time(33_495_066 as u64) + // Standard Error: 1_027 + .saturating_add(Weight::from_ref_time(85_901 as u64).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:0) /// The range of component `s` is `[2, 100]`. fn approve_as_multi_approve(s: u32, ) -> Weight { - Weight::from_ref_time(22_641_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(87_000 as u64).saturating_mul(s as u64)) + // Minimum execution time: 21_939 nanoseconds. + Weight::from_ref_time(23_359_812 as u64) + // Standard Error: 626 + .saturating_add(Weight::from_ref_time(86_183 as u64).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_complete(s: u32, ) -> Weight { - Weight::from_ref_time(57_308_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(109_000 as u64).saturating_mul(s as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) /// The range of component `s` is `[2, 100]`. fn cancel_as_multi(s: u32, ) -> Weight { - Weight::from_ref_time(47_050_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(94_000 as u64).saturating_mul(s as u64)) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 32_246 nanoseconds. + Weight::from_ref_time(33_400_827 as u64) + // Standard Error: 746 + .saturating_add(Weight::from_ref_time(85_743 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } } diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 39729c77b28f..b230832b7454 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -793,7 +793,7 @@ parameter_types! { pub const DepositBase: Balance = deposit(1, 88); // Additional storage item size of 32 bytes. pub const DepositFactor: Balance = deposit(0, 32); - pub const MaxSignatories: u16 = 100; + pub const MaxSignatories: u32 = 100; } impl pallet_multisig::Config for Runtime { @@ -1385,7 +1385,7 @@ 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} = 56, + Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 56, Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, Dmp: parachains_dmp::{Pallet, Call, Storage} = 58, Ump: parachains_ump::{Pallet, Call, Storage, Event} = 59, @@ -1719,52 +1719,15 @@ sp_api::impl_runtime_apis! { } impl mmr::MmrApi for Runtime { - fn generate_proof(block_number: BlockNumber) - -> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof), mmr::Error> - { - Mmr::generate_batch_proof(vec![block_number]) - .and_then(|(leaves, proof)| Ok(( - mmr::EncodableOpaqueLeaf::from_leaf(&leaves[0]), - mmr::BatchProof::into_single_leaf_proof(proof)? - ))) - } - - fn verify_proof(leaf: mmr::EncodableOpaqueLeaf, proof: mmr::Proof) - -> Result<(), mmr::Error> - { - pub type MmrLeaf = <::LeafData as mmr::LeafDataProvider>::LeafData; - let leaf: MmrLeaf = leaf - .into_opaque_leaf() - .try_decode() - .ok_or(mmr::Error::Verify)?; - Mmr::verify_leaves(vec![leaf], mmr::Proof::into_batch_proof(proof)) - } - - fn verify_proof_stateless( - root: Hash, - leaf: mmr::EncodableOpaqueLeaf, - proof: mmr::Proof - ) -> Result<(), mmr::Error> { - let node = mmr::DataOrHash::Data(leaf.into_opaque_leaf()); - pallet_mmr::verify_leaves_proof::(root, vec![node], mmr::Proof::into_batch_proof(proof)) - } - fn mmr_root() -> Result { Ok(Mmr::mmr_root()) } - fn generate_batch_proof(block_numbers: Vec) - -> Result<(Vec, mmr::BatchProof), mmr::Error> - { - Mmr::generate_batch_proof(block_numbers) - .map(|(leaves, proof)| (leaves.into_iter().map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof)) - } - - fn generate_historical_batch_proof( + fn generate_proof( block_numbers: Vec, - best_known_block_number: BlockNumber, - ) -> Result<(Vec, mmr::BatchProof), mmr::Error> { - Mmr::generate_historical_batch_proof(block_numbers, best_known_block_number).map( + best_known_block_number: Option, + ) -> Result<(Vec, mmr::Proof), mmr::Error> { + Mmr::generate_proof(block_numbers, best_known_block_number).map( |(leaves, proof)| { ( leaves @@ -1777,7 +1740,7 @@ sp_api::impl_runtime_apis! { ) } - fn verify_batch_proof(leaves: Vec, proof: mmr::BatchProof) + fn verify_proof(leaves: Vec, proof: mmr::Proof) -> Result<(), mmr::Error> { pub type MmrLeaf = <::LeafData as mmr::LeafDataProvider>::LeafData; @@ -1788,10 +1751,10 @@ sp_api::impl_runtime_apis! { Mmr::verify_leaves(leaves, proof) } - fn verify_batch_proof_stateless( + fn verify_proof_stateless( root: Hash, leaves: Vec, - proof: mmr::BatchProof + proof: mmr::Proof ) -> Result<(), mmr::Error> { let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect(); pallet_mmr::verify_leaves_proof::(root, nodes, proof) diff --git a/runtime/rococo/src/weights/pallet_multisig.rs b/runtime/rococo/src/weights/pallet_multisig.rs index 7a6fd3346d79..300e4704ef8d 100644 --- a/runtime/rococo/src/weights/pallet_multisig.rs +++ b/runtime/rococo/src/weights/pallet_multisig.rs @@ -16,8 +16,8 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-09-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-10-26, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -28,131 +28,99 @@ // --steps=50 // --repeat=20 // --pallet=pallet_multisig -// --extrinsic=* +// --extrinsic= // --execution=wasm // --wasm-execution=compiled // --header=./file_header.txt -// --output=./runtime/rococo/src/weights/ +// --output=runtime/rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::{traits::Get, weights::{Weight}}; +use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; /// Weight functions for `pallet_multisig`. pub struct WeightInfo(PhantomData); impl pallet_multisig::WeightInfo for WeightInfo { /// The range of component `z` is `[0, 10000]`. - fn as_multi_threshold_1(_z: u32, ) -> Weight { - Weight::from_ref_time(15_357_000 as u64) + fn as_multi_threshold_1(z: u32, ) -> Weight { + // Minimum execution time: 14_582 nanoseconds. + Weight::from_ref_time(15_014_888 as u64) + // Standard Error: 2 + .saturating_add(Weight::from_ref_time(490 as u64).saturating_mul(z as u64)) } // Storage: Multisig Multisigs (r:1 w:1) // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) /// The range of component `s` is `[2, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_create(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(34_635_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(63_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 41_651 nanoseconds. + Weight::from_ref_time(34_224_425 as u64) + // Standard Error: 735 + .saturating_add(Weight::from_ref_time(80_357 as u64).saturating_mul(s as u64)) + // Standard Error: 7 + .saturating_add(Weight::from_ref_time(1_489 as u64).saturating_mul(z as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_create_store(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(35_863_000 as u64) - // Standard Error: 2_000 - .saturating_add(Weight::from_ref_time(72_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) /// The range of component `s` is `[3, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_approve(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(26_665_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(55_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 31_520 nanoseconds. + Weight::from_ref_time(24_283_932 as u64) + // Standard Error: 615 + .saturating_add(Weight::from_ref_time(80_034 as u64).saturating_mul(s as u64)) + // Standard Error: 6 + .saturating_add(Weight::from_ref_time(1_490 as u64).saturating_mul(z as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - /// The range of component `s` is `[3, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_approve_store(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(37_789_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(70_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) // Storage: System Account (r:1 w:1) /// The range of component `s` is `[2, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_complete(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(46_827_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(84_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + // Minimum execution time: 44_639 nanoseconds. + Weight::from_ref_time(35_788_014 as u64) + // Standard Error: 655 + .saturating_add(Weight::from_ref_time(103_738 as u64).saturating_mul(s as u64)) + // Standard Error: 6 + .saturating_add(Weight::from_ref_time(1_480 as u64).saturating_mul(z as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) /// The range of component `s` is `[2, 100]`. fn approve_as_multi_create(s: u32, ) -> Weight { - Weight::from_ref_time(31_062_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(97_000 as u64).saturating_mul(s as u64)) + // Minimum execution time: 30_092 nanoseconds. + Weight::from_ref_time(32_588_553 as u64) + // Standard Error: 1_203 + .saturating_add(Weight::from_ref_time(88_907 as u64).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:0) /// The range of component `s` is `[2, 100]`. fn approve_as_multi_approve(s: u32, ) -> Weight { - Weight::from_ref_time(22_903_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(88_000 as u64).saturating_mul(s as u64)) + // Minimum execution time: 21_743 nanoseconds. + Weight::from_ref_time(23_807_430 as u64) + // Standard Error: 828 + .saturating_add(Weight::from_ref_time(75_548 as u64).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_complete(s: u32, ) -> Weight { - Weight::from_ref_time(55_802_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(113_000 as u64).saturating_mul(s as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) /// The range of component `s` is `[2, 100]`. fn cancel_as_multi(s: u32, ) -> Weight { - Weight::from_ref_time(48_468_000 as u64) - // Standard Error: 4_000 - .saturating_add(Weight::from_ref_time(72_000 as u64).saturating_mul(s as u64)) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 29_786 nanoseconds. + Weight::from_ref_time(32_090_251 as u64) + // Standard Error: 904 + .saturating_add(Weight::from_ref_time(84_395 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } } diff --git a/runtime/test-runtime/src/lib.rs b/runtime/test-runtime/src/lib.rs index 8a9e128befa8..0210f1ecd8b7 100644 --- a/runtime/test-runtime/src/lib.rs +++ b/runtime/test-runtime/src/lib.rs @@ -319,6 +319,9 @@ parameter_types! { pub storage MaxNominatorRewardedPerValidator: u32 = 64; pub storage OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); pub const MaxAuthorities: u32 = 100_000; + pub const OnChainMaxWinners: u32 = u32::MAX; + pub const MaxElectingVoters: u32 = u32::MAX; + pub const MaxElectableTargets: u16 = u16::MAX; } pub struct OnChainSeqPhragmen; @@ -327,6 +330,9 @@ impl onchain::Config for OnChainSeqPhragmen { type Solver = SequentialPhragmen; type DataProvider = Staking; type WeightInfo = (); + type MaxWinners = OnChainMaxWinners; + type VotersBound = MaxElectingVoters; + type TargetsBound = MaxElectableTargets; } impl pallet_staking::Config for Runtime { @@ -349,8 +355,8 @@ impl pallet_staking::Config for Runtime { type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type OffendingValidatorsThreshold = OffendingValidatorsThreshold; type NextNewSession = Session; - type ElectionProvider = onchain::UnboundedExecution; - type GenesisElectionProvider = onchain::UnboundedExecution; + type ElectionProvider = onchain::OnChainExecution; + type GenesisElectionProvider = onchain::OnChainExecution; // Use the nominator map to iter voter AND no-ops for all SortedListProvider hooks. The migration // to bags-list is a no-op, but the storage version will be updated. type VoterList = pallet_staking::UseNominatorsAndValidatorsMap; @@ -696,7 +702,7 @@ construct_runtime! { ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event}, ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent}, Initializer: parachains_initializer::{Pallet, Call, Storage}, - Paras: parachains_paras::{Pallet, Call, Storage, Event}, + Paras: parachains_paras::{Pallet, Call, Storage, Event, ValidateUnsigned}, ParasShared: parachains_shared::{Pallet, Call, Storage}, Scheduler: parachains_scheduler::{Pallet, Storage}, ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call}, @@ -920,53 +926,27 @@ sp_api::impl_runtime_apis! { } impl mmr::MmrApi for Runtime { - fn generate_proof(_block_number: BlockNumber) - -> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof), mmr::Error> - { - Err(mmr::Error::PalletNotIncluded) - } - - fn verify_proof(_leaf: mmr::EncodableOpaqueLeaf, _proof: mmr::Proof) - -> Result<(), mmr::Error> - { - Err(mmr::Error::PalletNotIncluded) - } - - fn verify_proof_stateless( - _root: Hash, - _leaf: mmr::EncodableOpaqueLeaf, - _proof: mmr::Proof - ) -> Result<(), mmr::Error> { - Err(mmr::Error::PalletNotIncluded) - } - fn mmr_root() -> Result { Err(mmr::Error::PalletNotIncluded) } - fn generate_batch_proof(_block_numbers: Vec) - -> Result<(Vec, mmr::BatchProof), mmr::Error> - { - Err(mmr::Error::PalletNotIncluded) - } - - fn generate_historical_batch_proof( + fn generate_proof( _block_numbers: Vec, - _best_known_block_number: BlockNumber, - ) -> Result<(Vec, mmr::BatchProof), mmr::Error> { + _best_known_block_number: Option, + ) -> Result<(Vec, mmr::Proof), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } - fn verify_batch_proof(_leaves: Vec, _proof: mmr::BatchProof) + fn verify_proof(_leaves: Vec, _proof: mmr::Proof) -> Result<(), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } - fn verify_batch_proof_stateless( + fn verify_proof_stateless( _root: Hash, _leaves: Vec, - _proof: mmr::BatchProof + _proof: mmr::Proof ) -> Result<(), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index d77675eb86b2..a7930ff06ea6 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -366,6 +366,9 @@ parameter_types! { /// ... and all of the validators as electable targets. Whilst this is the case, we cannot and /// shall not increase the size of the validator intentions. pub const MaxElectableTargets: u16 = u16::MAX; + // Maximum winners that can be chosen as active validators + pub const MaxActiveValidators: u32 = 1000; + } frame_election_provider_support::generate_solution_type!( @@ -384,6 +387,9 @@ impl onchain::Config for OnChainSeqPhragmen { type Solver = SequentialPhragmen; type DataProvider = Staking; type WeightInfo = weights::frame_election_provider_support::WeightInfo; + type MaxWinners = MaxActiveValidators; + type VotersBound = MaxElectingVoters; + type TargetsBound = MaxElectableTargets; } impl pallet_election_provider_multi_phase::MinerConfig for Runtime { @@ -431,10 +437,15 @@ impl pallet_election_provider_multi_phase::Config for Runtime { type MinerTxPriority = NposSolutionPriority; type DataProvider = Staking; #[cfg(any(feature = "fast-runtime", feature = "runtime-benchmarks"))] - type Fallback = onchain::UnboundedExecution; + type Fallback = onchain::OnChainExecution; #[cfg(not(any(feature = "fast-runtime", feature = "runtime-benchmarks")))] - type Fallback = pallet_election_provider_multi_phase::NoFallback; - type GovernanceFallback = onchain::UnboundedExecution; + type Fallback = frame_election_provider_support::NoElection<( + AccountId, + BlockNumber, + Staking, + MaxActiveValidators, + )>; + type GovernanceFallback = onchain::OnChainExecution; type Solver = SequentialPhragmen< AccountId, pallet_election_provider_multi_phase::SolutionAccuracyOf, @@ -445,6 +456,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime { type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo; type MaxElectingVoters = MaxElectingVoters; type MaxElectableTargets = MaxElectableTargets; + type MaxWinners = MaxActiveValidators; } parameter_types! { @@ -505,7 +517,7 @@ impl pallet_staking::Config for Runtime { type OffendingValidatorsThreshold = OffendingValidatorsThreshold; type NextNewSession = Session; type ElectionProvider = ElectionProviderMultiPhase; - type GenesisElectionProvider = onchain::UnboundedExecution; + type GenesisElectionProvider = onchain::OnChainExecution; type VoterList = VoterList; type TargetList = UseValidatorsMap; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; @@ -517,10 +529,12 @@ impl pallet_staking::Config for Runtime { impl pallet_fast_unstake::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type DepositCurrency = Balances; + type Currency = Balances; + type BatchSize = frame_support::traits::ConstU32<64>; type Deposit = frame_support::traits::ConstU128<{ UNITS }>; type ControlOrigin = EnsureRoot; type WeightInfo = weights::pallet_fast_unstake::WeightInfo; + type Staking = Staking; } parameter_types! { @@ -679,7 +693,7 @@ parameter_types! { pub const DepositBase: Balance = deposit(1, 88); // Additional storage item size of 32 bytes. pub const DepositFactor: Balance = deposit(0, 32); - pub const MaxSignatories: u16 = 100; + pub const MaxSignatories: u32 = 100; } impl pallet_multisig::Config for Runtime { @@ -1060,11 +1074,10 @@ impl pallet_nomination_pools::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = weights::pallet_nomination_pools::WeightInfo; type Currency = Balances; - type CurrencyBalance = Balance; type RewardCounter = FixedU128; type BalanceToU256 = BalanceToU256; type U256ToBalance = U256ToBalance; - type StakingInterface = Staking; + type Staking = Staking; type PostUnbondingPoolsWindow = ConstU32<4>; type MaxMetadataLen = ConstU32<256>; // we use the same number of allowed unlocking chunks as with staking. @@ -1148,7 +1161,7 @@ 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} = 47, + Paras: parachains_paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 47, Initializer: parachains_initializer::{Pallet, Call, Storage} = 48, Dmp: parachains_dmp::{Pallet, Call, Storage} = 49, Ump: parachains_ump::{Pallet, Call, Storage, Event} = 50, @@ -1210,12 +1223,6 @@ pub type Executive = frame_executive::Executive< Runtime, AllPalletsWithSystem, ( - pallet_staking::migrations::v11::MigrateToV11< - Runtime, - VoterList, - StakingMigrationV11OldPallet, - >, - pallet_staking::migrations::v12::MigrateToV12, // "Bound uses of call" pallet_preimage::migration::v1::Migration, pallet_scheduler::migration::v3::MigrateToV4, @@ -1223,6 +1230,7 @@ pub type Executive = frame_executive::Executive< // "Properly migrate weights to v2" parachains_configuration::migration::v3::MigrateToV3, pallet_election_provider_multi_phase::migrations::v1::MigrateToV1, + pallet_fast_unstake::migrations::v1::MigrateToV1, ), >; /// The payload being signed in transactions. @@ -1450,58 +1458,29 @@ sp_api::impl_runtime_apis! { } impl mmr::MmrApi for Runtime { - fn generate_proof(_block_number: BlockNumber) - -> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof), mmr::Error> - { - - Err(mmr::Error::PalletNotIncluded) - } - - fn verify_proof(_leaf: mmr::EncodableOpaqueLeaf, _proof: mmr::Proof) - -> Result<(), mmr::Error> - { - - Err(mmr::Error::PalletNotIncluded) - } - - fn verify_proof_stateless( - _root: Hash, - _leaf: mmr::EncodableOpaqueLeaf, - _proof: mmr::Proof - ) -> Result<(), mmr::Error> { - - Err(mmr::Error::PalletNotIncluded) - } - fn mmr_root() -> Result { Err(mmr::Error::PalletNotIncluded) } - fn generate_batch_proof(_block_numbers: Vec) - -> Result<(Vec, mmr::BatchProof), mmr::Error> - { - Err(mmr::Error::PalletNotIncluded) - } - - fn generate_historical_batch_proof( + fn generate_proof( _block_numbers: Vec, - _best_known_block_number: BlockNumber, - ) -> Result<(Vec, mmr::BatchProof), mmr::Error> { + _best_known_block_number: Option, + ) -> Result<(Vec, mmr::Proof), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } - fn verify_batch_proof(_leaves: Vec, _proof: mmr::BatchProof) + fn verify_proof(_leaves: Vec, _proof: mmr::Proof) -> Result<(), mmr::Error> { Err(mmr::Error::PalletNotIncluded) } - fn verify_batch_proof_stateless( + fn verify_proof_stateless( _root: Hash, _leaves: Vec, - _proof: mmr::BatchProof + _proof: mmr::Proof ) -> Result<(), mmr::Error> { Err(mmr::Error::PalletNotIncluded) diff --git a/runtime/westend/src/weights/pallet_multisig.rs b/runtime/westend/src/weights/pallet_multisig.rs index ce0150b0ab56..e15f0973adae 100644 --- a/runtime/westend/src/weights/pallet_multisig.rs +++ b/runtime/westend/src/weights/pallet_multisig.rs @@ -16,8 +16,8 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-09-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-10-26, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 1024 // Executed Command: @@ -28,17 +28,17 @@ // --steps=50 // --repeat=20 // --pallet=pallet_multisig -// --extrinsic=* +// --extrinsic= // --execution=wasm // --wasm-execution=compiled // --header=./file_header.txt -// --output=./runtime/westend/src/weights/ +// --output=runtime/westend/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::{traits::Get, weights::{Weight}}; +use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; /// Weight functions for `pallet_multisig`. @@ -46,115 +46,81 @@ pub struct WeightInfo(PhantomData); impl pallet_multisig::WeightInfo for WeightInfo { /// The range of component `z` is `[0, 10000]`. fn as_multi_threshold_1(z: u32, ) -> Weight { - Weight::from_ref_time(15_026_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 14_417 nanoseconds. + Weight::from_ref_time(14_932_092 as u64) + // Standard Error: 2 + .saturating_add(Weight::from_ref_time(482 as u64).saturating_mul(z as u64)) } // Storage: Multisig Multisigs (r:1 w:1) // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) /// The range of component `s` is `[2, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_create(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(35_447_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(56_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 41_482 nanoseconds. + Weight::from_ref_time(34_353_792 as u64) + // Standard Error: 791 + .saturating_add(Weight::from_ref_time(81_017 as u64).saturating_mul(s as u64)) + // Standard Error: 7 + .saturating_add(Weight::from_ref_time(1_468 as u64).saturating_mul(z as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_create_store(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(37_226_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(63_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) /// The range of component `s` is `[3, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_approve(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(26_727_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(51_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(z as u64)) + // Minimum execution time: 32_410 nanoseconds. + Weight::from_ref_time(25_806_543 as u64) + // Standard Error: 602 + .saturating_add(Weight::from_ref_time(74_253 as u64).saturating_mul(s as u64)) + // Standard Error: 5 + .saturating_add(Weight::from_ref_time(1_463 as u64).saturating_mul(z as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - /// The range of component `s` is `[3, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_approve_store(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(39_863_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(56_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) // Storage: System Account (r:1 w:1) /// The range of component `s` is `[2, 100]`. /// The range of component `z` is `[0, 10000]`. fn as_multi_complete(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(48_095_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(64_000 as u64).saturating_mul(s as u64)) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(z as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + // Minimum execution time: 46_059 nanoseconds. + Weight::from_ref_time(37_295_248 as u64) + // Standard Error: 604 + .saturating_add(Weight::from_ref_time(104_164 as u64).saturating_mul(s as u64)) + // Standard Error: 5 + .saturating_add(Weight::from_ref_time(1_489 as u64).saturating_mul(z as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) /// The range of component `s` is `[2, 100]`. fn approve_as_multi_create(s: u32, ) -> Weight { - Weight::from_ref_time(31_927_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(89_000 as u64).saturating_mul(s as u64)) + // Minimum execution time: 29_952 nanoseconds. + Weight::from_ref_time(32_697_678 as u64) + // Standard Error: 857 + .saturating_add(Weight::from_ref_time(86_644 as u64).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:0) /// The range of component `s` is `[2, 100]`. fn approve_as_multi_approve(s: u32, ) -> Weight { - Weight::from_ref_time(23_774_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(79_000 as u64).saturating_mul(s as u64)) + // Minimum execution time: 22_298 nanoseconds. + Weight::from_ref_time(23_997_404 as u64) + // Standard Error: 855 + .saturating_add(Weight::from_ref_time(82_455 as u64).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_complete(s: u32, ) -> Weight { - Weight::from_ref_time(58_611_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(95_000 as u64).saturating_mul(s as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: Multisig Calls (r:1 w:1) /// The range of component `s` is `[2, 100]`. fn cancel_as_multi(s: u32, ) -> Weight { - Weight::from_ref_time(47_858_000 as u64) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(89_000 as u64).saturating_mul(s as u64)) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 31_615 nanoseconds. + Weight::from_ref_time(33_932_527 as u64) + // Standard Error: 823 + .saturating_add(Weight::from_ref_time(87_873 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } } diff --git a/scripts/ci/gitlab/pipeline/build.yml b/scripts/ci/gitlab/pipeline/build.yml index 791b01c2b632..c6fe5916c3b6 100644 --- a/scripts/ci/gitlab/pipeline/build.yml +++ b/scripts/ci/gitlab/pipeline/build.yml @@ -170,7 +170,7 @@ build-implementers-guide: - .collect-artifacts-short script: - apt-get -y update; apt-get install -y graphviz - - cargo install mdbook mdbook-mermaid mdbook-linkcheck mdbook-graphviz + - cargo install mdbook mdbook-mermaid mdbook-linkcheck mdbook-graphviz mdbook-last-changed - mdbook build ./roadmap/implementers-guide - mkdir -p artifacts - mv roadmap/implementers-guide/book artifacts/ diff --git a/scripts/ci/gitlab/pipeline/zombienet.yml b/scripts/ci/gitlab/pipeline/zombienet.yml index 5c6215aad2c4..b088f20c55ff 100644 --- a/scripts/ci/gitlab/pipeline/zombienet.yml +++ b/scripts/ci/gitlab/pipeline/zombienet.yml @@ -202,8 +202,7 @@ zombienet-tests-misc-upgrade-node: - echo "${PARACHAINS_IMAGE_NAME} ${PARACHAINS_IMAGE_TAG}" - echo "${GH_DIR}" - export DEBUG=zombie,zombie::network-node - - BUILD_RELEASE_VERSION="$(cat ./artifacts/BUILD_RELEASE_VERSION)" - - export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/parity/polkadot:${BUILD_RELEASE_VERSION}" + - export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/parity/polkadot:latest" - export COL_IMAGE=${COLLATOR_IMAGE_NAME}:${COLLATOR_IMAGE_TAG} - BUILD_LINUX_JOB_ID="$(cat ./artifacts/BUILD_LINUX_JOB_ID)" - export POLKADOT_PR_BIN_URL="https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/${BUILD_LINUX_JOB_ID}/artifacts/raw/artifacts/polkadot" diff --git a/utils/staking-miner/src/emergency_solution.rs b/utils/staking-miner/src/emergency_solution.rs index cbf86af4c1d0..fdb3a47a270d 100644 --- a/utils/staking-miner/src/emergency_solution.rs +++ b/utils/staking-miner/src/emergency_solution.rs @@ -36,21 +36,23 @@ macro_rules! emergency_solution_cmd_for { ($runtime:ident) => { paste::paste! { log::info!(target: LOG_TARGET, "mined solution with {:?}", &raw_solution.score); - let mut ready_solution = EPM::Pallet::::feasibility_check(raw_solution, EPM::ElectionCompute::Signed)?; - + let ready_solution = EPM::Pallet::::feasibility_check(raw_solution, EPM::ElectionCompute::Signed)?; + let encoded_size = ready_solution.encoded_size(); + let score = ready_solution.score; + let mut supports = ready_solution.supports.into_inner(); // maybe truncate. if let Some(take) = config.take { - log::info!(target: LOG_TARGET, "truncating {} winners to {}", ready_solution.supports.len(), take); - ready_solution.supports.sort_unstable_by_key(|(_, s)| s.total); - ready_solution.supports.truncate(take); + log::info!(target: LOG_TARGET, "truncating {} winners to {}", supports.len(), take); + supports.sort_unstable_by_key(|(_, s)| s.total); + supports.truncate(take); } // write to file and stdout. - let encoded_support = ready_solution.supports.encode(); + let encoded_support = supports.encode(); let mut supports_file = std::fs::File::create("solution.supports.bin")?; supports_file.write_all(&encoded_support)?; - log::info!(target: LOG_TARGET, "ReadySolution: size {:?} / score = {:?}", ready_solution.encoded_size(), ready_solution.score); + log::info!(target: LOG_TARGET, "ReadySolution: size {:?} / score = {:?}", encoded_size, score); log::trace!(target: LOG_TARGET, "Supports: {}", sp_core::hexdisplay::HexDisplay::from(&encoded_support)); Ok(()) diff --git a/utils/staking-miner/src/main.rs b/utils/staking-miner/src/main.rs index 6e5b53423548..8c134874f297 100644 --- a/utils/staking-miner/src/main.rs +++ b/utils/staking-miner/src/main.rs @@ -253,7 +253,6 @@ enum Error { AlreadySubmitted, VersionMismatch, StrategyNotSatisfied, - QueueFull, Other(String), } diff --git a/utils/staking-miner/src/monitor.rs b/utils/staking-miner/src/monitor.rs index 0780ef881fce..bfc075668e66 100644 --- a/utils/staking-miner/src/monitor.rs +++ b/utils/staking-miner/src/monitor.rs @@ -120,9 +120,8 @@ async fn ensure_strategy_met( .map_err::, _>(Into::into)? .unwrap_or_default(); - // we check the queue here as well. Could be checked elsewhere. - if indices.len() as u32 >= max_submissions { - return Err(Error::::QueueFull) + if indices.len() >= max_submissions as usize { + log::debug!(target: LOG_TARGET, "The submissions queue is full"); } // default score is all zeros, any score is better than it. diff --git a/xcm/pallet-xcm/src/tests.rs b/xcm/pallet-xcm/src/tests.rs index b619efefbe9b..6da02cf10cf6 100644 --- a/xcm/pallet-xcm/src/tests.rs +++ b/xcm/pallet-xcm/src/tests.rs @@ -270,7 +270,7 @@ fn teleport_assets_works() { /// Asserts that the sender's balance is decreased as a result of execution of /// local effects. #[test] -fn limmited_teleport_assets_works() { +fn limited_teleport_assets_works() { let balances = vec![ (ALICE, INITIAL_BALANCE), (ParaId::from(PARA_ID).into_account_truncating(), INITIAL_BALANCE), @@ -314,7 +314,7 @@ fn limmited_teleport_assets_works() { /// Asserts that the sender's balance is decreased as a result of execution of /// local effects. #[test] -fn unlimmited_teleport_assets_works() { +fn unlimited_teleport_assets_works() { let balances = vec![ (ALICE, INITIAL_BALANCE), (ParaId::from(PARA_ID).into_account_truncating(), INITIAL_BALANCE), diff --git a/xcm/xcm-executor/integration-tests/src/lib.rs b/xcm/xcm-executor/integration-tests/src/lib.rs index 821987531aa0..f038e45d3edc 100644 --- a/xcm/xcm-executor/integration-tests/src/lib.rs +++ b/xcm/xcm-executor/integration-tests/src/lib.rs @@ -60,7 +60,7 @@ fn basic_buy_fees_message_executes() { futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block)) .expect("imports the block"); - client.state_at(&block_hash).expect("state should exist").inspect_state(|| { + client.state_at(block_hash).expect("state should exist").inspect_state(|| { assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!( r.event, polkadot_test_runtime::RuntimeEvent::Xcm(pallet_xcm::Event::Attempted( @@ -101,7 +101,7 @@ fn query_response_fires() { .expect("imports the block"); let mut query_id = None; - client.state_at(&block_hash).expect("state should exist").inspect_state(|| { + client.state_at(block_hash).expect("state should exist").inspect_state(|| { for r in polkadot_test_runtime::System::events().iter() { match r.event { TestNotifier(QueryPrepared(q)) => query_id = Some(q), @@ -136,7 +136,7 @@ fn query_response_fires() { futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block)) .expect("imports the block"); - client.state_at(&block_hash).expect("state should exist").inspect_state(|| { + client.state_at(block_hash).expect("state should exist").inspect_state(|| { assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!( r.event, polkadot_test_runtime::RuntimeEvent::Xcm(pallet_xcm::Event::ResponseReady( @@ -184,7 +184,7 @@ fn query_response_elicits_handler() { .expect("imports the block"); let mut query_id = None; - client.state_at(&block_hash).expect("state should exist").inspect_state(|| { + client.state_at(block_hash).expect("state should exist").inspect_state(|| { for r in polkadot_test_runtime::System::events().iter() { match r.event { TestNotifier(NotifyQueryPrepared(q)) => query_id = Some(q), @@ -218,7 +218,7 @@ fn query_response_elicits_handler() { futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block)) .expect("imports the block"); - client.state_at(&block_hash).expect("state should exist").inspect_state(|| { + client.state_at(block_hash).expect("state should exist").inspect_state(|| { assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!( r.event, TestNotifier(ResponseReceived( diff --git a/xcm/xcm-simulator/src/lib.rs b/xcm/xcm-simulator/src/lib.rs index 69a8e088a0da..a8d602037cd5 100644 --- a/xcm/xcm-simulator/src/lib.rs +++ b/xcm/xcm-simulator/src/lib.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -//! Test kit to simulate cross-chain message passing and XCM execution +//! Test kit to simulate cross-chain message passing and XCM execution. pub use codec::Encode; pub use paste; @@ -62,6 +62,7 @@ pub enum MessageKind { Xcmp, } +/// Encodes the provided XCM message based on the `message_kind`. pub fn encode_xcm(message: Xcm<()>, message_kind: MessageKind) -> Vec { match message_kind { MessageKind::Ump | MessageKind::Dmp => VersionedXcm::<()>::from(message).encode(), @@ -76,6 +77,19 @@ pub fn encode_xcm(message: Xcm<()>, message_kind: MessageKind) -> Vec { } } +/// The macro is implementing upward message passing(UMP) for the provided relay +/// chain struct. The struct has to provide the XCM configuration for the relay +/// chain. +/// +/// ```ignore +/// decl_test_relay_chain! { +/// pub struct Relay { +/// Runtime = relay_chain::Runtime, +/// XcmConfig = relay_chain::XcmConfig, +/// new_ext = relay_ext(), +/// } +/// } +/// ``` #[macro_export] #[rustfmt::skip] macro_rules! decl_test_relay_chain { @@ -108,6 +122,21 @@ macro_rules! decl_test_relay_chain { }; } +/// The macro is implementing the `XcmMessageHandlerT` and `DmpMessageHandlerT` +/// traits for the provided parachain struct. Expects the provided parachain +/// struct to define the XcmpMessageHandler and DmpMessageHandler pallets that +/// contain the message handling logic. +/// +/// ```ignore +/// decl_test_parachain! { +/// pub struct ParaA { +/// Runtime = parachain::Runtime, +/// XcmpMessageHandler = parachain::MsgQueue, +/// DmpMessageHandler = parachain::MsgQueue, +/// new_ext = para_ext(), +/// } +/// } +/// ``` #[macro_export] macro_rules! decl_test_parachain { ( @@ -153,6 +182,7 @@ macro_rules! decl_test_parachain { }; } +/// Implements the `TestExt` trait for a specified struct. #[macro_export] macro_rules! __impl_ext { // entry point: generate ext name @@ -202,6 +232,23 @@ thread_local! { = RefCell::new(VecDeque::new()); } +/// Declares a test network that consists of a relay chain and multiple +/// parachains. Expects a network struct as an argument and implements testing +/// functionality, `ParachainXcmRouter` and the `RelayChainXcmRouter`. The +/// struct needs to contain the relay chain struct and an indexed list of +/// parachains that are going to be in the network. +/// +/// ```ignore +/// decl_test_network! { +/// pub struct ExampleNet { +/// relay_chain = Relay, +/// parachains = vec![ +/// (1, ParaA), +/// (2, ParaB), +/// ], +/// } +/// } +/// ``` #[macro_export] macro_rules! decl_test_network { ( @@ -215,16 +262,16 @@ macro_rules! decl_test_network { impl $name { pub fn reset() { use $crate::{TestExt, VecDeque}; - // Reset relay chain message bus + // Reset relay chain message bus. $crate::RELAY_MESSAGE_BUS.with(|b| b.replace(VecDeque::new())); - // Reset parachain message bus + // Reset parachain message bus. $crate::PARA_MESSAGE_BUS.with(|b| b.replace(VecDeque::new())); <$relay_chain>::reset_ext(); $( <$parachain>::reset_ext(); )* } } - /// Check if any messages exist in either message bus + /// Check if any messages exist in either message bus. fn exists_messages_in_any_bus() -> bool { use $crate::{RELAY_MESSAGE_BUS, PARA_MESSAGE_BUS}; let no_relay_messages_left = RELAY_MESSAGE_BUS.with(|b| b.borrow().is_empty());