From 4a6d68d10d4198f6b00330030036e3f69de2f3e3 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 5 May 2023 14:23:56 +0200 Subject: [PATCH 01/99] update to 0.9.40 --- Cargo.lock | 2055 +++++++++++++++++--------------- Cargo.toml | 202 ++-- nodes/standalone/Cargo.toml | 4 +- runtimes/standalone/src/lib.rs | 15 +- 4 files changed, 1232 insertions(+), 1044 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 27664447ba..f7dff2e08f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -42,7 +42,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -51,18 +51,18 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "rand_core 0.6.4", ] [[package]] name = "aead" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c192eb8f11fc081b0fe4259ba5af04217d4e0faddd02417310a927911abd7c8" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ "crypto-common", - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -119,7 +119,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c" dependencies = [ - "aead 0.5.1", + "aead 0.5.2", "aes 0.8.2", "cipher 0.4.4", "ctr 0.9.2", @@ -153,7 +153,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", "once_cell", "version_check", ] @@ -165,7 +165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", - "getrandom 0.2.8", + "getrandom 0.2.9", "once_cell", "version_check", ] @@ -179,11 +179,20 @@ dependencies = [ "memchr", ] +[[package]] +name = "aho-corasick" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +dependencies = [ + "memchr", +] + [[package]] name = "always-assert" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf688625d06217d5b1bb0ea9d9c44a1635fd0ee3534466388d18203174f4d11" +checksum = "4436e0292ab1bb631b42973c61205e704475fe8126af845c8d923c0996328127" [[package]] name = "android_system_properties" @@ -203,11 +212,60 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "approx" @@ -232,15 +290,15 @@ checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] name = "array-bytes" -version = "6.0.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22f72e9d6fac4bc80778ea470b20197b88d28c292bb7d60c3fb099280003cd19" +checksum = "d9b1c5a481ec30a5abd8dfbd94ab5cf1bb4e9a66be7f1b3b322f2f1170c200fd" [[package]] name = "arrayref" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" @@ -323,9 +381,9 @@ dependencies = [ [[package]] name = "asn1_der" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" +checksum = "155a5a185e42c6b77ac7b88a15143d930a9e9727a5b7b77eed417404ab15c247" [[package]] name = "assert_matches" @@ -333,24 +391,35 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" +[[package]] +name = "async-channel" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + [[package]] name = "async-io" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ "async-lock", "autocfg", + "cfg-if", "concurrent-queue", "futures-lite", - "libc", "log", "parking", "polling", + "rustix 0.37.19", "slab", "socket2", "waker-fn", - "windows-sys 0.42.0", ] [[package]] @@ -364,13 +433,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.67" +version = "0.1.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ea188f25f0255d8f92797797c97ebf5631fa88178beb1a46fdf5622c9a00e4" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.2", + "syn 2.0.15", ] [[package]] @@ -388,9 +457,9 @@ dependencies = [ [[package]] name = "atomic-waker" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" +checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" [[package]] name = "attestation" @@ -440,7 +509,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.6.2", "object 0.30.3", "rustc-demangle", ] @@ -490,63 +559,10 @@ dependencies = [ "serde", ] -[[package]] -name = "beefy-gadget" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" -dependencies = [ - "array-bytes 4.2.0", - "async-trait", - "fnv", - "futures", - "log", - "parity-scale-codec", - "parking_lot 0.12.1", - "sc-client-api", - "sc-consensus", - "sc-keystore", - "sc-network", - "sc-network-common", - "sc-network-gossip", - "sc-utils", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", - "sp-beefy", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-keystore", - "sp-mmr-primitives", - "sp-runtime", - "substrate-prometheus-endpoint", - "thiserror", - "wasm-timer", -] - -[[package]] -name = "beefy-gadget-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" -dependencies = [ - "beefy-gadget", - "futures", - "jsonrpsee", - "log", - "parity-scale-codec", - "parking_lot 0.12.1", - "sc-rpc", - "serde", - "sp-beefy", - "sp-core", - "sp-runtime", - "thiserror", -] - [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "hash-db", "log", @@ -567,7 +583,7 @@ version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cexpr", "clang-sys", "lazy_static", @@ -587,12 +603,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487f1e0fcbe47deb8b0574e646def1c903389d95241dd1bbcc6ce4a715dfc0c1" - [[package]] name = "bitvec" version = "1.0.1" @@ -668,7 +678,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -677,7 +687,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -707,9 +717,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "bounded-collections" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a071c348a5ef6da1d3a87166b408170b46002382b1dda83992b5c2208cefb370" +checksum = "e3888522b497857eb606bf51695988dba7096941822c1bcf676e3a929a9ae7a0" dependencies = [ "log", "parity-scale-codec", @@ -753,9 +763,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" [[package]] name = "byte-slice-cast" @@ -939,7 +949,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -948,7 +958,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -972,9 +982,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ed9a53e5d4d9c573ae844bfac6872b159cb1d1585a83b29e7a64b7eef7332a" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" dependencies = [ "glob", "libc", @@ -983,40 +993,45 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.11" +version = "4.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42dfd32784433290c51d92c438bb72ea5063797fc3cc9a21a8c4346bebbb2098" +checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938" dependencies = [ - "bitflags 2.0.2", + "clap_builder", "clap_derive", - "clap_lex", - "is-terminal", "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.1.9" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fddf67631444a3a3e3e5ac51c36a5e01335302de677bd78759eaa90ab1f46644" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "clap_lex" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "033f6b7a4acb1f358c742aaca805c939ee73b4c6209ae4318ec7aca81c42e646" -dependencies = [ - "os_str_bytes", -] +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" [[package]] name = "coarsetime" @@ -1040,6 +1055,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "comfy-table" version = "6.1.4" @@ -1053,9 +1074,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" +checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" dependencies = [ "crossbeam-utils", ] @@ -1090,9 +1111,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "core2" @@ -1124,27 +1145,27 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" dependencies = [ "libc", ] [[package]] name = "cranelift-bforest" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7379abaacee0f14abf3204a7606118f0465785252169d186337bcb75030815a" +checksum = "2bc42ba2e232e5b20ff7dc299a812d53337dadce9a7e39a238e6a5cb82d2e57b" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9489fa336927df749631f1008007ced2871068544f40a202ce6d93fbf2366a7b" +checksum = "253531aca9b6f56103c9420369db3263e784df39aa1c90685a1f69cfbba0623e" dependencies = [ "arrayvec 0.7.2", "bumpalo", @@ -1163,33 +1184,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05bbb67da91ec721ed57cef2f7c5ef7728e1cd9bde9ffd3ef8601022e73e3239" +checksum = "72f2154365e2bff1b1b8537a7181591fdff50d8e27fa6e40d5c69c3bad0ca7c8" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418ecb2f36032f6665dc1a5e2060a143dbab41d83b784882e97710e890a7a16d" +checksum = "687e14e3f5775248930e0d5a84195abef8b829958e9794bf8d525104993612b4" [[package]] name = "cranelift-entity" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cf583f7b093f291005f9fb1323e2c37f6ee4c7909e39ce016b2e8360d461705" +checksum = "f42ea692c7b450ad18b8c9889661505d51c09ec4380cf1c2d278dbb2da22cae1" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b66bf9e916f57fbbd0f7703ec6286f4624866bf45000111627c70d272c8dda1" +checksum = "8483c2db6f45fe9ace984e5adc5d058102227e4c62e5aa2054e16b0275fd3a6e" dependencies = [ "cranelift-codegen", "log", @@ -1199,15 +1220,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "649782a39ce99798dd6b4029e2bb318a2fbeaade1b4fa25330763c10c65bc358" +checksum = "e9793158837678902446c411741d87b43f57dadfb944f2440db4287cda8cbd59" [[package]] name = "cranelift-native" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937e021e089c51f9749d09e7ad1c4f255c2f8686cb8c3df63a34b3ec9921bc41" +checksum = "72668c7755f2b880665cb422c8ad2d56db58a88b9bebfef0b73edc2277c13c49" dependencies = [ "cranelift-codegen", "libc", @@ -1216,9 +1237,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d850cf6775477747c9dfda9ae23355dd70512ffebc70cf82b85a5b111ae668b5" +checksum = "3852ce4b088b44ac4e29459573943009a70d1b192c8d77ef949b4e814f656fc1" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1256,9 +1277,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if", "crossbeam-utils", @@ -1319,7 +1340,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "rand_core 0.6.4", "subtle", "zeroize", @@ -1331,7 +1352,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "rand_core 0.6.4", "typenum", ] @@ -1342,7 +1363,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "subtle", ] @@ -1352,7 +1373,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "subtle", ] @@ -1396,7 +1417,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "clap", "parity-scale-codec", @@ -1411,7 +1432,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1434,7 +1455,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1463,7 +1484,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1487,7 +1508,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1510,7 +1531,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1534,7 +1555,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1546,11 +1567,11 @@ dependencies = [ "cumulus-relay-chain-interface", "cumulus-relay-chain-minimal-node", "futures", - "parking_lot 0.12.1", "polkadot-primitives", "sc-client-api", "sc-consensus", "sc-network", + "sc-network-sync", "sc-network-transactions", "sc-rpc", "sc-service", @@ -1569,7 +1590,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "frame-support", "frame-system", @@ -1585,7 +1606,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1602,7 +1623,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1631,7 +1652,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1642,7 +1663,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "frame-benchmarking", "frame-support", @@ -1656,7 +1677,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1672,7 +1693,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1693,7 +1714,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1709,7 +1730,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1732,7 +1753,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "cumulus-primitives-core", "futures", @@ -1745,7 +1766,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1763,7 +1784,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1788,7 +1809,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1796,21 +1817,19 @@ dependencies = [ "jsonrpsee-core", "parity-scale-codec", "polkadot-overseer", - "polkadot-service", "sc-client-api", "sp-api", "sp-blockchain", "sp-state-machine", "thiserror", - "tokio", ] [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ - "array-bytes 6.0.0", + "array-bytes 6.1.0", "async-trait", "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1826,15 +1845,10 @@ dependencies = [ "polkadot-service", "sc-authority-discovery", "sc-client-api", - "sc-consensus", - "sc-keystore", "sc-network", "sc-network-common", "sc-service", - "sc-telemetry", "sc-tracing", - "sc-transaction-pool", - "sc-transaction-pool-api", "sp-api", "sp-blockchain", "sp-consensus", @@ -1842,13 +1856,12 @@ dependencies = [ "sp-runtime", "tokio", "tracing", - "url", ] [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1858,9 +1871,10 @@ dependencies = [ "jsonrpsee", "lru 0.9.0", "parity-scale-codec", - "polkadot-service", + "polkadot-overseer", "sc-client-api", "sc-rpc-api", + "sc-service", "serde", "serde_json", "sp-api", @@ -1877,7 +1891,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -1929,9 +1943,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c00419335c41018365ddf7e4d5f1c12ee3659ddcf3e01974650ba1de73d038" +checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" dependencies = [ "cc", "cxxbridge-flags", @@ -1941,9 +1955,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb8307ad413a98fff033c8545ecf133e3257747b3bae935e7602aab8aa92d4ca" +checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" dependencies = [ "cc", "codespan-reporting", @@ -1951,24 +1965,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.2", + "syn 2.0.15", ] [[package]] name = "cxxbridge-flags" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc52e2eb08915cb12596d29d55f0b5384f00d697a646dbd269b6ecb0fbd9d31" +checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" [[package]] name = "cxxbridge-macro" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631569015d0d8d54e6c241733f944042623ab6df7bc3be7466874b05fcdb1c5f" +checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.2", + "syn 2.0.15", ] [[package]] @@ -2037,7 +2051,7 @@ name = "delegation" version = "1.11.0-dev" dependencies = [ "attestation", - "bitflags 1.3.2", + "bitflags", "ctype", "frame-benchmarking", "frame-support", @@ -2202,7 +2216,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -2259,13 +2273,13 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -2379,7 +2393,7 @@ dependencies = [ "der", "digest 0.10.6", "ff", - "generic-array 0.14.6", + "generic-array 0.14.7", "group", "hkdf", "pem-rfc7468", @@ -2404,22 +2418,22 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" +checksum = "c041f5090df68b32bcd905365fd51769c8b9d553fe87fde0b683534f10c01bd2" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.7.4" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" +checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -2430,7 +2444,7 @@ checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.2", + "syn 2.0.15", ] [[package]] @@ -2467,13 +2481,13 @@ checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" [[package]] name = "errno" -version = "0.2.8" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -2526,6 +2540,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "expander" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f360349150728553f92e4c997a16af8915f418d3a0f21b440d34c5632f16ed84" +dependencies = [ + "blake2", + "fs-err", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -2593,9 +2620,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ace6ec7cc19c8ed33a32eaa9ea692d7faea05006b5356b9e2b668ec4bc3955" +checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" [[package]] name = "file-per-thread-logger" @@ -2609,14 +2636,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" +checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ "cfg-if", "libc", - "redox_syscall", - "windows-sys 0.45.0", + "redox_syscall 0.2.16", + "windows-sys 0.48.0", ] [[package]] @@ -2655,13 +2682,13 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", "libz-sys", - "miniz_oxide", + "miniz_oxide 0.7.1", ] [[package]] @@ -2682,7 +2709,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", ] @@ -2705,7 +2732,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-support-procedural", @@ -2730,7 +2757,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -2777,7 +2804,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2788,7 +2815,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2805,7 +2832,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -2821,9 +2848,9 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" +checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" dependencies = [ "cfg-if", "parity-scale-codec", @@ -2834,7 +2861,7 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "futures", "log", @@ -2850,9 +2877,10 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ - "bitflags 1.3.2", + "bitflags", + "environmental", "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", @@ -2882,7 +2910,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "Inflector", "cfg-expr", @@ -2897,7 +2925,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2909,7 +2937,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "proc-macro2", "quote", @@ -2919,7 +2947,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "log", @@ -2937,7 +2965,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -2952,7 +2980,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "sp-api", @@ -2961,7 +2989,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "parity-scale-codec", @@ -2986,6 +3014,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "fs4" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7f5b6908aecca5812a4569056285e58c666588c9573ee59765bf1d3692699e2" +dependencies = [ + "rustix 0.37.19", + "windows-sys 0.48.0", +] + [[package]] name = "funty" version = "2.0.0" @@ -2994,9 +3032,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "531ac96c6ff5fd7c62263c5e3c67a603af4fcaee2e1a0ae5565ba3a11e69e549" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" dependencies = [ "futures-channel", "futures-core", @@ -3009,9 +3047,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", "futures-sink", @@ -3019,15 +3057,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1997dd9df74cdac935c76252744c1ed5794fac083242ea4fe77ef3ed60ba0f83" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", @@ -3037,15 +3075,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d422fa3cbe3b40dca574ab087abb5bc98258ea57eea3fd6f1fa7162c778b91" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-lite" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ "fastrand", "futures-core", @@ -3058,13 +3096,13 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -3080,15 +3118,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-timer" @@ -3098,9 +3136,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-channel", "futures-core", @@ -3134,9 +3172,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -3165,9 +3203,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", "libc", @@ -3223,7 +3261,7 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" dependencies = [ - "aho-corasick", + "aho-corasick 0.7.20", "bstr", "fnv", "log", @@ -3243,9 +3281,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" dependencies = [ "bytes", "fnv", @@ -3276,9 +3314,9 @@ dependencies = [ [[package]] name = "hash-db" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" +checksum = "8e7d7786361d7425ae2fe4f9e407eb0efaa0840f5212d109cc018c40c35c6ab4" [[package]] name = "hash256-std-hasher" @@ -3394,7 +3432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", - "generic-array 0.14.6", + "generic-array 0.14.7", "hmac 0.8.1", ] @@ -3457,9 +3495,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.25" +version = "0.14.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" +checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" dependencies = [ "bytes", "futures-channel", @@ -3496,16 +3534,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi", + "windows 0.48.0", ] [[package]] @@ -3557,9 +3595,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "3.0.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba7abdbb86e485125dad06c2691e1e393bf3b08c7b743b43aa162a00fd39062e" +checksum = "a9465340214b296cd17a0009acdb890d6160010b8adf8f78a00d0d7ab270f79f" dependencies = [ "async-io", "core-foundation", @@ -3571,7 +3609,7 @@ dependencies = [ "rtnetlink", "system-configuration", "tokio", - "windows", + "windows 0.34.0", ] [[package]] @@ -3605,9 +3643,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", @@ -3620,7 +3658,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -3668,13 +3706,13 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd6da19f25979c7270e70fa95ab371ec3b701cd0eefc47667a09785b3c59155" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -3697,20 +3735,20 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" +checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" [[package]] name = "is-terminal" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8687c819457e979cc940d09cb16e42a1bf70aa6b60a549de6d3a62a0ee90c69e" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix", - "windows-sys 0.45.0", + "rustix 0.37.19", + "windows-sys 0.48.0", ] [[package]] @@ -3884,9 +3922,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" dependencies = [ "cpufeatures", ] @@ -4017,8 +4055,8 @@ dependencies = [ [[package]] name = "kusama-runtime" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bitvec", "frame-benchmarking", @@ -4091,9 +4129,9 @@ dependencies = [ "sp-api", "sp-arithmetic", "sp-authority-discovery", - "sp-beefy", "sp-block-builder", "sp-consensus-babe", + "sp-consensus-beefy", "sp-core", "sp-inherents", "sp-io", @@ -4115,8 +4153,8 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "frame-support", "polkadot-primitives", @@ -4174,9 +4212,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" [[package]] name = "libloading" @@ -4209,7 +4247,7 @@ dependencies = [ "bytes", "futures", "futures-timer", - "getrandom 0.2.8", + "getrandom 0.2.9", "instant", "libp2p-core 0.38.0", "libp2p-dns", @@ -4270,9 +4308,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.39.1" +version = "0.39.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7f8b7d65c070a5a1b5f8f0510648189da08f787b8963f8e21219e0710733af" +checksum = "3c1df63c0b582aa434fb09b2d86897fa2b419ffeccf934b36f87fcedc8e835c2" dependencies = [ "either", "fnv", @@ -4281,7 +4319,7 @@ dependencies = [ "instant", "libp2p-identity", "log", - "multiaddr 0.17.0", + "multiaddr 0.17.1", "multihash 0.17.0", "multistream-select", "once_cell", @@ -4333,19 +4371,18 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6c9cb71e2333d31f18e7556b9a5f1d0a2e013effc9325e36f436be65fe7bd2" +checksum = "9e2d584751cecb2aabaa56106be6be91338a60a0f4e420cf2af639204f596fc1" dependencies = [ "bs58", "ed25519-dalek", "log", - "multiaddr 0.17.0", + "multiaddr 0.17.1", "multihash 0.17.0", - "prost", - "prost-build", "quick-protobuf", "rand 0.8.5", + "sha2 0.10.6", "thiserror", "zeroize", ] @@ -4565,7 +4602,7 @@ checksum = "ff08d13d0dc66e5e9ba6279c1de417b84fa0d0adc3b03e5732928c180ec02781" dependencies = [ "futures", "futures-rustls", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "rcgen 0.10.0", "ring", @@ -4719,9 +4756,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" dependencies = [ "cc", "pkg-config", @@ -4767,6 +4804,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +[[package]] +name = "linux-raw-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" + [[package]] name = "lock_api" version = "0.4.9" @@ -4862,8 +4905,8 @@ dependencies = [ "sc-client-api", "sc-consensus", "sc-consensus-aura", + "sc-consensus-grandpa", "sc-executor", - "sc-finality-grandpa", "sc-keystore", "sc-rpc-api", "sc-service", @@ -4874,8 +4917,8 @@ dependencies = [ "sp-block-builder", "sp-blockchain", "sp-consensus-aura", + "sp-consensus-grandpa", "sp-core", - "sp-finality-grandpa", "sp-inherents", "sp-io", "sp-keyring", @@ -4962,10 +5005,11 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "matrixmultiply" -version = "0.3.2" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84" +checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77" dependencies = [ + "autocfg", "rawpointer", ] @@ -4986,11 +5030,11 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memfd" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" +checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix", + "rustix 0.37.19", ] [[package]] @@ -5011,15 +5055,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.8.0" @@ -5031,12 +5066,11 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" +checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe" dependencies = [ "hash-db", - "hashbrown 0.12.3", ] [[package]] @@ -5083,6 +5117,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.6" @@ -5098,7 +5141,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "futures", "log", @@ -5106,9 +5149,9 @@ dependencies = [ "sc-client-api", "sc-offchain", "sp-api", - "sp-beefy", "sp-blockchain", "sp-consensus", + "sp-consensus-beefy", "sp-core", "sp-mmr-primitives", "sp-runtime", @@ -5117,7 +5160,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "anyhow", "jsonrpsee", @@ -5132,9 +5175,9 @@ dependencies = [ [[package]] name = "mockall" -version = "0.11.3" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e4a1c770583dac7ab5e2f6c139153b783a53a1bbee9729613f193e59828326" +checksum = "4c84490118f2ee2d74570d114f3d0493cbf02790df303d2707606c3e14e07c96" dependencies = [ "cfg-if", "downcast", @@ -5147,9 +5190,9 @@ dependencies = [ [[package]] name = "mockall_derive" -version = "0.11.3" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "832663583d5fa284ca8810bf7015e46c9fff9622d3cf34bd1eea5003fec06dd0" +checksum = "22ce75669015c4f47b289fd4d4f56e894e4c96003ffdf3ac51313126f94c6cbb" dependencies = [ "cfg-if", "proc-macro2", @@ -5177,13 +5220,14 @@ dependencies = [ [[package]] name = "multiaddr" -version = "0.17.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b53e0cc5907a5c216ba6584bf74be8ab47d6d6289f72793b2dddbf15dc3bf8c" +checksum = "2b36f567c7099511fa8612bbbb52dda2419ce0bdbacf31714e3a5ffdb766d3bd" dependencies = [ "arrayref", "byteorder", "data-encoding", + "log", "multibase", "multihash 0.17.0", "percent-encoding", @@ -5228,9 +5272,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" dependencies = [ "core2", - "digest 0.10.6", "multihash-derive", - "sha2 0.10.6", "unsigned-varint", ] @@ -5329,7 +5371,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" dependencies = [ "anyhow", - "bitflags 1.3.2", + "bitflags", "byteorder", "libc", "netlink-packet-core", @@ -5382,29 +5424,15 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg-if", "libc", "memoffset 0.6.5", ] [[package]] -name = "nix" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.7.1", - "pin-utils", - "static_assertions", -] - -[[package]] -name = "nohash-hasher" -version = "0.2.0" +name = "nohash-hasher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" @@ -5560,9 +5588,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "orchestra" -version = "0.0.4" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17e7d5b6bb115db09390bed8842c94180893dd83df3dfce7354f2a2aa090a4ee" +checksum = "2b0766f60d83cac01c6e3f3bc36aaa9056e48bea0deddb98a8c74de6021f3061" dependencies = [ "async-trait", "dyn-clonable", @@ -5577,11 +5605,12 @@ dependencies = [ [[package]] name = "orchestra-proc-macro" -version = "0.0.4" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2af4dabb2286b0be0e9711d2d24e25f6217048b71210cffd3daddc3b5c84e1f" +checksum = "3c8e83dbd049009426b445424a1104c78e6172a4c13e3614e52a38262785a5d7" dependencies = [ - "expander 0.0.6", + "expander 1.0.0", + "indexmap", "itertools", "petgraph", "proc-macro-crate", @@ -5599,12 +5628,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "os_str_bytes" -version = "6.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" - [[package]] name = "p256" version = "0.11.1" @@ -5640,7 +5663,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -5656,7 +5679,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -5672,7 +5695,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -5686,7 +5709,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5710,7 +5733,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5730,7 +5753,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5745,7 +5768,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -5754,7 +5777,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-beefy", + "sp-consensus-beefy", "sp-runtime", "sp-session", "sp-staking", @@ -5764,7 +5787,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "array-bytes 4.2.0", "binary-merkle-tree", @@ -5778,7 +5801,7 @@ dependencies = [ "scale-info", "serde", "sp-api", - "sp-beefy", + "sp-consensus-beefy", "sp-core", "sp-io", "sp-runtime", @@ -5788,7 +5811,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5806,7 +5829,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5825,7 +5848,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5842,7 +5865,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "assert_matches", "frame-benchmarking", @@ -5859,7 +5882,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5904,7 +5927,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5927,7 +5950,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5940,7 +5963,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5958,7 +5981,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5976,7 +5999,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5987,8 +6010,8 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-application-crypto", + "sp-consensus-grandpa", "sp-core", - "sp-finality-grandpa", "sp-io", "sp-runtime", "sp-session", @@ -5999,7 +6022,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "enumflags2", "frame-benchmarking", @@ -6015,7 +6038,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6035,7 +6058,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6068,7 +6091,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6085,7 +6108,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6102,7 +6125,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6118,7 +6141,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6134,7 +6157,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -6151,7 +6174,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6171,7 +6194,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -6182,7 +6205,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -6199,7 +6222,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6223,7 +6246,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6240,7 +6263,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6255,7 +6278,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6273,7 +6296,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6288,7 +6311,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6307,7 +6330,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6324,7 +6347,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -6345,7 +6368,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6361,7 +6384,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -6375,7 +6398,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6398,7 +6421,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6409,7 +6432,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "log", "sp-arithmetic", @@ -6418,7 +6441,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "sp-api", @@ -6427,7 +6450,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6444,7 +6467,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -6458,7 +6481,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6476,7 +6499,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6495,7 +6518,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-support", "frame-system", @@ -6511,7 +6534,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -6527,7 +6550,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6539,7 +6562,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6556,7 +6579,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6572,7 +6595,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6605,7 +6628,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6619,8 +6642,8 @@ dependencies = [ [[package]] name = "pallet-xcm" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -6640,8 +6663,8 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "frame-benchmarking", "frame-support", @@ -6660,7 +6683,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.39#d6eef144421ef5c3f339f681484d06bb729dfa82" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -6696,9 +6719,9 @@ dependencies = [ [[package]] name = "parity-db" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df89dd8311063c54ae4e03d9aeb597b04212a57e82c339344130a9cad9b3e2d9" +checksum = "bd4572a52711e2ccff02b4973ec7e4a5b5c23387ebbfbd6cd42b34755714cefc" dependencies = [ "blake2", "crc32fast", @@ -6716,9 +6739,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" +checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -6755,9 +6778,9 @@ checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" [[package]] name = "parking" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" [[package]] name = "parking_lot" @@ -6789,7 +6812,7 @@ dependencies = [ "cfg-if", "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "winapi", ] @@ -6802,7 +6825,7 @@ checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "windows-sys 0.45.0", ] @@ -6942,9 +6965,9 @@ dependencies = [ [[package]] name = "pest" -version = "2.5.6" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cbd939b234e95d72bc393d51788aec68aeeb5d51e748ca08ff3aad58cb722f7" +checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" dependencies = [ "thiserror", "ucd-trie", @@ -6952,9 +6975,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.5.6" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a81186863f3d0a27340815be8f2078dd8050b14cd71913db9fbda795e5f707d7" +checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" dependencies = [ "pest", "pest_generator", @@ -6962,22 +6985,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.6" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a1ef20bf3193c15ac345acb32e26b3dc3223aff4d77ae4fc5359567683796b" +checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "pest_meta" -version = "2.5.6" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e3b284b1f13a20dc5ebc90aff59a51b8d7137c221131b52a7260c08cbc1cc80" +checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" dependencies = [ "once_cell", "pest", @@ -7044,9 +7067,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platforms" @@ -7062,8 +7085,8 @@ checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" [[package]] name = "polkadot-approval-distribution" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "futures", "polkadot-node-metrics", @@ -7077,8 +7100,8 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -7091,8 +7114,8 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "derive_more", "fatality", @@ -7114,8 +7137,8 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "fatality", "futures", @@ -7135,8 +7158,8 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "clap", "frame-benchmarking-cli", @@ -7163,8 +7186,8 @@ dependencies = [ [[package]] name = "polkadot-client" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "async-trait", "frame-benchmarking", @@ -7185,13 +7208,13 @@ dependencies = [ "sc-service", "sp-api", "sp-authority-discovery", - "sp-beefy", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-babe", + "sp-consensus-beefy", + "sp-consensus-grandpa", "sp-core", - "sp-finality-grandpa", "sp-inherents", "sp-keyring", "sp-mmr-primitives", @@ -7205,8 +7228,8 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "always-assert", "bitvec", @@ -7227,8 +7250,8 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "parity-scale-codec", "scale-info", @@ -7239,8 +7262,8 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "derive_more", "fatality", @@ -7264,8 +7287,8 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -7278,8 +7301,8 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "futures", "futures-timer", @@ -7298,8 +7321,8 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "always-assert", "async-trait", @@ -7314,7 +7337,6 @@ dependencies = [ "polkadot-overseer", "polkadot-primitives", "sc-network", - "sc-network-common", "sp-consensus", "thiserror", "tracing-gum", @@ -7322,8 +7344,8 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "futures", "parity-scale-codec", @@ -7340,8 +7362,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bitvec", "derive_more", @@ -7369,8 +7391,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bitvec", "futures", @@ -7390,8 +7412,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bitvec", "fatality", @@ -7409,8 +7431,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "futures", "polkadot-node-subsystem", @@ -7424,8 +7446,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "async-trait", "futures", @@ -7444,8 +7466,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "futures", "polkadot-node-metrics", @@ -7459,8 +7481,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "futures", "futures-timer", @@ -7476,8 +7498,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "fatality", "futures", @@ -7495,8 +7517,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "async-trait", "futures", @@ -7512,8 +7534,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bitvec", "fatality", @@ -7530,8 +7552,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "always-assert", "assert_matches", @@ -7566,8 +7588,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "futures", "polkadot-node-primitives", @@ -7582,8 +7604,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "futures", "lru 0.9.0", @@ -7597,8 +7619,8 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "lazy_static", "log", @@ -7615,8 +7637,8 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bs58", "futures", @@ -7634,8 +7656,8 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "async-trait", "derive_more", @@ -7649,7 +7671,6 @@ dependencies = [ "rand 0.8.5", "sc-authority-discovery", "sc-network", - "sc-network-common", "strum", "thiserror", "tracing-gum", @@ -7657,8 +7678,8 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bounded-vec", "futures", @@ -7680,8 +7701,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -7690,8 +7711,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "async-trait", "derive_more", @@ -7713,8 +7734,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "async-trait", "derive_more", @@ -7746,8 +7767,8 @@ dependencies = [ [[package]] name = "polkadot-overseer" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "async-trait", "futures", @@ -7769,8 +7790,8 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bounded-collections", "derive_more", @@ -7786,8 +7807,8 @@ dependencies = [ [[package]] name = "polkadot-performance-test" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "env_logger 0.9.3", "kusama-runtime", @@ -7802,8 +7823,8 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bitvec", "hex-literal", @@ -7828,11 +7849,9 @@ dependencies = [ [[package]] name = "polkadot-rpc" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ - "beefy-gadget", - "beefy-gadget-rpc", "jsonrpsee", "mmr-rpc", "pallet-transaction-payment-rpc", @@ -7841,9 +7860,11 @@ dependencies = [ "sc-client-api", "sc-consensus-babe", "sc-consensus-babe-rpc", + "sc-consensus-beefy", + "sc-consensus-beefy-rpc", "sc-consensus-epochs", - "sc-finality-grandpa", - "sc-finality-grandpa-rpc", + "sc-consensus-grandpa", + "sc-consensus-grandpa-rpc", "sc-rpc", "sc-sync-state-rpc", "sc-transaction-pool-api", @@ -7860,8 +7881,8 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bitvec", "frame-benchmarking", @@ -7926,9 +7947,9 @@ dependencies = [ "smallvec", "sp-api", "sp-authority-discovery", - "sp-beefy", "sp-block-builder", "sp-consensus-babe", + "sp-consensus-beefy", "sp-core", "sp-inherents", "sp-io", @@ -7950,8 +7971,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bitvec", "frame-benchmarking", @@ -7964,7 +7985,6 @@ dependencies = [ "pallet-authorship", "pallet-babe", "pallet-balances", - "pallet-beefy-mmr", "pallet-election-provider-multi-phase", "pallet-fast-unstake", "pallet-session", @@ -7983,7 +8003,6 @@ dependencies = [ "serde_derive", "slot-range-helper", "sp-api", - "sp-beefy", "sp-core", "sp-inherents", "sp-io", @@ -7998,8 +8017,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "frame-support", "polkadot-primitives", @@ -8012,8 +8031,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bs58", "parity-scale-codec", @@ -8024,10 +8043,10 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ - "bitflags 1.3.2", + "bitflags", "bitvec", "derive_more", "frame-benchmarking", @@ -8068,11 +8087,10 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "async-trait", - "beefy-gadget", "frame-benchmarking-cli", "frame-support", "frame-system-rpc-runtime-api", @@ -8133,12 +8151,14 @@ dependencies = [ "sc-client-db", "sc-consensus", "sc-consensus-babe", + "sc-consensus-beefy", + "sc-consensus-grandpa", "sc-consensus-slots", "sc-executor", - "sc-finality-grandpa", "sc-keystore", "sc-network", "sc-network-common", + "sc-network-sync", "sc-offchain", "sc-service", "sc-sync-state-rpc", @@ -8149,13 +8169,13 @@ dependencies = [ "serde_json", "sp-api", "sp-authority-discovery", - "sp-beefy", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-babe", + "sp-consensus-beefy", + "sp-consensus-grandpa", "sp-core", - "sp-finality-grandpa", "sp-inherents", "sp-io", "sp-keystore", @@ -8176,8 +8196,8 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -8197,8 +8217,8 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -8207,18 +8227,18 @@ dependencies = [ [[package]] name = "polling" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e1f879b2998099c2d69ab9605d145d5b661195627eccc680002c4918a7fb6fa" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", - "bitflags 1.3.2", + "bitflags", "cfg-if", "concurrent-queue", "libc", "log", "pin-project-lite 0.2.9", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -8317,10 +8337,11 @@ dependencies = [ [[package]] name = "prioritized-metered-channel" -version = "0.2.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382698e48a268c832d0b181ed438374a6bb708a82a8ca273bb0f61c74cf209c4" +checksum = "a3caef72a78ca8e77cbdfa87dd516ebb79d4cbe5b42e3b8435b463a8261339ff" dependencies = [ + "async-channel", "coarsetime", "crossbeam-queue", "derive_more", @@ -8367,9 +8388,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] @@ -8413,9 +8434,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48e50df39172a3e7eb17e14642445da64996989bc212b583015435d39a58537" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", "prost-derive", @@ -8423,9 +8444,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c828f93f5ca4826f97fedcbd3f9a536c16b12cff3dbbb4a007f932bbad95b12" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", "heck", @@ -8458,9 +8479,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea9b0f8cbe5e15a8a042d030bd96668db28ecb567ec37d691971ff5731d2b1b" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", @@ -8471,9 +8492,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379119666929a1afd7a043aa6cf96fa67a6dce9af60c88095a4686dbce4c9c88" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ "prost", ] @@ -8534,9 +8555,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4ced82a24bb281af338b9e8f94429b6eca01b4e66d899f40031f074e74c9" +checksum = "67c10f662eee9c94ddd7135043e544f3c82fa839a1e7b865911331961b53186c" dependencies = [ "bytes", "rand 0.8.5", @@ -8624,7 +8645,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", ] [[package]] @@ -8704,7 +8725,16 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags 1.3.2", + "bitflags", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", ] [[package]] @@ -8713,8 +8743,8 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.8", - "redox_syscall", + "getrandom 0.2.9", + "redox_syscall 0.2.16", "thiserror", ] @@ -8748,7 +8778,7 @@ checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.2", + "syn 2.0.15", ] [[package]] @@ -8765,13 +8795,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" dependencies = [ - "aho-corasick", + "aho-corasick 1.0.1", "memchr", - "regex-syntax", + "regex-syntax 0.7.1", ] [[package]] @@ -8780,14 +8810,20 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax", + "regex-syntax 0.6.29", ] [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" [[package]] name = "region" @@ -8795,7 +8831,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" dependencies = [ - "bitflags 1.3.2", + "bitflags", "libc", "mach", "winapi", @@ -8849,8 +8885,8 @@ dependencies = [ [[package]] name = "rococo-runtime" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "binary-merkle-tree", "frame-benchmarking", @@ -8912,9 +8948,9 @@ dependencies = [ "smallvec", "sp-api", "sp-authority-discovery", - "sp-beefy", "sp-block-builder", "sp-consensus-babe", + "sp-consensus-beefy", "sp-core", "sp-inherents", "sp-io", @@ -8935,8 +8971,8 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "frame-support", "polkadot-primitives", @@ -8979,7 +9015,7 @@ dependencies = [ "log", "netlink-packet-route", "netlink-proto", - "nix 0.24.3", + "nix", "thiserror", "tokio", ] @@ -9047,9 +9083,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustc-hash" @@ -9083,18 +9119,32 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.10" +version = "0.36.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe885c3a125aa45213b68cc1472a49880cb5923dc23f522ad2791b882228778" +checksum = "3a38f9520be93aba504e8ca974197f46158de5dcaa9fa04b57c57cd6a679d658" dependencies = [ - "bitflags 1.3.2", + "bitflags", "errno", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.1.4", "windows-sys 0.45.0", ] +[[package]] +name = "rustix" +version = "0.37.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.7", + "windows-sys 0.48.0", +] + [[package]] name = "rustls" version = "0.19.1" @@ -9185,7 +9235,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "log", "sp-core", @@ -9196,7 +9246,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "futures", @@ -9209,6 +9259,7 @@ dependencies = [ "prost-build", "rand 0.8.5", "sc-client-api", + "sc-network", "sc-network-common", "sp-api", "sp-authority-discovery", @@ -9223,7 +9274,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "futures", "futures-timer", @@ -9246,7 +9297,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -9256,28 +9307,31 @@ dependencies = [ "sp-core", "sp-inherents", "sp-runtime", - "sp-state-machine", ] [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "memmap2", "sc-chain-spec-derive", - "sc-network-common", + "sc-client-api", + "sc-executor", + "sc-network", "sc-telemetry", "serde", "serde_json", + "sp-blockchain", "sp-core", "sp-runtime", + "sp-state-machine", ] [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9288,7 +9342,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -9328,7 +9382,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "fnv", "futures", @@ -9354,7 +9408,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "hash-db", "kvdb", @@ -9380,7 +9434,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "futures", @@ -9405,7 +9459,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "futures", @@ -9434,7 +9488,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "fork-tree", @@ -9473,7 +9527,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "futures", "jsonrpsee", @@ -9492,10 +9546,64 @@ dependencies = [ "thiserror", ] +[[package]] +name = "sc-consensus-beefy" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +dependencies = [ + "array-bytes 4.2.0", + "async-trait", + "fnv", + "futures", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-client-api", + "sc-consensus", + "sc-keystore", + "sc-network", + "sc-network-common", + "sc-network-gossip", + "sc-network-sync", + "sc-utils", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-consensus-beefy", + "sp-core", + "sp-keystore", + "sp-mmr-primitives", + "sp-runtime", + "substrate-prometheus-endpoint", + "thiserror", + "wasm-timer", +] + +[[package]] +name = "sc-consensus-beefy-rpc" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +dependencies = [ + "futures", + "jsonrpsee", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-consensus-beefy", + "sc-rpc", + "serde", + "sp-consensus-beefy", + "sp-core", + "sp-runtime", + "thiserror", +] + [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "fork-tree", "parity-scale-codec", @@ -9505,10 +9613,70 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "sc-consensus-grandpa" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +dependencies = [ + "ahash 0.8.3", + "array-bytes 4.2.0", + "async-trait", + "dyn-clone", + "finality-grandpa", + "fork-tree", + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "rand 0.8.5", + "sc-block-builder", + "sc-chain-spec", + "sc-client-api", + "sc-consensus", + "sc-network", + "sc-network-common", + "sc-network-gossip", + "sc-telemetry", + "sc-utils", + "serde_json", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-consensus-grandpa", + "sp-core", + "sp-keystore", + "sp-runtime", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-consensus-grandpa-rpc" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +dependencies = [ + "finality-grandpa", + "futures", + "jsonrpsee", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-consensus-grandpa", + "sc-rpc", + "serde", + "sp-blockchain", + "sp-core", + "sp-runtime", + "thiserror", +] + [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "futures", @@ -9531,7 +9699,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "lru 0.8.1", "parity-scale-codec", @@ -9555,7 +9723,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -9568,7 +9736,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "log", "sc-allocator", @@ -9581,14 +9749,14 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "anyhow", "cfg-if", "libc", "log", "once_cell", - "rustix", + "rustix 0.36.13", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -9596,76 +9764,17 @@ dependencies = [ "wasmtime", ] -[[package]] -name = "sc-finality-grandpa" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" -dependencies = [ - "ahash 0.8.3", - "array-bytes 4.2.0", - "async-trait", - "dyn-clone", - "finality-grandpa", - "fork-tree", - "futures", - "futures-timer", - "log", - "parity-scale-codec", - "parking_lot 0.12.1", - "rand 0.8.5", - "sc-block-builder", - "sc-chain-spec", - "sc-client-api", - "sc-consensus", - "sc-network", - "sc-network-common", - "sc-network-gossip", - "sc-telemetry", - "sc-utils", - "serde_json", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-finality-grandpa", - "sp-keystore", - "sp-runtime", - "substrate-prometheus-endpoint", - "thiserror", -] - -[[package]] -name = "sc-finality-grandpa-rpc" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" -dependencies = [ - "finality-grandpa", - "futures", - "jsonrpsee", - "log", - "parity-scale-codec", - "sc-client-api", - "sc-finality-grandpa", - "sc-rpc", - "serde", - "sp-blockchain", - "sp-core", - "sp-runtime", - "thiserror", -] - [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "ansi_term", "futures", "futures-timer", "log", "sc-client-api", + "sc-network", "sc-network-common", "sp-blockchain", "sp-runtime", @@ -9674,7 +9783,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -9689,12 +9798,12 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "array-bytes 4.2.0", + "async-channel", "async-trait", "asynchronous-codec", - "backtrace", "bytes", "either", "fnv", @@ -9702,6 +9811,7 @@ dependencies = [ "futures-timer", "ip_network", "libp2p", + "linked_hash_set", "log", "lru 0.8.1", "mockall", @@ -9732,7 +9842,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "cid", "futures", @@ -9741,6 +9851,7 @@ dependencies = [ "prost", "prost-build", "sc-client-api", + "sc-network", "sc-network-common", "sp-blockchain", "sp-runtime", @@ -9751,33 +9862,35 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ + "array-bytes 4.2.0", "async-trait", - "bitflags 1.3.2", + "bitflags", "bytes", "futures", "futures-timer", "libp2p", - "linked_hash_set", "parity-scale-codec", "prost-build", "sc-consensus", "sc-peerset", + "sc-utils", "serde", "smallvec", "sp-blockchain", "sp-consensus", - "sp-finality-grandpa", + "sp-consensus-grandpa", "sp-runtime", "substrate-prometheus-endpoint", "thiserror", + "zeroize", ] [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "ahash 0.8.3", "futures", @@ -9785,6 +9898,7 @@ dependencies = [ "libp2p", "log", "lru 0.8.1", + "sc-network", "sc-network-common", "sc-peerset", "sp-runtime", @@ -9795,7 +9909,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "array-bytes 4.2.0", "futures", @@ -9805,6 +9919,7 @@ dependencies = [ "prost", "prost-build", "sc-client-api", + "sc-network", "sc-network-common", "sc-peerset", "sp-blockchain", @@ -9816,12 +9931,13 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "array-bytes 4.2.0", "async-trait", "fork-tree", "futures", + "futures-timer", "libp2p", "log", "lru 0.8.1", @@ -9831,6 +9947,7 @@ dependencies = [ "prost-build", "sc-client-api", "sc-consensus", + "sc-network", "sc-network-common", "sc-peerset", "sc-utils", @@ -9838,8 +9955,8 @@ dependencies = [ "sp-arithmetic", "sp-blockchain", "sp-consensus", + "sp-consensus-grandpa", "sp-core", - "sp-finality-grandpa", "sp-runtime", "substrate-prometheus-endpoint", "thiserror", @@ -9848,7 +9965,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "array-bytes 4.2.0", "futures", @@ -9856,6 +9973,7 @@ dependencies = [ "log", "parity-scale-codec", "pin-project", + "sc-network", "sc-network-common", "sc-peerset", "sc-utils", @@ -9867,7 +9985,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -9883,6 +10001,7 @@ dependencies = [ "parking_lot 0.12.1", "rand 0.8.5", "sc-client-api", + "sc-network", "sc-network-common", "sc-peerset", "sc-utils", @@ -9897,7 +10016,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "futures", "libp2p", @@ -9910,7 +10029,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -9919,7 +10038,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "futures", "jsonrpsee", @@ -9949,7 +10068,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -9968,7 +10087,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "http", "jsonrpsee", @@ -9983,7 +10102,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10009,7 +10128,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "directories", @@ -10075,7 +10194,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "log", "parity-scale-codec", @@ -10086,12 +10205,12 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "clap", + "fs4", "futures", "log", - "nix 0.26.2", "sc-client-db", "sc-utils", "sp-core", @@ -10102,7 +10221,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10110,7 +10229,7 @@ dependencies = [ "sc-client-api", "sc-consensus-babe", "sc-consensus-epochs", - "sc-finality-grandpa", + "sc-consensus-grandpa", "serde", "serde_json", "sp-blockchain", @@ -10121,7 +10240,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "futures", "libc", @@ -10140,7 +10259,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "chrono", "futures", @@ -10159,7 +10278,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "ansi_term", "atty", @@ -10190,7 +10309,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10201,7 +10320,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "futures", @@ -10228,7 +10347,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "futures", @@ -10242,22 +10361,23 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ - "backtrace", + "async-channel", "futures", "futures-timer", "lazy_static", "log", "parking_lot 0.12.1", "prometheus", + "sp-arithmetic", ] [[package]] name = "scale-info" -version = "2.3.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +checksum = "dfdef77228a4c05dc94211441595746732131ad7f6530c6c18f045da7b7ab937" dependencies = [ "bitvec", "cfg-if", @@ -10269,9 +10389,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +checksum = "53012eae69e5aa5c14671942a5dd47de59d4cdcff8532a6dd0e081faf1119482" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10369,7 +10489,7 @@ checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ "base16ct", "der", - "generic-array 0.14.6", + "generic-array 0.14.7", "pkcs8", "subtle", "zeroize", @@ -10408,7 +10528,7 @@ version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -10451,29 +10571,29 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.157" +version = "1.0.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707de5fcf5df2b5788fca98dd7eab490bc2fd9b7ef1404defc462833b83f25ca" +checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.157" +version = "1.0.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78997f4555c22a7971214540c4a661291970619afd56de19f77e0de86296e1e5" +checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.2", + "syn 2.0.15", ] [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", @@ -10542,9 +10662,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +checksum = "54c2bb1a323307527314a36bfb73f24febb08ce2b8a554bf4ffd6f51ad15198c" dependencies = [ "digest 0.10.6", "keccak", @@ -10586,9 +10706,9 @@ dependencies = [ [[package]] name = "simba" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50582927ed6f77e4ac020c057f37a268fc6aebc29225050365aacbb9deeeddc4" +checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" dependencies = [ "approx", "num-complex", @@ -10614,14 +10734,14 @@ dependencies = [ [[package]] name = "slice-group-by" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "slot-range-helper" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "enumn", "parity-scale-codec", @@ -10698,7 +10818,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "hash-db", "log", @@ -10716,9 +10836,11 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ + "Inflector", "blake2", + "expander 1.0.0", "proc-macro-crate", "proc-macro2", "quote", @@ -10728,7 +10850,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "scale-info", @@ -10741,7 +10863,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "integer-sqrt", "num-traits", @@ -10755,7 +10877,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "scale-info", @@ -10765,29 +10887,10 @@ dependencies = [ "sp-std", ] -[[package]] -name = "sp-beefy" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" -dependencies = [ - "lazy_static", - "parity-scale-codec", - "scale-info", - "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-mmr-primitives", - "sp-runtime", - "sp-std", - "strum", -] - [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "sp-api", @@ -10799,7 +10902,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "futures", "log", @@ -10817,25 +10920,22 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "futures", "log", - "parity-scale-codec", "sp-core", "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-std", - "sp-version", "thiserror", ] [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "parity-scale-codec", @@ -10853,7 +10953,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "merlin", @@ -10873,10 +10973,47 @@ dependencies = [ "sp-timestamp", ] +[[package]] +name = "sp-consensus-beefy" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +dependencies = [ + "lazy_static", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-mmr-primitives", + "sp-runtime", + "sp-std", + "strum", +] + +[[package]] +name = "sp-consensus-grandpa" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +dependencies = [ + "finality-grandpa", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "sp-runtime", + "sp-std", +] + [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "scale-info", @@ -10888,7 +11025,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "scale-info", @@ -10901,11 +11038,11 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "array-bytes 4.2.0", "base58", - "bitflags 1.3.2", + "bitflags", "blake2", "bounded-collections", "dyn-clonable", @@ -10944,9 +11081,9 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ - "blake2", + "blake2b_simd", "byteorder", "digest 0.10.6", "sha2 0.10.6", @@ -10958,7 +11095,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "proc-macro2", "quote", @@ -10969,7 +11106,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -10978,7 +11115,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "proc-macro2", "quote", @@ -10988,7 +11125,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "environmental", "parity-scale-codec", @@ -10996,28 +11133,10 @@ dependencies = [ "sp-storage", ] -[[package]] -name = "sp-finality-grandpa" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" -dependencies = [ - "finality-grandpa", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-keystore", - "sp-runtime", - "sp-std", -] - [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11032,7 +11151,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "bytes", "ed25519", @@ -11057,7 +11176,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "lazy_static", "sp-core", @@ -11068,7 +11187,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "futures", @@ -11085,7 +11204,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "thiserror", "zstd", @@ -11094,7 +11213,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -11112,7 +11231,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "scale-info", @@ -11126,7 +11245,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "sp-api", "sp-core", @@ -11136,7 +11255,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "backtrace", "lazy_static", @@ -11146,7 +11265,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "rustc-hash", "serde", @@ -11156,7 +11275,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "either", "hash256-std-hasher", @@ -11178,7 +11297,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -11196,7 +11315,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "Inflector", "proc-macro-crate", @@ -11208,7 +11327,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "scale-info", @@ -11222,7 +11341,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "scale-info", @@ -11234,7 +11353,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "hash-db", "log", @@ -11254,12 +11373,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11272,7 +11391,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "futures-timer", @@ -11287,7 +11406,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "sp-std", @@ -11299,7 +11418,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "sp-api", "sp-runtime", @@ -11308,7 +11427,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "log", @@ -11324,7 +11443,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "ahash 0.8.3", "hash-db", @@ -11347,7 +11466,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11364,7 +11483,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -11375,7 +11494,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -11389,7 +11508,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "parity-scale-codec", "scale-info", @@ -11497,9 +11616,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.39.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecf0bd63593ef78eca595a7fc25e9a443ca46fe69fd472f8f09f5245cdcd769d" +checksum = "eb47a8ad42e5fc72d5b1eb104a5546937eaf39843499948bb666d6e93c62423b" dependencies = [ "Inflector", "num-format", @@ -11540,7 +11659,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg_aliases", "libc", "parking_lot 0.11.2", @@ -11638,7 +11757,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "platforms 2.0.0", ] @@ -11646,7 +11765,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -11665,7 +11784,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "hyper", "log", @@ -11677,7 +11796,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "jsonrpsee", @@ -11690,7 +11809,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "jsonrpsee", "log", @@ -11709,7 +11828,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "ansi_term", "build-helper", @@ -11751,9 +11870,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.2" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d3276aee1fa0c33612917969b5172b5be2db051232a6e4826f1a1a9191b045" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" dependencies = [ "proc-macro2", "quote", @@ -11778,7 +11897,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "system-configuration-sys", ] @@ -11801,21 +11920,21 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.6" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" +checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" [[package]] name = "tempfile" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", - "rustix", - "windows-sys 0.42.0", + "redox_syscall 0.3.5", + "rustix 0.37.19", + "windows-sys 0.45.0", ] [[package]] @@ -11861,7 +11980,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.2", + "syn 2.0.15", ] [[package]] @@ -12007,14 +12126,13 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.26.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" +checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" dependencies = [ "autocfg", "bytes", "libc", - "memchr", "mio", "num_cpus", "parking_lot 0.12.1", @@ -12022,18 +12140,18 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "1.8.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -12049,9 +12167,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", "pin-project-lite 0.2.9", @@ -12061,9 +12179,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" dependencies = [ "bytes", "futures-core", @@ -12091,9 +12209,9 @@ checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" [[package]] name = "toml_edit" -version = "0.19.7" +version = "0.19.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc18466501acd8ac6a3f615dd29a3438f8ca6bb3b19537138b3106e575621274" +checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" dependencies = [ "indexmap", "toml_datetime", @@ -12117,7 +12235,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ - "bitflags 1.3.2", + "bitflags", "bytes", "futures-core", "futures-util", @@ -12156,13 +12274,13 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -12187,8 +12305,8 @@ dependencies = [ [[package]] name = "tracing-gum" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -12198,8 +12316,8 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "expander 0.0.6", "proc-macro-crate", @@ -12254,9 +12372,9 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.25.1" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3390c0409daaa6027d6681393316f4ccd3ff82e1590a1e4725014e3ae2bf1920" +checksum = "767abe6ffed88a1889671a102c2861ae742726f52e0a5a425b92c9fbfa7e9c85" dependencies = [ "hash-db", "hashbrown 0.13.2", @@ -12267,9 +12385,9 @@ dependencies = [ [[package]] name = "trie-root" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" +checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b" dependencies = [ "hash-db", ] @@ -12329,7 +12447,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" dependencies = [ "async-trait", "clap", @@ -12426,9 +12544,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d502c968c6a838ead8e69b2ee18ec708802f99db92a0d156705ec9ef801993b" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" @@ -12463,7 +12581,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "subtle", ] @@ -12506,13 +12624,19 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "uuid" -version = "1.3.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +checksum = "4dad5567ad0cf5b760e5665964bec1b47dfd077ba8a2544b513f3556d3d239a2" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", ] [[package]] @@ -12769,9 +12893,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e89f9819523447330ffd70367ef4a18d8c832e24e8150fe054d1d912841632" +checksum = "76a222f5fa1e14b2cefc286f1b68494d7a965f4bf57ec04c59bb62673d639af6" dependencies = [ "anyhow", "bincode", @@ -12797,18 +12921,18 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd3a5e46c198032da934469f3a6e48649d1f9142438e4fd4617b68a35644b8a" +checksum = "4407a7246e7d2f3d8fb1cf0c72fda8dbafdb6dd34d555ae8bea0e5ae031089cc" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b389ae9b678b9c3851091a4804f4182d688d27aff7abc9aa37fa7be37d8ecffa" +checksum = "5ceb3adf61d654be0be67fffdce42447b0880481348785be5fe40b5dd7663a4c" dependencies = [ "anyhow", "base64 0.13.1", @@ -12816,7 +12940,7 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix", + "rustix 0.36.13", "serde", "sha2 0.10.6", "toml", @@ -12826,9 +12950,9 @@ dependencies = [ [[package]] name = "wasmtime-cranelift" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b2c92a08c0db6efffd88fdc97d7aa9c7c63b03edb0971dbca745469f820e8c" +checksum = "3c366bb8647e01fd08cb5589976284b00abfded5529b33d7e7f3f086c68304a4" dependencies = [ "anyhow", "cranelift-codegen", @@ -12847,9 +12971,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a6db9fc52985ba06ca601f2ff0ff1f526c5d724c7ac267b47326304b0c97883" +checksum = "47b8b50962eae38ee319f7b24900b7cf371f03eebdc17400c1dc8575fc10c9a7" dependencies = [ "anyhow", "cranelift-entity", @@ -12866,9 +12990,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b77e3a52cd84d0f7f18554afa8060cfe564ccac61e3b0802d3fd4084772fa5f6" +checksum = "ffaed4f9a234ba5225d8e64eac7b4a5d13b994aeb37353cde2cbeb3febda9eaa" dependencies = [ "addr2line 0.17.0", "anyhow", @@ -12890,20 +13014,20 @@ dependencies = [ [[package]] name = "wasmtime-jit-debug" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0245e8a9347017c7185a72e215218a802ff561545c242953c11ba00fccc930f" +checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" dependencies = [ "object 0.29.0", "once_cell", - "rustix", + "rustix 0.36.13", ] [[package]] name = "wasmtime-jit-icache-coherence" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67d412e9340ab1c83867051d8d1d7c90aa8c9afc91da086088068e2734e25064" +checksum = "43a28ae1e648461bfdbb79db3efdaee1bca5b940872e4175390f465593a2e54c" dependencies = [ "cfg-if", "libc", @@ -12912,9 +13036,9 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d594e791b5fdd4dbaf8cf7ae62f2e4ff85018ce90f483ca6f42947688e48827d" +checksum = "e704b126e4252788ccfc3526d4d4511d4b23c521bf123e447ac726c14545217b" dependencies = [ "anyhow", "cc", @@ -12927,7 +13051,7 @@ dependencies = [ "memoffset 0.6.5", "paste", "rand 0.8.5", - "rustix", + "rustix 0.36.13", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", @@ -12936,9 +13060,9 @@ dependencies = [ [[package]] name = "wasmtime-types" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6688d6f96d4dbc1f89fab626c56c1778936d122b5f4ae7a57c2eb42b8d982e2" +checksum = "83e5572c5727c1ee7e8f28717aaa8400e4d22dcbd714ea5457d85b5005206568" dependencies = [ "cranelift-entity", "serde", @@ -13121,18 +13245,15 @@ dependencies = [ [[package]] name = "webrtc-media" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a3c157a040324e5049bcbd644ffc9079e6738fa2cfab2bcff64e5cc4c00d7" +checksum = "f72e1650a8ae006017d1a5280efb49e2610c19ccc3c0905b03b648aee9554991" dependencies = [ "byteorder", "bytes", - "derive_builder", - "displaydoc", "rand 0.8.5", "rtp", "thiserror", - "webrtc-util", ] [[package]] @@ -13183,14 +13304,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" dependencies = [ "async-trait", - "bitflags 1.3.2", + "bitflags", "bytes", "cc", "ipnet", "lazy_static", "libc", "log", - "nix 0.24.3", + "nix", "rand 0.8.5", "thiserror", "tokio", @@ -13199,8 +13320,8 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bitvec", "frame-benchmarking", @@ -13267,9 +13388,9 @@ dependencies = [ "smallvec", "sp-api", "sp-authority-discovery", - "sp-beefy", "sp-block-builder", "sp-consensus-babe", + "sp-consensus-beefy", "sp-core", "sp-inherents", "sp-io", @@ -13291,8 +13412,8 @@ dependencies = [ [[package]] name = "westend-runtime-constants" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "frame-support", "polkadot-primitives", @@ -13374,18 +13495,27 @@ dependencies = [ "windows_x86_64_msvc 0.34.0", ] +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.0", +] + [[package]] name = "windows-sys" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.42.2", "windows_aarch64_msvc 0.42.2", "windows_i686_gnu 0.42.2", "windows_i686_msvc 0.42.2", "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.42.2", "windows_x86_64_msvc 0.42.2", ] @@ -13395,7 +13525,16 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", ] [[package]] @@ -13404,21 +13543,42 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.42.2", "windows_aarch64_msvc 0.42.2", "windows_i686_gnu 0.42.2", "windows_i686_msvc 0.42.2", "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.42.2", "windows_x86_64_msvc 0.42.2", ] +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.34.0" @@ -13431,6 +13591,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.34.0" @@ -13443,6 +13609,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.34.0" @@ -13455,6 +13627,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.34.0" @@ -13467,12 +13645,24 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.34.0" @@ -13485,11 +13675,17 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + [[package]] name = "winnow" -version = "0.3.6" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966" +checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" dependencies = [ "memchr", ] @@ -13573,8 +13769,8 @@ dependencies = [ [[package]] name = "xcm" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "bounded-collections", "derivative", @@ -13589,8 +13785,8 @@ dependencies = [ [[package]] name = "xcm-builder" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "frame-support", "frame-system", @@ -13610,8 +13806,8 @@ dependencies = [ [[package]] name = "xcm-executor" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "environmental", "frame-benchmarking", @@ -13630,8 +13826,8 @@ dependencies = [ [[package]] name = "xcm-procedural" -version = "0.9.39-1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.39#c22e1c4173bf6966f5d1980f4299f7abe836f0c1" +version = "0.9.40" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" dependencies = [ "Inflector", "proc-macro2", @@ -13655,32 +13851,31 @@ dependencies = [ [[package]] name = "yasna" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aed2e7a52e3744ab4d0c05c20aa065258e84c49fd4226f5191b2ed29712710b4" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ "time 0.3.20", ] [[package]] name = "zeroize" -version = "1.5.7" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.3.3" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", - "synstructure", + "syn 2.0.15", ] [[package]] @@ -13704,9 +13899,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.7+zstd.1.5.4" +version = "2.0.8+zstd.1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94509c3ba2fe55294d752b79842c530ccfab760192521df74a081a78d2b3c7f5" +checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" dependencies = [ "cc", "libc", diff --git a/Cargo.toml b/Cargo.toml index a08152f9c2..e3980bc174 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ panic = "unwind" [workspace.dependencies] # Build deps -substrate-wasm-builder = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} +substrate-wasm-builder = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} # External (without extra features and with default disabled if necessary) base58 = {version = "0.2.0", default-features = false} @@ -71,111 +71,111 @@ peregrine-runtime = {path = "runtimes/peregrine", default-features = false} spiritnet-runtime = {path = "runtimes/spiritnet", default-features = false} # Benchmarking (with default disabled) -cumulus-pallet-session-benchmarking = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} -frame-system-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} +cumulus-pallet-session-benchmarking = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +frame-system-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} # Cumulus (with default disabled) -cumulus-pallet-aura-ext = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} -cumulus-pallet-dmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} -cumulus-pallet-parachain-system = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} -cumulus-pallet-xcm = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} -cumulus-pallet-xcmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} -cumulus-primitives-core = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} -cumulus-primitives-timestamp = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} -cumulus-primitives-utility = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} -pallet-collator-selection = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} -parachain-info = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.39"} +cumulus-pallet-aura-ext = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +cumulus-pallet-dmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +cumulus-pallet-parachain-system = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +cumulus-pallet-xcm = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +cumulus-pallet-xcmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +cumulus-primitives-core = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +cumulus-primitives-timestamp = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +cumulus-primitives-utility = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +pallet-collator-selection = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +parachain-info = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} # Substrate (with default disabled) -frame-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -frame-executive = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -frame-support = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -frame-system = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -frame-system-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -frame-try-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-authorship = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-balances = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-collective = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-democracy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-grandpa = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-indices = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-membership = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-preimage = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-proxy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-scheduler = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-sudo = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-timestamp = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-tips = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-transaction-payment-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-treasury = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-utility = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-vesting = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -pallet-multisig = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-block-builder = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-consensus-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-inherents = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-io = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-offchain = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-staking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-std = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-transaction-pool = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-version = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -sp-weights = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} -try-runtime-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39"} +frame-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +frame-executive = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +frame-support = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +frame-system = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +frame-system-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +frame-try-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-authorship = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-balances = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-collective = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-democracy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-grandpa = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-indices = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-membership = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-preimage = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-proxy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-scheduler = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-sudo = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-timestamp = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-tips = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-transaction-payment-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-treasury = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-utility = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-vesting = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +pallet-multisig = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-block-builder = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-consensus-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-inherents = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-io = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-offchain = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-staking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-std = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-transaction-pool = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-version = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +sp-weights = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +try-runtime-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} # Polkadot (with default disabled) -pallet-xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.39"} -polkadot-parachain = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.39"} -xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.39"} -xcm-builder = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.39"} -xcm-executor = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.39"} +pallet-xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"} +polkadot-parachain = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"} +xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"} +xcm-builder = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"} +xcm-executor = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"} # Client-only (with default enabled) -cumulus-client-cli = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39"} -cumulus-client-consensus-aura = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39"} -cumulus-client-consensus-common = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39"} -cumulus-client-network = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39"} -cumulus-client-service = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39"} -cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39"} -cumulus-relay-chain-inprocess-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39"} -cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39"} -cumulus-relay-chain-minimal-node = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39"} -cumulus-relay-chain-rpc-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39"} -pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -polkadot-cli = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39"} -polkadot-primitives = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39"} -polkadot-service = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39"} -sc-basic-authorship = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-chain-spec = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-client-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-finality-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-rpc-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-sysinfo = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-telemetry = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-tracing = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sp-blockchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sp-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sp-finality-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sp-keyring = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sp-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -sp-timestamp = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -substrate-build-script-utils = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -substrate-frame-rpc-system = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} -substrate-prometheus-endpoint = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39"} +cumulus-client-cli = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} +cumulus-client-consensus-aura = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} +cumulus-client-consensus-common = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} +cumulus-client-network = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} +cumulus-client-service = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} +cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} +cumulus-relay-chain-inprocess-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} +cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} +cumulus-relay-chain-minimal-node = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} +cumulus-relay-chain-rpc-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} +pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +polkadot-cli = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40"} +polkadot-primitives = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40"} +polkadot-service = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40"} +sc-basic-authorship = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-chain-spec = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-client-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-rpc-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-sysinfo = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-telemetry = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-tracing = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sp-blockchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sp-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sp-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sp-keyring = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sp-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sp-timestamp = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +substrate-build-script-utils = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +substrate-frame-rpc-system = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +substrate-prometheus-endpoint = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} diff --git a/nodes/standalone/Cargo.toml b/nodes/standalone/Cargo.toml index bb1ccdb017..bd2907c334 100644 --- a/nodes/standalone/Cargo.toml +++ b/nodes/standalone/Cargo.toml @@ -38,7 +38,7 @@ sc-client-api.workspace = true sc-consensus.workspace = true sc-consensus-aura.workspace = true sc-executor = {workspace = true} -sc-finality-grandpa.workspace = true +sc-consensus-grandpa.workspace = true sc-keystore.workspace = true sc-service = {workspace = true} sc-telemetry.workspace = true @@ -49,7 +49,7 @@ sp-block-builder = {workspace = true, features = ["std"]} sp-blockchain.workspace = true sp-consensus-aura = {workspace = true, features = ["std"]} sp-core = {workspace = true, features = ["std"]} -sp-finality-grandpa = {workspace = true, features = ["std"]} +sp-consensus-grandpa = {workspace = true, features = ["std"]} sp-inherents = {workspace = true, features = ["std"]} sp-io = {workspace = true, features = ["std"]} sp-keyring.workspace = true diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index b99f97c88b..3d3084a80b 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -40,6 +40,7 @@ use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use frame_try_runtime::UpgradeCheckSelect; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; +use pallet_session::historical as session_historical; use pallet_transaction_payment::{CurrencyAdapter, FeeDetails}; use sp_api::impl_runtime_apis; use sp_consensus_aura::{ed25519::AuthorityId as AuraId, SlotDuration}; @@ -212,20 +213,12 @@ impl pallet_aura::Config for Runtime { impl pallet_grandpa::Config for Runtime { type RuntimeEvent = RuntimeEvent; - - type KeyOwnerProofSystem = (); - - type KeyOwnerProof = >::Proof; - - type KeyOwnerIdentification = - >::IdentificationTuple; - - type HandleEquivocation = (); - + type KeyOwnerProof = >::Proof; type WeightInfo = (); type MaxAuthorities = MaxAuthorities; // This is a purely random value type MaxSetIdSessionEntries = ConstU64<100>; + type EquivocationReportSystem = (); } parameter_types! { @@ -682,7 +675,7 @@ construct_runtime!( Session: pallet_session = 15, Authorship: pallet_authorship = 16, - + Historical: session_historical::{Pallet} = 17, // Democracy: pallet_democracy = 25, // Council: pallet_collective = 26, // TechnicalCommittee: pallet_collective = 27, From fa6b054a644f24d383dc7e7d493d1f65e1253be8 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 5 May 2023 16:14:44 +0200 Subject: [PATCH 02/99] no warnings. two errors --- .maintain/weight-template.hbs | 12 +- nodes/parachain/src/service.rs | 5 +- nodes/standalone/src/chain_spec.rs | 2 +- nodes/standalone/src/command.rs | 2 +- nodes/standalone/src/service.rs | 28 ++-- pallets/attestation/src/lib.rs | 1 - pallets/ctype/src/lib.rs | 1 - pallets/delegation/src/default_weights.rs | 20 +-- pallets/delegation/src/lib.rs | 1 - pallets/did/src/default_weights.rs | 24 +-- pallets/did/src/lib.rs | 1 - pallets/pallet-did-lookup/src/lib.rs | 1 - .../pallet-inflation/src/default_weights.rs | 4 +- pallets/pallet-inflation/src/lib.rs | 1 - pallets/pallet-web3-names/src/lib.rs | 1 - .../parachain-staking/src/default_weights.rs | 141 +++++++++--------- pallets/parachain-staking/src/lib.rs | 1 - pallets/public-credentials/src/lib.rs | 1 - runtimes/common/src/fees.rs | 2 +- .../peregrine/src/weights/pallet_multisig.rs | 34 ++--- runtimes/spiritnet/src/weights/attestation.rs | 12 +- runtimes/spiritnet/src/weights/ctype.rs | 6 +- runtimes/spiritnet/src/weights/delegation.rs | 34 ++--- runtimes/spiritnet/src/weights/did.rs | 94 ++++++------ .../spiritnet/src/weights/frame_system.rs | 22 +-- .../spiritnet/src/weights/pallet_balances.rs | 14 +- .../src/weights/pallet_collective.rs | 58 +++---- .../src/weights/pallet_did_lookup.rs | 22 +-- .../spiritnet/src/weights/pallet_indices.rs | 10 +- .../spiritnet/src/weights/pallet_inflation.rs | 4 +- .../src/weights/pallet_membership.rs | 28 ++-- .../spiritnet/src/weights/pallet_multisig.rs | 34 ++--- .../spiritnet/src/weights/pallet_preimage.rs | 30 ++-- .../spiritnet/src/weights/pallet_proxy.rs | 40 ++--- .../spiritnet/src/weights/pallet_scheduler.rs | 36 ++--- .../spiritnet/src/weights/pallet_session.rs | 4 +- .../spiritnet/src/weights/pallet_timestamp.rs | 4 +- runtimes/spiritnet/src/weights/pallet_tips.rs | 22 +-- .../spiritnet/src/weights/pallet_treasury.rs | 16 +- .../spiritnet/src/weights/pallet_utility.rs | 16 +- .../spiritnet/src/weights/pallet_vesting.rs | 44 +++--- .../src/weights/pallet_web3_names.rs | 16 +- runtimes/spiritnet/src/weights/pallet_xcm.rs | 30 ++-- .../src/weights/parachain_staking.rs | 108 +++++++------- .../src/weights/public_credentials.rs | 16 +- runtimes/standalone/src/lib.rs | 8 +- 46 files changed, 502 insertions(+), 509 deletions(-) diff --git a/.maintain/weight-template.hbs b/.maintain/weight-template.hbs index 583735ff80..bdcf1d4617 100644 --- a/.maintain/weight-template.hbs +++ b/.maintain/weight-template.hbs @@ -57,11 +57,11 @@ impl WeightInfo for SubstrateWeight { {{#if (ne benchmark.base_calculated_proof_size "0")}} Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}}) {{else}} - Weight::from_ref_time({{underscore benchmark.base_weight}}) + Weight::from_parts({{underscore benchmark.base_weight}}, 0) {{/if}} {{#each benchmark.component_weight as |cw|}} // Standard Error: {{underscore cw.error}} - .saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}}.into())) + .saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into())) {{/each}} {{#if (ne benchmark.base_reads "0")}} .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64)) @@ -76,7 +76,7 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into()))) {{/each}} {{#each benchmark.component_calculated_proof_size as |cp|}} - .saturating_add(Weight::from_proof_size({{cp.slope}}).saturating_mul({{cp.name}}.into())) + .saturating_add(Weight::from_parts(0 ,{{cp.slope}}).saturating_mul({{cp.name}}.into())) {{/each}} } {{/each}} @@ -103,11 +103,11 @@ impl WeightInfo for () { {{#if (ne benchmark.base_calculated_proof_size "0")}} Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}}) {{else}} - Weight::from_ref_time({{underscore benchmark.base_weight}}) + Weight::from_parts({{underscore benchmark.base_weight}}, 0) {{/if}} {{#each benchmark.component_weight as |cw|}} // Standard Error: {{underscore cw.error}} - .saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}}.into())) + .saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into())) {{/each}} {{#if (ne benchmark.base_reads "0")}} .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64)) @@ -122,7 +122,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into()))) {{/each}} {{#each benchmark.component_calculated_proof_size as |cp|}} - .saturating_add(Weight::from_proof_size({{cp.slope}}).saturating_mul({{cp.name}}.into())) + .saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into())) {{/each}} } {{/each}} diff --git a/nodes/parachain/src/service.rs b/nodes/parachain/src/service.rs index caa7cb0a29..18e5bdd78c 100644 --- a/nodes/parachain/src/service.rs +++ b/nodes/parachain/src/service.rs @@ -32,7 +32,7 @@ use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node; use polkadot_service::{CollatorPair, NativeExecutionDispatch}; use sc_consensus::ImportQueue; use sc_executor::NativeElseWasmExecutor; -use sc_network::{NetworkBlock, NetworkService}; +use sc_network::NetworkService; use sc_service::{Configuration, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sp_api::ConstructRuntimeApi; @@ -312,7 +312,7 @@ where let prometheus_registry = parachain_config.prometheus_registry().cloned(); let transaction_pool = params.transaction_pool.clone(); let import_queue_service = params.import_queue.service(); - let (network, system_rpc_tx, tx_handler_controller, start_network) = + let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = cumulus_client_service::build_network(cumulus_client_service::BuildNetworkParams { parachain_config: ¶chain_config, client: client.clone(), @@ -341,6 +341,7 @@ where sc_service::spawn_tasks(sc_service::SpawnTasksParams { rpc_builder, + sync_service, client: client.clone(), transaction_pool: transaction_pool.clone(), task_manager: &mut task_manager, diff --git a/nodes/standalone/src/chain_spec.rs b/nodes/standalone/src/chain_spec.rs index 697003872c..dba18da74e 100644 --- a/nodes/standalone/src/chain_spec.rs +++ b/nodes/standalone/src/chain_spec.rs @@ -26,8 +26,8 @@ use runtime_common::{AccountId, AccountPublic}; use hex_literal::hex; use sc_service::{self, ChainType, Properties}; use sp_consensus_aura::ed25519::AuthorityId as AuraId; +use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, ed25519, sr25519, Pair, Public}; -use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_runtime::traits::IdentifyAccount; // Note this is the URL for the telemetry server diff --git a/nodes/standalone/src/command.rs b/nodes/standalone/src/command.rs index 9128925a4c..2213e2f507 100644 --- a/nodes/standalone/src/command.rs +++ b/nodes/standalone/src/command.rs @@ -133,7 +133,7 @@ pub fn run() -> sc_cli::Result<()> { .. } = service::new_partial(&config)?; let aux_revert = Box::new(move |client, _, blocks| { - sc_finality_grandpa::revert(client, blocks)?; + sc_consensus_grandpa::revert(client, blocks)?; Ok(()) }); Ok((cmd.run(client, backend, Some(aux_revert)), task_manager)) diff --git a/nodes/standalone/src/service.rs b/nodes/standalone/src/service.rs index 0203f0c89f..8dceb0ee3c 100644 --- a/nodes/standalone/src/service.rs +++ b/nodes/standalone/src/service.rs @@ -21,8 +21,8 @@ use sc_client_api::BlockBackend; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; +use sc_consensus_grandpa::SharedVoterState; pub use sc_executor::NativeElseWasmExecutor; -use sc_finality_grandpa::SharedVoterState; use sc_keystore::LocalKeystore; use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams}; use sc_telemetry::{Telemetry, TelemetryWorker}; @@ -57,8 +57,8 @@ type PartialComponents = sc_service::PartialComponents< sc_consensus::DefaultImportQueue, sc_transaction_pool::FullPool, ( - sc_finality_grandpa::GrandpaBlockImport, - sc_finality_grandpa::LinkHalf, + sc_consensus_grandpa::GrandpaBlockImport, + sc_consensus_grandpa::LinkHalf, Option, ), >; @@ -108,7 +108,7 @@ pub fn new_partial(config: &Configuration) -> Result), select_chain.clone(), @@ -181,7 +181,7 @@ pub fn new_full(mut config: Configuration) -> Result } }; } - let grandpa_protocol_name = sc_finality_grandpa::protocol_standard_name( + let grandpa_protocol_name = sc_consensus_grandpa::protocol_standard_name( &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"), &config.chain_spec, ); @@ -189,16 +189,16 @@ pub fn new_full(mut config: Configuration) -> Result config .network .extra_sets - .push(sc_finality_grandpa::grandpa_peers_set_config( + .push(sc_consensus_grandpa::grandpa_peers_set_config( grandpa_protocol_name.clone(), )); - let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new( + let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new( backend.clone(), grandpa_link.shared_authority_set().clone(), Vec::default(), )); - let (network, system_rpc_tx, tx_handler_controller, network_starter) = + let (network, system_rpc_tx, tx_handler_controller, network_starter, sync) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, client: client.clone(), @@ -237,6 +237,7 @@ pub fn new_full(mut config: Configuration) -> Result let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { network: network.clone(), client: client.clone(), + sync_service: sync.clone(), keystore: keystore_container.sync_keystore(), task_manager: &mut task_manager, transaction_pool: transaction_pool.clone(), @@ -259,7 +260,7 @@ pub fn new_full(mut config: Configuration) -> Result let slot_duration = sc_consensus_aura::slot_duration(&*client)?; - let aura = sc_consensus_aura::start_aura::(StartAuraParams { + let aura = sc_consensus_aura::start_aura::(StartAuraParams { slot_duration, client, select_chain, @@ -302,7 +303,7 @@ pub fn new_full(mut config: Configuration) -> Result None }; - let grandpa_config = sc_finality_grandpa::Config { + let grandpa_config = sc_consensus_grandpa::Config { // FIXME #1578 make this available through chainspec gossip_duration: Duration::from_millis(333), justification_period: 512, @@ -320,11 +321,12 @@ pub fn new_full(mut config: Configuration) -> Result // and vote data availability than the observer. The observer has not // been tested extensively yet and having most nodes in a network run it // could lead to finality stalls. - let grandpa_config = sc_finality_grandpa::GrandpaParams { + let grandpa_config = sc_consensus_grandpa::GrandpaParams { config: grandpa_config, link: grandpa_link, + sync, network, - voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(), + voting_rule: sc_consensus_grandpa::VotingRulesBuilder::default().build(), prometheus_registry, shared_voter_state: SharedVoterState::empty(), telemetry: telemetry.as_ref().map(|x| x.handle()), @@ -335,7 +337,7 @@ pub fn new_full(mut config: Configuration) -> Result task_manager.spawn_essential_handle().spawn_blocking( "grandpa-voter", None, - sc_finality_grandpa::run_grandpa_voter(grandpa_config)?, + sc_consensus_grandpa::run_grandpa_voter(grandpa_config)?, ); } diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index f3d827d7df..67b54274b5 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -143,7 +143,6 @@ pub mod pallet { } #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); diff --git a/pallets/ctype/src/lib.rs b/pallets/ctype/src/lib.rs index 6e05fbbf49..1f55530ad8 100644 --- a/pallets/ctype/src/lib.rs +++ b/pallets/ctype/src/lib.rs @@ -102,7 +102,6 @@ pub mod pallet { } #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); diff --git a/pallets/delegation/src/default_weights.rs b/pallets/delegation/src/default_weights.rs index b8047b4c49..f6ab746eb9 100644 --- a/pallets/delegation/src/default_weights.rs +++ b/pallets/delegation/src/default_weights.rs @@ -111,13 +111,13 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 390_746 nanoseconds. Weight::from_parts(235_841_750, 2555) // Standard Error: 1_801_116 - .saturating_add(Weight::from_ref_time(151_796_125).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(151_796_125,0).saturating_mul(r.into())) // Standard Error: 1_801_116 - .saturating_add(Weight::from_ref_time(621_625).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(621_625,0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0,34675).saturating_mul(r.into())) } /// Storage: Delegation DelegationNodes (r:6 w:1) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) @@ -132,11 +132,11 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 448_052 nanoseconds. Weight::from_parts(466_867_250, 37230) // Standard Error: 4_082_010 - .saturating_add(Weight::from_ref_time(46_061_000).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(46_061_000,0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0,34675).saturating_mul(c.into())) } /// Storage: Delegation DelegationNodes (r:6 w:6) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) @@ -277,13 +277,13 @@ impl WeightInfo for () { // Minimum execution time: 390_746 nanoseconds. Weight::from_parts(235_841_750, 2555) // Standard Error: 1_801_116 - .saturating_add(Weight::from_ref_time(151_796_125).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(151_796_125, 0).saturating_mul(r.into())) // Standard Error: 1_801_116 - .saturating_add(Weight::from_ref_time(621_625).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(621_625, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(34675, 0).saturating_mul(r.into())) } /// Storage: Delegation DelegationNodes (r:6 w:1) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) @@ -298,11 +298,11 @@ impl WeightInfo for () { // Minimum execution time: 448_052 nanoseconds. Weight::from_parts(466_867_250, 37230) // Standard Error: 4_082_010 - .saturating_add(Weight::from_ref_time(46_061_000).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(46_061_000, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 34675).saturating_mul(c.into())) } /// Storage: Delegation DelegationNodes (r:6 w:6) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index 2aa33a3e47..697c9b52d4 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -179,7 +179,6 @@ pub mod pallet { } #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); diff --git a/pallets/did/src/default_weights.rs b/pallets/did/src/default_weights.rs index 06af39b2e3..b148d8e463 100644 --- a/pallets/did/src/default_weights.rs +++ b/pallets/did/src/default_weights.rs @@ -112,9 +112,9 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 1_348_855 nanoseconds. Weight::from_parts(1_213_627_805, 12524) // Standard Error: 14_593_105 - .saturating_add(Weight::from_ref_time(7_671_444).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(7_671_444, 0).saturating_mul(n.into())) // Standard Error: 5_472_414 - .saturating_add(Weight::from_ref_time(58_512_750).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(58_512_750, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -138,9 +138,9 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 1_431_811 nanoseconds. Weight::from_parts(1_174_825_500, 12524) // Standard Error: 1_405_847 - .saturating_add(Weight::from_ref_time(20_334_666).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(20_334_666, 0).saturating_mul(n.into())) // Standard Error: 527_192 - .saturating_add(Weight::from_ref_time(53_638_833).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(53_638_833, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -164,9 +164,9 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 1_180_131 nanoseconds. Weight::from_parts(947_704_381, 12524) // Standard Error: 2_114_160 - .saturating_add(Weight::from_ref_time(17_841_055).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(17_841_055, 0).saturating_mul(n.into())) // Standard Error: 792_810 - .saturating_add(Weight::from_ref_time(54_016_062).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(54_016_062 ,0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -581,9 +581,9 @@ impl WeightInfo for () { // Minimum execution time: 1_348_855 nanoseconds. Weight::from_parts(1_213_627_805, 12524) // Standard Error: 14_593_105 - .saturating_add(Weight::from_ref_time(7_671_444).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(7_671_444, 0).saturating_mul(n.into())) // Standard Error: 5_472_414 - .saturating_add(Weight::from_ref_time(58_512_750).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(58_512_750, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -607,9 +607,9 @@ impl WeightInfo for () { // Minimum execution time: 1_431_811 nanoseconds. Weight::from_parts(1_174_825_500, 12524) // Standard Error: 1_405_847 - .saturating_add(Weight::from_ref_time(20_334_666).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(20_334_666, 0).saturating_mul(n.into())) // Standard Error: 527_192 - .saturating_add(Weight::from_ref_time(53_638_833).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(53_638_833, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -633,9 +633,9 @@ impl WeightInfo for () { // Minimum execution time: 1_180_131 nanoseconds. Weight::from_parts(947_704_381, 12524) // Standard Error: 2_114_160 - .saturating_add(Weight::from_ref_time(17_841_055).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(17_841_055, 0).saturating_mul(n.into())) // Standard Error: 792_810 - .saturating_add(Weight::from_ref_time(54_016_062).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(54_016_062, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index 61f1022734..7cd91c4a78 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -284,7 +284,6 @@ pub mod pallet { } #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index 1b571d913a..d0eb6d5572 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -110,7 +110,6 @@ pub mod pallet { } #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); diff --git a/pallets/pallet-inflation/src/default_weights.rs b/pallets/pallet-inflation/src/default_weights.rs index 1301eee1a7..2e8cec355b 100644 --- a/pallets/pallet-inflation/src/default_weights.rs +++ b/pallets/pallet-inflation/src/default_weights.rs @@ -75,7 +75,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `0` // Estimated: `0` // Minimum execution time: 23_588 nanoseconds. - Weight::from_ref_time(23_588_000) + Weight::from_parts(23_588_000, 0) } } @@ -97,6 +97,6 @@ impl WeightInfo for () { // Measured: `0` // Estimated: `0` // Minimum execution time: 23_588 nanoseconds. - Weight::from_ref_time(23_588_000) + Weight::from_parts(23_588_000, 0) } } diff --git a/pallets/pallet-inflation/src/lib.rs b/pallets/pallet-inflation/src/lib.rs index f05a132ff1..a744722489 100644 --- a/pallets/pallet-inflation/src/lib.rs +++ b/pallets/pallet-inflation/src/lib.rs @@ -81,7 +81,6 @@ pub mod pallet { } #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index 40f431ee2c..a89c119fa4 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -70,7 +70,6 @@ pub mod pallet { pub type BalanceOf = as Currency>>::Balance; #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); diff --git a/pallets/parachain-staking/src/default_weights.rs b/pallets/parachain-staking/src/default_weights.rs index 90ec4dbecb..667bc3e33f 100644 --- a/pallets/parachain-staking/src/default_weights.rs +++ b/pallets/parachain-staking/src/default_weights.rs @@ -128,7 +128,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `0` // Estimated: `0` // Minimum execution time: 66_227 nanoseconds. - Weight::from_ref_time(66_227_000) + Weight::from_parts(66_227_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking CandidatePool (r:76 w:0) @@ -154,17 +154,17 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 9_013_393 nanoseconds. Weight::from_parts(9_013_393_000, 383346) // Standard Error: 4_266_402_895 - .saturating_add(Weight::from_ref_time(5_268_800_032).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(5_268_800_032, 0).saturating_mul(n.into())) // Standard Error: 9_142_291_918 - .saturating_add(Weight::from_ref_time(10_550_156_582).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(10_550_156_582, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(152_u64)) .saturating_add(T::DbWeight::get().reads((30_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().reads((60_u64).saturating_mul(m.into()))) .saturating_add(T::DbWeight::get().writes(145_u64)) .saturating_add(T::DbWeight::get().writes((28_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((60_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_proof_size(77565).saturating_mul(n.into())) - .saturating_add(Weight::from_proof_size(151620).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 77565).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 151620).saturating_mul(m.into())) } /// Storage: ParachainStaking MaxSelectedCandidates (r:1 w:1) /// Proof: ParachainStaking MaxSelectedCandidates (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -183,11 +183,11 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 1_161_641 nanoseconds. Weight::from_parts(1_161_641_000, 5168) // Standard Error: 20_294_226 - .saturating_add(Weight::from_ref_time(81_538_225).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(81_538_225, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_proof_size(3355).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3355, 0).saturating_mul(n.into())) } /// Storage: ParachainStaking Round (r:1 w:1) /// Proof: ParachainStaking Round (max_values: Some(1), max_size: Some(20), added: 515, mode: MaxEncodedLen) @@ -237,15 +237,15 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 3_973_174 nanoseconds. Weight::from_parts(3_973_174_000, 116721) // Standard Error: 300_977_057 - .saturating_add(Weight::from_ref_time(221_044_787).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(221_044_787, 0).saturating_mul(n.into())) // Standard Error: 650_450_082 - .saturating_add(Weight::from_ref_time(754_831_595).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(754_831_595, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(29_u64)) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(m.into()))) .saturating_add(T::DbWeight::get().writes(10_u64)) .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_proof_size(372).saturating_mul(n.into())) - .saturating_add(Weight::from_proof_size(16221).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 372).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 16221).saturating_mul(m.into())) } /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof: ParachainStaking CandidatePool (max_values: None, max_size: Some(1790), added: 4265, mode: MaxEncodedLen) @@ -276,9 +276,9 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 2_325_690 nanoseconds. Weight::from_parts(2_470_811_246, 22098) // Standard Error: 7_815_891 - .saturating_add(Weight::from_ref_time(599_753).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(599_753, 0).saturating_mul(n.into())) // Standard Error: 16_301_715 - .saturating_add(Weight::from_ref_time(3_997_428).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(3_997_428, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -301,7 +301,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 3_383_593 nanoseconds. Weight::from_parts(5_399_481_017, 78143) // Standard Error: 2_824_731 - .saturating_add(Weight::from_ref_time(10_745_175).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(10_745_175, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(21_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -322,9 +322,9 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 1_403_818 nanoseconds. Weight::from_parts(1_248_266_754, 13653) // Standard Error: 93_940 - .saturating_add(Weight::from_ref_time(2_102_043).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(2_102_043, 0).saturating_mul(n.into())) // Standard Error: 152_989 - .saturating_add(Weight::from_ref_time(8_893_185).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(8_893_185, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -363,13 +363,13 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 3_998_377 nanoseconds. Weight::from_parts(7_690_223_368, 25299) // Standard Error: 45_526_584 - .saturating_add(Weight::from_ref_time(526_019_957).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(526_019_957, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(m.into()))) .saturating_add(T::DbWeight::get().writes(8_u64)) .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_proof_size(312).saturating_mul(n.into())) - .saturating_add(Weight::from_proof_size(14112).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 312).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 14112).saturating_mul(m.into())) } /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof: ParachainStaking CandidatePool (max_values: None, max_size: Some(1790), added: 4265, mode: MaxEncodedLen) @@ -405,7 +405,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 944_397 nanoseconds. Weight::from_parts(2_720_317_328, 27204) // Standard Error: 7_023_471 - .saturating_add(Weight::from_ref_time(11_520_095).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(11_520_095, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -436,9 +436,9 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 785_237 nanoseconds. Weight::from_parts(742_635_808, 20312) // Standard Error: 2_978_213 - .saturating_add(Weight::from_ref_time(575_691).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(575_691, 0).saturating_mul(n.into())) // Standard Error: 6_211_703 - .saturating_add(Weight::from_ref_time(8_698_185).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(8_698_185, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -475,9 +475,9 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 1_355_329 nanoseconds. Weight::from_parts(514_974_111, 30914) // Standard Error: 18_069_222 - .saturating_add(Weight::from_ref_time(10_849_797).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(10_849_797, 0).saturating_mul(n.into())) // Standard Error: 40_518_861 - .saturating_add(Weight::from_ref_time(26_620_090).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(26_620_090, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } @@ -515,11 +515,11 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 1_246_972 nanoseconds. Weight::from_parts(1_246_972_000, 29256) // Standard Error: 12_836_560 - .saturating_add(Weight::from_ref_time(619_028).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(619_028, 0).saturating_mul(n.into())) // Standard Error: 28_546_338 - .saturating_add(Weight::from_ref_time(12_530_416).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(12_530_416, 0).saturating_mul(m.into())) // Standard Error: 111_851_300 - .saturating_add(Weight::from_ref_time(39_367_025).saturating_mul(u.into())) + .saturating_add(Weight::from_parts(39_367_025, 0).saturating_mul(u.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } @@ -552,7 +552,8 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 1_190_530 nanoseconds. Weight::from_parts(2_341_368_549, 22875) // Standard Error: 1_366_168 - .saturating_add(Weight::from_ref_time(4_411_787).saturating_mul(m.into())) + + .saturating_add(Weight::from_parts(4_411_787, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -585,9 +586,9 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 1_286_854 nanoseconds. Weight::from_parts(1_086_482_788, 22875) // Standard Error: 1_864_716 - .saturating_add(Weight::from_ref_time(18_697_878).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(18_697_878, 0).saturating_mul(n.into())) // Standard Error: 4_181_485 - .saturating_add(Weight::from_ref_time(5_343_333).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(5_343_333, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -614,7 +615,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `0` // Estimated: `0` // Minimum execution time: 783_590 nanoseconds. - Weight::from_ref_time(783_590_000) + Weight::from_parts(783_590_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking DelegatorState (r:1 w:0) @@ -697,17 +698,17 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 12_159_751 nanoseconds. Weight::from_parts(12_159_751_000, 383849) // Standard Error: 1_632_189_050 - .saturating_add(Weight::from_ref_time(1_883_578_629).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_883_578_629, 0).saturating_mul(n.into())) // Standard Error: 3_497_547_965 - .saturating_add(Weight::from_ref_time(4_279_523_148).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(4_279_523_148, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(153_u64)) .saturating_add(T::DbWeight::get().reads((30_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().reads((60_u64).saturating_mul(m.into()))) .saturating_add(T::DbWeight::get().writes(146_u64)) .saturating_add(T::DbWeight::get().writes((28_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((60_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_proof_size(77565).saturating_mul(n.into())) - .saturating_add(Weight::from_proof_size(151620).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(77565, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(151620, 0).saturating_mul(m.into())) } } @@ -760,7 +761,7 @@ impl WeightInfo for () { // Measured: `0` // Estimated: `0` // Minimum execution time: 66_227 nanoseconds. - Weight::from_ref_time(66_227_000) + Weight::from_parts(66_227_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking CandidatePool (r:76 w:0) @@ -786,17 +787,17 @@ impl WeightInfo for () { // Minimum execution time: 9_013_393 nanoseconds. Weight::from_parts(9_013_393_000, 383346) // Standard Error: 4_266_402_895 - .saturating_add(Weight::from_ref_time(5_268_800_032).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(5_268_800_032, 0).saturating_mul(n.into())) // Standard Error: 9_142_291_918 - .saturating_add(Weight::from_ref_time(10_550_156_582).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(10_550_156_582, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(152_u64)) .saturating_add(RocksDbWeight::get().reads((30_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().reads((60_u64).saturating_mul(m.into()))) .saturating_add(RocksDbWeight::get().writes(145_u64)) .saturating_add(RocksDbWeight::get().writes((28_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes((60_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_proof_size(77565).saturating_mul(n.into())) - .saturating_add(Weight::from_proof_size(151620).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 77565).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 151620).saturating_mul(m.into())) } /// Storage: ParachainStaking MaxSelectedCandidates (r:1 w:1) /// Proof: ParachainStaking MaxSelectedCandidates (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -815,11 +816,11 @@ impl WeightInfo for () { // Minimum execution time: 1_161_641 nanoseconds. Weight::from_parts(1_161_641_000, 5168) // Standard Error: 20_294_226 - .saturating_add(Weight::from_ref_time(81_538_225).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(81_538_225, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_proof_size(3355).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3355).saturating_mul(n.into())) } /// Storage: ParachainStaking Round (r:1 w:1) /// Proof: ParachainStaking Round (max_values: Some(1), max_size: Some(20), added: 515, mode: MaxEncodedLen) @@ -869,15 +870,15 @@ impl WeightInfo for () { // Minimum execution time: 3_973_174 nanoseconds. Weight::from_parts(3_973_174_000, 116721) // Standard Error: 300_977_057 - .saturating_add(Weight::from_ref_time(221_044_787).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(221_044_787, 0).saturating_mul(n.into())) // Standard Error: 650_450_082 - .saturating_add(Weight::from_ref_time(754_831_595).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(754_831_595, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(29_u64)) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(m.into()))) .saturating_add(RocksDbWeight::get().writes(10_u64)) .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_proof_size(372).saturating_mul(n.into())) - .saturating_add(Weight::from_proof_size(16221).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(372, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(16221, 0).saturating_mul(m.into())) } /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof: ParachainStaking CandidatePool (max_values: None, max_size: Some(1790), added: 4265, mode: MaxEncodedLen) @@ -908,9 +909,9 @@ impl WeightInfo for () { // Minimum execution time: 2_325_690 nanoseconds. Weight::from_parts(2_470_811_246, 22098) // Standard Error: 7_815_891 - .saturating_add(Weight::from_ref_time(599_753).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(599_753, 0).saturating_mul(n.into())) // Standard Error: 16_301_715 - .saturating_add(Weight::from_ref_time(3_997_428).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(3_997_428, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -933,7 +934,7 @@ impl WeightInfo for () { // Minimum execution time: 3_383_593 nanoseconds. Weight::from_parts(5_399_481_017, 78143) // Standard Error: 2_824_731 - .saturating_add(Weight::from_ref_time(10_745_175).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(10_745_175, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(21_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -954,9 +955,9 @@ impl WeightInfo for () { // Minimum execution time: 1_403_818 nanoseconds. Weight::from_parts(1_248_266_754, 13653) // Standard Error: 93_940 - .saturating_add(Weight::from_ref_time(2_102_043).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(2_102_043, 0).saturating_mul(n.into())) // Standard Error: 152_989 - .saturating_add(Weight::from_ref_time(8_893_185).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(8_893_185, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -995,13 +996,13 @@ impl WeightInfo for () { // Minimum execution time: 3_998_377 nanoseconds. Weight::from_parts(7_690_223_368, 25299) // Standard Error: 45_526_584 - .saturating_add(Weight::from_ref_time(526_019_957).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(526_019_957, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(m.into()))) .saturating_add(RocksDbWeight::get().writes(8_u64)) .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_proof_size(312).saturating_mul(n.into())) - .saturating_add(Weight::from_proof_size(14112).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(312, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(14112, 0).saturating_mul(m.into())) } /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof: ParachainStaking CandidatePool (max_values: None, max_size: Some(1790), added: 4265, mode: MaxEncodedLen) @@ -1037,7 +1038,7 @@ impl WeightInfo for () { // Minimum execution time: 944_397 nanoseconds. Weight::from_parts(2_720_317_328, 27204) // Standard Error: 7_023_471 - .saturating_add(Weight::from_ref_time(11_520_095).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(11_520_095, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -1068,9 +1069,9 @@ impl WeightInfo for () { // Minimum execution time: 785_237 nanoseconds. Weight::from_parts(742_635_808, 20312) // Standard Error: 2_978_213 - .saturating_add(Weight::from_ref_time(575_691).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(575_691, 0).saturating_mul(n.into())) // Standard Error: 6_211_703 - .saturating_add(Weight::from_ref_time(8_698_185).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(8_698_185, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -1107,9 +1108,9 @@ impl WeightInfo for () { // Minimum execution time: 1_355_329 nanoseconds. Weight::from_parts(514_974_111, 30914) // Standard Error: 18_069_222 - .saturating_add(Weight::from_ref_time(10_849_797).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(10_849_797, 0).saturating_mul(n.into())) // Standard Error: 40_518_861 - .saturating_add(Weight::from_ref_time(26_620_090).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(26_620_090, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } @@ -1147,11 +1148,11 @@ impl WeightInfo for () { // Minimum execution time: 1_246_972 nanoseconds. Weight::from_parts(1_246_972_000, 29256) // Standard Error: 12_836_560 - .saturating_add(Weight::from_ref_time(619_028).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(619_028, 0).saturating_mul(n.into())) // Standard Error: 28_546_338 - .saturating_add(Weight::from_ref_time(12_530_416).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(12_530_416, 0).saturating_mul(m.into())) // Standard Error: 111_851_300 - .saturating_add(Weight::from_ref_time(39_367_025).saturating_mul(u.into())) + .saturating_add(Weight::from_parts(39_367_025, 0).saturating_mul(u.into())) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } @@ -1184,7 +1185,7 @@ impl WeightInfo for () { // Minimum execution time: 1_190_530 nanoseconds. Weight::from_parts(2_341_368_549, 22875) // Standard Error: 1_366_168 - .saturating_add(Weight::from_ref_time(4_411_787).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(4_411_787, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1217,9 +1218,9 @@ impl WeightInfo for () { // Minimum execution time: 1_286_854 nanoseconds. Weight::from_parts(1_086_482_788, 22875) // Standard Error: 1_864_716 - .saturating_add(Weight::from_ref_time(18_697_878).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(18_697_878, 0).saturating_mul(n.into())) // Standard Error: 4_181_485 - .saturating_add(Weight::from_ref_time(5_343_333).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(5_343_333, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1246,7 +1247,7 @@ impl WeightInfo for () { // Measured: `0` // Estimated: `0` // Minimum execution time: 783_590 nanoseconds. - Weight::from_ref_time(783_590_000) + Weight::from_parts(783_590_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking DelegatorState (r:1 w:0) @@ -1329,16 +1330,16 @@ impl WeightInfo for () { // Minimum execution time: 12_159_751 nanoseconds. Weight::from_parts(12_159_751_000, 383849) // Standard Error: 1_632_189_050 - .saturating_add(Weight::from_ref_time(1_883_578_629).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_883_578_629, 0).saturating_mul(n.into())) // Standard Error: 3_497_547_965 - .saturating_add(Weight::from_ref_time(4_279_523_148).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(4_279_523_148, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(153_u64)) .saturating_add(RocksDbWeight::get().reads((30_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().reads((60_u64).saturating_mul(m.into()))) .saturating_add(RocksDbWeight::get().writes(146_u64)) .saturating_add(RocksDbWeight::get().writes((28_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes((60_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_proof_size(77565).saturating_mul(n.into())) - .saturating_add(Weight::from_proof_size(151620).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(77565, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(151620, 0).saturating_mul(m.into())) } } diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 2d8d4c71a1..b84836dcfe 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -177,7 +177,6 @@ pub mod pallet { /// Pallet for parachain staking. #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(PhantomData); diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index 73f10438b7..d484220435 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -154,7 +154,6 @@ pub mod pallet { } #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); diff --git a/runtimes/common/src/fees.rs b/runtimes/common/src/fees.rs index 24517cc14b..c22146249c 100644 --- a/runtimes/common/src/fees.rs +++ b/runtimes/common/src/fees.rs @@ -106,7 +106,7 @@ where // TODO: transfer_keep_alive is 288 byte long? let tx_len: u64 = 288; let byte_fee: Balance = - ::LengthToFee::weight_to_fee(&Weight::from_ref_time(tx_len)) + ::LengthToFee::weight_to_fee(&Weight::from_parts(tx_len, 0)) .into(); let base_weight: Weight = ::BlockWeights::get() .get(DispatchClass::Normal) diff --git a/runtimes/peregrine/src/weights/pallet_multisig.rs b/runtimes/peregrine/src/weights/pallet_multisig.rs index 710c8dcd02..dcb14d3585 100644 --- a/runtimes/peregrine/src/weights/pallet_multisig.rs +++ b/runtimes/peregrine/src/weights/pallet_multisig.rs @@ -49,29 +49,29 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_multisig::WeightInfo for WeightInfo { fn as_multi_threshold_1(z: u32, ) -> Weight { - Weight::from_ref_time(8_364_882 as u64) + Weight::from_parts(8_364_882 as u64, 0) // Standard Error: 79 - .saturating_add(Weight::from_ref_time(849 as u64).saturating_mul(z as u64)) + .saturating_add(Weight::from_parts(849 as u64, 0).saturating_mul(z as u64)) } // Storage: Multisig Multisigs (r:1 w:1) // Proof: Multisig Multisigs (max_values: None, max_size: Some(2198), added: 4673, mode: MaxEncodedLen) fn as_multi_create(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(20_285_811 as u64) + Weight::from_parts(20_285_811 as u64, 0) // Standard Error: 5_408 - .saturating_add(Weight::from_ref_time(80_065 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(80_065 as u64, 0).saturating_mul(s as u64)) // Standard Error: 33 - .saturating_add(Weight::from_ref_time(986 as u64).saturating_mul(z as u64)) + .saturating_add(Weight::from_parts(986 as u64, 0).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) // Proof: Multisig Multisigs (max_values: None, max_size: Some(2198), added: 4673, mode: MaxEncodedLen) fn as_multi_approve(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(12_705_025 as u64) + Weight::from_parts(12_705_025 as u64, 0) // Standard Error: 30_300 - .saturating_add(Weight::from_ref_time(20_431 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(20_431 as u64, 0).saturating_mul(s as u64)) // Standard Error: 186 - .saturating_add(Weight::from_ref_time(3_373 as u64).saturating_mul(z as u64)) + .saturating_add(Weight::from_parts(3_373 as u64, 0).saturating_mul(z as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -80,38 +80,38 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn as_multi_complete(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(20_642_060 as u64) + Weight::from_parts(20_642_060 as u64, 0) // Standard Error: 5_511 - .saturating_add(Weight::from_ref_time(104_693 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(104_693 as u64, 0).saturating_mul(s as u64)) // Standard Error: 34 - .saturating_add(Weight::from_ref_time(1_132 as u64).saturating_mul(z as u64)) + .saturating_add(Weight::from_parts(1_132 as u64, 0).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) // Proof: Multisig Multisigs (max_values: None, max_size: Some(2198), added: 4673, mode: MaxEncodedLen) fn approve_as_multi_create(s: u32, ) -> Weight { - Weight::from_ref_time(17_036_891 as u64) + Weight::from_parts(17_036_891 as u64, 0) // Standard Error: 4_200 - .saturating_add(Weight::from_ref_time(122_554 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(122_554 as u64, 0).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) // Proof: Multisig Multisigs (max_values: None, max_size: Some(2198), added: 4673, mode: MaxEncodedLen) fn approve_as_multi_approve(s: u32, ) -> Weight { - Weight::from_ref_time(12_421_505 as u64) + Weight::from_parts(12_421_505 as u64, 0) // Standard Error: 7_770 - .saturating_add(Weight::from_ref_time(81_668 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(81_668 as u64, 0).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) // Proof: Multisig Multisigs (max_values: None, max_size: Some(2198), added: 4673, mode: MaxEncodedLen) fn cancel_as_multi(s: u32, ) -> Weight { - Weight::from_ref_time(19_681_233 as u64) + Weight::from_parts(19_681_233 as u64, 0) // Standard Error: 4_292 - .saturating_add(Weight::from_ref_time(70_945 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(70_945 as u64, 0).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/runtimes/spiritnet/src/weights/attestation.rs b/runtimes/spiritnet/src/weights/attestation.rs index 28b92aa89e..70a796c14e 100644 --- a/runtimes/spiritnet/src/weights/attestation.rs +++ b/runtimes/spiritnet/src/weights/attestation.rs @@ -55,14 +55,14 @@ impl attestation::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn add() -> Weight { - Weight::from_ref_time(32_883_000 as u64) + Weight::from_parts(32_883_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Attestation Attestations (r:1 w:1) // Proof: Attestation Attestations (max_values: None, max_size: Some(195), added: 2670, mode: MaxEncodedLen) fn revoke() -> Weight { - Weight::from_ref_time(18_271_000 as u64) + Weight::from_parts(18_271_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -71,7 +71,7 @@ impl attestation::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn remove() -> Weight { - Weight::from_ref_time(31_556_000 as u64) + Weight::from_parts(31_556_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -80,7 +80,7 @@ impl attestation::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn reclaim_deposit() -> Weight { - Weight::from_ref_time(47_092_000 as u64) + Weight::from_parts(47_092_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -89,7 +89,7 @@ impl attestation::WeightInfo for WeightInfo { // Storage: System Account (r:2 w:2) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn change_deposit_owner() -> Weight { - Weight::from_ref_time(44_125_000 as u64) + Weight::from_parts(44_125_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -98,7 +98,7 @@ impl attestation::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn update_deposit() -> Weight { - Weight::from_ref_time(39_086_000 as u64) + Weight::from_parts(39_086_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/runtimes/spiritnet/src/weights/ctype.rs b/runtimes/spiritnet/src/weights/ctype.rs index 781171fcfc..ff9ab7765a 100644 --- a/runtimes/spiritnet/src/weights/ctype.rs +++ b/runtimes/spiritnet/src/weights/ctype.rs @@ -53,16 +53,16 @@ impl ctype::WeightInfo for WeightInfo { // Storage: Ctype Ctypes (r:1 w:1) // Proof: Ctype Ctypes (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) fn add(l: u32, ) -> Weight { - Weight::from_ref_time(4_058_770 as u64) + Weight::from_parts(4_058_770 as u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_059 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(2_059 as u64, 0).saturating_mul(l as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Ctype Ctypes (r:1 w:1) // Proof: Ctype Ctypes (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) fn set_block_number() -> Weight { - Weight::from_ref_time(18_686_000 as u64) + Weight::from_parts(18_686_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } diff --git a/runtimes/spiritnet/src/weights/delegation.rs b/runtimes/spiritnet/src/weights/delegation.rs index 67e4e77ccb..d5bbfb4d18 100644 --- a/runtimes/spiritnet/src/weights/delegation.rs +++ b/runtimes/spiritnet/src/weights/delegation.rs @@ -57,7 +57,7 @@ impl delegation::WeightInfo for WeightInfo { // Storage: Delegation DelegationNodes (r:0 w:1) // Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) fn create_hierarchy() -> Weight { - Weight::from_ref_time(53_947_000 as u64) + Weight::from_parts(53_947_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -66,7 +66,7 @@ impl delegation::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn add_delegation() -> Weight { - Weight::from_ref_time(38_012_000 as u64) + Weight::from_parts(38_012_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -75,9 +75,9 @@ impl delegation::WeightInfo for WeightInfo { // Storage: Delegation DelegationHierarchies (r:1 w:0) // Proof: Delegation DelegationHierarchies (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) fn revoke_delegation_root_child(r: u32, _c: u32, ) -> Weight { - Weight::from_ref_time(17_953_942 as u64) + Weight::from_parts(17_953_942 as u64, 0) // Standard Error: 19_848 - .saturating_add(Weight::from_ref_time(11_249_984 as u64).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(11_249_984 as u64, 0).saturating_mul(r as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(r as u64))) @@ -87,9 +87,9 @@ impl delegation::WeightInfo for WeightInfo { // Storage: Delegation DelegationHierarchies (r:1 w:0) // Proof: Delegation DelegationHierarchies (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) fn revoke_delegation_leaf(_r: u32, c: u32, ) -> Weight { - Weight::from_ref_time(26_014_217 as u64) + Weight::from_parts(26_014_217 as u64, 0) // Standard Error: 15_771 - .saturating_add(Weight::from_ref_time(4_457_617 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(4_457_617 as u64, 0).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) .saturating_add(T::DbWeight::get().writes(1 as u64)) @@ -101,9 +101,9 @@ impl delegation::WeightInfo for WeightInfo { // Storage: Delegation DelegationHierarchies (r:1 w:1) // Proof: Delegation DelegationHierarchies (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) fn remove_delegation(r: u32, ) -> Weight { - Weight::from_ref_time(45_044_770 as u64) + Weight::from_parts(45_044_770 as u64, 0) // Standard Error: 47_701 - .saturating_add(Weight::from_ref_time(19_680_850 as u64).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(19_680_850 as u64, 0).saturating_mul(r as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) .saturating_add(T::DbWeight::get().writes(3 as u64)) @@ -116,9 +116,9 @@ impl delegation::WeightInfo for WeightInfo { // Storage: Delegation DelegationHierarchies (r:0 w:1) // Proof: Delegation DelegationHierarchies (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) fn reclaim_deposit(r: u32, ) -> Weight { - Weight::from_ref_time(37_027_802 as u64) + Weight::from_parts(37_027_802 as u64, 0) // Standard Error: 34_662 - .saturating_add(Weight::from_ref_time(19_854_845 as u64).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(19_854_845 as u64, 0).saturating_mul(r as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) .saturating_add(T::DbWeight::get().writes(3 as u64)) @@ -129,24 +129,24 @@ impl delegation::WeightInfo for WeightInfo { // Storage: Delegation DelegationHierarchies (r:1 w:0) // Proof: Delegation DelegationHierarchies (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) fn can_attest() -> Weight { - Weight::from_ref_time(12_823_000 as u64) + Weight::from_parts(12_823_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) } // Storage: Delegation DelegationNodes (r:6 w:0) // Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) fn can_revoke(c: u32, ) -> Weight { - Weight::from_ref_time(8_523_936 as u64) + Weight::from_parts(8_523_936 as u64 ,0) // Standard Error: 16_661 - .saturating_add(Weight::from_ref_time(3_529_860 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(3_529_860 as u64, 0).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) } // Storage: Delegation DelegationNodes (r:6 w:0) // Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) fn can_remove(c: u32, ) -> Weight { - Weight::from_ref_time(8_518_974 as u64) + Weight::from_parts(8_518_974 as u64, 0) // Standard Error: 16_049 - .saturating_add(Weight::from_ref_time(3_544_659 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(3_544_659 as u64, 0).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) } @@ -155,7 +155,7 @@ impl delegation::WeightInfo for WeightInfo { // Storage: System Account (r:2 w:2) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn change_deposit_owner() -> Weight { - Weight::from_ref_time(45_144_000 as u64) + Weight::from_parts(45_144_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -164,7 +164,7 @@ impl delegation::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn update_deposit() -> Weight { - Weight::from_ref_time(41_756_000 as u64) + Weight::from_parts(41_756_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/runtimes/spiritnet/src/weights/did.rs b/runtimes/spiritnet/src/weights/did.rs index 0a1641cd2a..7261eabd19 100644 --- a/runtimes/spiritnet/src/weights/did.rs +++ b/runtimes/spiritnet/src/weights/did.rs @@ -59,11 +59,11 @@ impl did::WeightInfo for WeightInfo { // Storage: Did ServiceEndpoints (r:0 w:25) // Proof: Did ServiceEndpoints (max_values: None, max_size: Some(413), added: 2888, mode: MaxEncodedLen) fn create_ed25519_keys(n: u32, c: u32, ) -> Weight { - Weight::from_ref_time(122_341_881 as u64) + Weight::from_parts(122_341_881 as u64, 0) // Standard Error: 12_163 - .saturating_add(Weight::from_ref_time(1_141_879 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(1_141_879 as u64, 0).saturating_mul(n as u64)) // Standard Error: 4_702 - .saturating_add(Weight::from_ref_time(4_600_187 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(4_600_187 as u64, 0).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) @@ -79,11 +79,11 @@ impl did::WeightInfo for WeightInfo { // Storage: Did ServiceEndpoints (r:0 w:25) // Proof: Did ServiceEndpoints (max_values: None, max_size: Some(413), added: 2888, mode: MaxEncodedLen) fn create_sr25519_keys(n: u32, c: u32, ) -> Weight { - Weight::from_ref_time(123_784_601 as u64) + Weight::from_parts(123_784_601 as u64, 0) // Standard Error: 10_456 - .saturating_add(Weight::from_ref_time(1_166_310 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(1_166_310 as u64, 0).saturating_mul(n as u64)) // Standard Error: 4_042 - .saturating_add(Weight::from_ref_time(5_098_244 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(5_098_244 as u64, 0).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) @@ -99,11 +99,11 @@ impl did::WeightInfo for WeightInfo { // Storage: Did ServiceEndpoints (r:0 w:25) // Proof: Did ServiceEndpoints (max_values: None, max_size: Some(413), added: 2888, mode: MaxEncodedLen) fn create_ecdsa_keys(n: u32, c: u32, ) -> Weight { - Weight::from_ref_time(110_543_016 as u64) + Weight::from_parts(110_543_016 as u64, 0) // Standard Error: 16_633 - .saturating_add(Weight::from_ref_time(1_104_243 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(1_104_243 as u64, 0).saturating_mul(n as u64)) // Standard Error: 6_431 - .saturating_add(Weight::from_ref_time(4_305_897 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(4_305_897 as u64, 0).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) @@ -117,9 +117,9 @@ impl did::WeightInfo for WeightInfo { // Storage: Did ServiceEndpoints (r:0 w:25) // Proof: Did ServiceEndpoints (max_values: None, max_size: Some(413), added: 2888, mode: MaxEncodedLen) fn delete(c: u32, ) -> Weight { - Weight::from_ref_time(29_146_140 as u64) + Weight::from_parts(29_146_140 as u64, 0) // Standard Error: 4_204 - .saturating_add(Weight::from_ref_time(1_246_809 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(1_246_809 as u64, 0).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) @@ -133,9 +133,9 @@ impl did::WeightInfo for WeightInfo { // Storage: Did ServiceEndpoints (r:0 w:25) // Proof: Did ServiceEndpoints (max_values: None, max_size: Some(413), added: 2888, mode: MaxEncodedLen) fn reclaim_deposit(c: u32, ) -> Weight { - Weight::from_ref_time(31_450_983 as u64) + Weight::from_parts(31_450_983 as u64, 0) // Standard Error: 19_237 - .saturating_add(Weight::from_ref_time(1_260_697 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(1_260_697 as u64, 0).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) @@ -143,168 +143,168 @@ impl did::WeightInfo for WeightInfo { // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn submit_did_call_ed25519_key() -> Weight { - Weight::from_ref_time(75_775_000 as u64) + Weight::from_parts(75_775_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn submit_did_call_sr25519_key() -> Weight { - Weight::from_ref_time(76_971_000 as u64) + Weight::from_parts(76_971_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn submit_did_call_ecdsa_key() -> Weight { - Weight::from_ref_time(64_296_000 as u64) + Weight::from_parts(64_296_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn set_ed25519_authentication_key() -> Weight { - Weight::from_ref_time(27_747_000 as u64) + Weight::from_parts(27_747_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn set_sr25519_authentication_key() -> Weight { - Weight::from_ref_time(27_463_000 as u64) + Weight::from_parts(27_463_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn set_ecdsa_authentication_key() -> Weight { - Weight::from_ref_time(27_322_000 as u64) + Weight::from_parts(27_322_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn set_ed25519_delegation_key() -> Weight { - Weight::from_ref_time(27_125_000 as u64) + Weight::from_parts(27_125_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn set_sr25519_delegation_key() -> Weight { - Weight::from_ref_time(27_196_000 as u64) + Weight::from_parts(27_196_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn set_ecdsa_delegation_key() -> Weight { - Weight::from_ref_time(27_047_000 as u64) + Weight::from_parts(27_047_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn remove_ed25519_delegation_key() -> Weight { - Weight::from_ref_time(25_278_000 as u64) + Weight::from_parts(25_278_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn remove_sr25519_delegation_key() -> Weight { - Weight::from_ref_time(25_292_000 as u64) + Weight::from_parts(25_292_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn remove_ecdsa_delegation_key() -> Weight { - Weight::from_ref_time(25_214_000 as u64) + Weight::from_parts(25_214_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn set_ed25519_attestation_key() -> Weight { - Weight::from_ref_time(27_400_000 as u64) + Weight::from_parts(27_400_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn set_sr25519_attestation_key() -> Weight { - Weight::from_ref_time(27_629_000 as u64) + Weight::from_parts(27_629_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn set_ecdsa_attestation_key() -> Weight { - Weight::from_ref_time(27_339_000 as u64) + Weight::from_parts(27_339_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn remove_ed25519_attestation_key() -> Weight { - Weight::from_ref_time(25_627_000 as u64) + Weight::from_parts(25_627_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn remove_sr25519_attestation_key() -> Weight { - Weight::from_ref_time(25_484_000 as u64) + Weight::from_parts(25_484_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn remove_ecdsa_attestation_key() -> Weight { - Weight::from_ref_time(25_440_000 as u64) + Weight::from_parts(25_440_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn add_ed25519_key_agreement_key() -> Weight { - Weight::from_ref_time(26_678_000 as u64) + Weight::from_parts(26_678_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn add_sr25519_key_agreement_key() -> Weight { - Weight::from_ref_time(26_586_000 as u64) + Weight::from_parts(26_586_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn add_ecdsa_key_agreement_key() -> Weight { - Weight::from_ref_time(26_209_000 as u64) + Weight::from_parts(26_209_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn remove_ed25519_key_agreement_key() -> Weight { - Weight::from_ref_time(25_586_000 as u64) + Weight::from_parts(25_586_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn remove_sr25519_key_agreement_key() -> Weight { - Weight::from_ref_time(25_620_000 as u64) + Weight::from_parts(25_620_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Did Did (r:1 w:1) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn remove_ecdsa_key_agreement_key() -> Weight { - Weight::from_ref_time(25_458_000 as u64) + Weight::from_parts(25_458_000 as u64 ,0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -315,7 +315,7 @@ impl did::WeightInfo for WeightInfo { // Storage: Did ServiceEndpoints (r:1 w:1) // Proof: Did ServiceEndpoints (max_values: None, max_size: Some(413), added: 2888, mode: MaxEncodedLen) fn add_service_endpoint() -> Weight { - Weight::from_ref_time(32_420_000 as u64) + Weight::from_parts(32_420_000 as u64 ,0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -324,32 +324,32 @@ impl did::WeightInfo for WeightInfo { // Storage: Did DidEndpointsCount (r:1 w:1) // Proof: Did DidEndpointsCount (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) fn remove_service_endpoint() -> Weight { - Weight::from_ref_time(26_769_000 as u64) + Weight::from_parts(26_769_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Did Did (r:1 w:0) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn signature_verification_sr25519(l: u32, ) -> Weight { - Weight::from_ref_time(33_371_487 as u64) + Weight::from_parts(33_371_487 as u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_ref_time(4_142 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(4_142 as u64, 0).saturating_mul(l as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) } // Storage: Did Did (r:1 w:0) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn signature_verification_ed25519(l: u32, ) -> Weight { - Weight::from_ref_time(41_427_263 as u64) + Weight::from_parts(41_427_263 as u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_465 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(2_465 as u64, 0).saturating_mul(l as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) } // Storage: Did Did (r:1 w:0) // Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) fn signature_verification_ecdsa(l: u32, ) -> Weight { - Weight::from_ref_time(27_585_880 as u64) + Weight::from_parts(27_585_880 as u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_493 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(1_493 as u64, 0).saturating_mul(l as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) } // Storage: Did Did (r:1 w:1) @@ -357,7 +357,7 @@ impl did::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn change_deposit_owner() -> Weight { - Weight::from_ref_time(38_598_000 as u64) + Weight::from_parts(38_598_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -366,7 +366,7 @@ impl did::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn update_deposit() -> Weight { - Weight::from_ref_time(40_121_000 as u64) + Weight::from_parts(40_121_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/runtimes/spiritnet/src/weights/frame_system.rs b/runtimes/spiritnet/src/weights/frame_system.rs index 2b78c28b6f..79affc222f 100644 --- a/runtimes/spiritnet/src/weights/frame_system.rs +++ b/runtimes/spiritnet/src/weights/frame_system.rs @@ -49,46 +49,46 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl frame_system::WeightInfo for WeightInfo { fn remark(b: u32, ) -> Weight { - Weight::from_ref_time(9_320_004 as u64) + Weight::from_parts(9_320_004 as u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_ref_time(541 as u64).saturating_mul(b as u64)) + .saturating_add(Weight::from_parts(541 as u64, 0).saturating_mul(b as u64)) } fn remark_with_event(b: u32, ) -> Weight { - Weight::from_ref_time(8_660_000 as u64) + Weight::from_parts(8_660_000 as u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_ref_time(2_041 as u64).saturating_mul(b as u64)) + .saturating_add(Weight::from_parts(2_041 as u64, 0).saturating_mul(b as u64)) } // Storage: System Digest (r:1 w:1) // Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) // Storage: unknown `0x3a686561707061676573` (r:0 w:1) // Proof Skipped: unknown `0x3a686561707061676573` (r:0 w:1) fn set_heap_pages() -> Weight { - Weight::from_ref_time(4_806_000 as u64) + Weight::from_parts(4_806_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Skipped Metadata (r:0 w:0) // Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) fn set_storage(i: u32, ) -> Weight { - Weight::from_ref_time(3_953_000 as u64) + Weight::from_parts(3_953_000 as u64, 0) // Standard Error: 2_457 - .saturating_add(Weight::from_ref_time(642_798 as u64).saturating_mul(i as u64)) + .saturating_add(Weight::from_parts(642_798 as u64, 0).saturating_mul(i as u64)) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(i as u64))) } // Storage: Skipped Metadata (r:0 w:0) // Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) fn kill_storage(i: u32, ) -> Weight { - Weight::from_ref_time(2_542_000 as u64) + Weight::from_parts(2_542_000 as u64, 0) // Standard Error: 890 - .saturating_add(Weight::from_ref_time(478_434 as u64).saturating_mul(i as u64)) + .saturating_add(Weight::from_parts(478_434 as u64, 0).saturating_mul(i as u64)) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(i as u64))) } // Storage: Skipped Metadata (r:0 w:0) // Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) fn kill_prefix(p: u32, ) -> Weight { - Weight::from_ref_time(7_173_000 as u64) + Weight::from_parts(7_173_000 as u64, 0) // Standard Error: 1_138 - .saturating_add(Weight::from_ref_time(1_035_139 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(1_035_139 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(p as u64))) } } diff --git a/runtimes/spiritnet/src/weights/pallet_balances.rs b/runtimes/spiritnet/src/weights/pallet_balances.rs index 2ef74a0771..6bb8bbfe5d 100644 --- a/runtimes/spiritnet/src/weights/pallet_balances.rs +++ b/runtimes/spiritnet/src/weights/pallet_balances.rs @@ -51,49 +51,49 @@ impl pallet_balances::WeightInfo for WeightInfo { // Storage: System Account (r:2 w:2) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer() -> Weight { - Weight::from_ref_time(72_209_000 as u64) + Weight::from_parts(72_209_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_keep_alive() -> Weight { - Weight::from_ref_time(70_328_000 as u64) + Weight::from_parts(70_328_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn set_balance_creating() -> Weight { - Weight::from_ref_time(49_562_000 as u64) + Weight::from_parts(49_562_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn set_balance_killing() -> Weight { - Weight::from_ref_time(39_743_000 as u64) + Weight::from_parts(39_743_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:3 w:3) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_transfer() -> Weight { - Weight::from_ref_time(76_438_000 as u64) + Weight::from_parts(76_438_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_all() -> Weight { - Weight::from_ref_time(58_160_000 as u64) + Weight::from_parts(58_160_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_unreserve() -> Weight { - Weight::from_ref_time(31_980_000 as u64) + Weight::from_parts(31_980_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } diff --git a/runtimes/spiritnet/src/weights/pallet_collective.rs b/runtimes/spiritnet/src/weights/pallet_collective.rs index 6152644a78..d5362ab262 100644 --- a/runtimes/spiritnet/src/weights/pallet_collective.rs +++ b/runtimes/spiritnet/src/weights/pallet_collective.rs @@ -57,11 +57,11 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Prime (r:0 w:1) // Proof Skipped: TechnicalCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { - Weight::from_ref_time(19_571_000 as u64) + Weight::from_parts(19_571_000 as u64, 0) // Standard Error: 47_809 - .saturating_add(Weight::from_ref_time(5_442_912 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(5_442_912 as u64, 0).saturating_mul(m as u64)) // Standard Error: 47_809 - .saturating_add(Weight::from_ref_time(8_270_610 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(8_270_610 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(p as u64))) .saturating_add(T::DbWeight::get().writes(2 as u64)) @@ -70,11 +70,11 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Members (r:1 w:0) // Proof Skipped: TechnicalCommittee Members (max_values: Some(1), max_size: None, mode: Measured) fn execute(b: u32, m: u32, ) -> Weight { - Weight::from_ref_time(21_455_250 as u64) + Weight::from_parts(21_455_250 as u64, 0) // Standard Error: 260 - .saturating_add(Weight::from_ref_time(839 as u64).saturating_mul(b as u64)) + .saturating_add(Weight::from_parts(839 as u64, 0).saturating_mul(b as u64)) // Standard Error: 2_689 - .saturating_add(Weight::from_ref_time(7_635 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(7_635 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) } // Storage: TechnicalCommittee Members (r:1 w:0) @@ -82,9 +82,9 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: TechnicalCommittee ProposalOf (r:1 w:0) // Proof Skipped: TechnicalCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) fn propose_execute(b: u32, _m: u32, ) -> Weight { - Weight::from_ref_time(25_565_943 as u64) + Weight::from_parts(25_565_943 as u64, 0) // Standard Error: 289 - .saturating_add(Weight::from_ref_time(881 as u64).saturating_mul(b as u64)) + .saturating_add(Weight::from_parts(881 as u64, 0).saturating_mul(b as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) } // Storage: TechnicalCommittee Members (r:1 w:0) @@ -98,13 +98,13 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Voting (r:0 w:1) // Proof Skipped: TechnicalCommittee Voting (max_values: None, max_size: None, mode: Measured) fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { - Weight::from_ref_time(28_785_787 as u64) + Weight::from_parts(28_785_787 as u64, 0) // Standard Error: 50 - .saturating_add(Weight::from_ref_time(2_981 as u64).saturating_mul(b as u64)) + .saturating_add(Weight::from_parts(2_981 as u64, 0).saturating_mul(b as u64)) // Standard Error: 531 - .saturating_add(Weight::from_ref_time(18_747 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(18_747 as u64, 0).saturating_mul(m as u64)) // Standard Error: 525 - .saturating_add(Weight::from_ref_time(110_930 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(110_930 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } @@ -113,9 +113,9 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Voting (r:1 w:1) // Proof Skipped: TechnicalCommittee Voting (max_values: None, max_size: None, mode: Measured) fn vote(m: u32, ) -> Weight { - Weight::from_ref_time(25_582_176 as u64) + Weight::from_parts(25_582_176 as u64, 0) // Standard Error: 250 - .saturating_add(Weight::from_ref_time(45_093 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(45_093 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -128,11 +128,11 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: TechnicalCommittee ProposalOf (r:0 w:1) // Proof Skipped: TechnicalCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) fn close_early_disapproved(m: u32, p: u32, ) -> Weight { - Weight::from_ref_time(31_951_147 as u64) + Weight::from_parts(31_951_147 as u64, 0) // Standard Error: 441 - .saturating_add(Weight::from_ref_time(19_340 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(19_340 as u64, 0).saturating_mul(m as u64)) // Standard Error: 430 - .saturating_add(Weight::from_ref_time(101_144 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(101_144 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -145,11 +145,11 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Proposals (r:1 w:1) // Proof Skipped: TechnicalCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) fn close_early_approved(b: u32, _m: u32, p: u32, ) -> Weight { - Weight::from_ref_time(45_381_860 as u64) + Weight::from_parts(45_381_860 as u64, 0) // Standard Error: 139 - .saturating_add(Weight::from_ref_time(2_394 as u64).saturating_mul(b as u64)) + .saturating_add(Weight::from_parts(2_394 as u64, 0).saturating_mul(b as u64)) // Standard Error: 1_432 - .saturating_add(Weight::from_ref_time(141_110 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(141_110 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -164,11 +164,11 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: TechnicalCommittee ProposalOf (r:0 w:1) // Proof Skipped: TechnicalCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) fn close_disapproved(m: u32, p: u32, ) -> Weight { - Weight::from_ref_time(34_477_728 as u64) + Weight::from_parts(34_477_728 as u64, 0) // Standard Error: 439 - .saturating_add(Weight::from_ref_time(22_565 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(22_565 as u64, 0).saturating_mul(m as u64)) // Standard Error: 428 - .saturating_add(Weight::from_ref_time(101_301 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(101_301 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -183,13 +183,13 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Proposals (r:1 w:1) // Proof Skipped: TechnicalCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { - Weight::from_ref_time(46_992_807 as u64) + Weight::from_parts(46_992_807 as u64, 0) // Standard Error: 91 - .saturating_add(Weight::from_ref_time(2_611 as u64).saturating_mul(b as u64)) + .saturating_add(Weight::from_parts(2_611 as u64, 0).saturating_mul(b as u64)) // Standard Error: 968 - .saturating_add(Weight::from_ref_time(21_508 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(21_508 as u64, 0).saturating_mul(m as u64)) // Standard Error: 944 - .saturating_add(Weight::from_ref_time(136_086 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(136_086 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(5 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -200,9 +200,9 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: TechnicalCommittee ProposalOf (r:0 w:1) // Proof Skipped: TechnicalCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) fn disapprove_proposal(p: u32, ) -> Weight { - Weight::from_ref_time(20_274_995 as u64) + Weight::from_parts(20_274_995 as u64, 0) // Standard Error: 408 - .saturating_add(Weight::from_ref_time(94_161 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(94_161 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } diff --git a/runtimes/spiritnet/src/weights/pallet_did_lookup.rs b/runtimes/spiritnet/src/weights/pallet_did_lookup.rs index 42a8117d25..6055c2e271 100644 --- a/runtimes/spiritnet/src/weights/pallet_did_lookup.rs +++ b/runtimes/spiritnet/src/weights/pallet_did_lookup.rs @@ -55,7 +55,7 @@ impl pallet_did_lookup::WeightInfo for WeightInfo { // Storage: DidLookup ConnectedAccounts (r:0 w:2) // Proof: DidLookup ConnectedAccounts (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) fn associate_account_multisig_sr25519() -> Weight { - Weight::from_ref_time(104_704_000 as u64) + Weight::from_parts(104_704_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } @@ -66,7 +66,7 @@ impl pallet_did_lookup::WeightInfo for WeightInfo { // Storage: DidLookup ConnectedAccounts (r:0 w:2) // Proof: DidLookup ConnectedAccounts (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) fn associate_account_multisig_ed25519() -> Weight { - Weight::from_ref_time(103_900_000 as u64) + Weight::from_parts(103_900_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } @@ -77,7 +77,7 @@ impl pallet_did_lookup::WeightInfo for WeightInfo { // Storage: DidLookup ConnectedAccounts (r:0 w:2) // Proof: DidLookup ConnectedAccounts (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) fn associate_account_multisig_ecdsa() -> Weight { - Weight::from_ref_time(91_681_000 as u64) + Weight::from_parts(91_681_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } @@ -88,7 +88,7 @@ impl pallet_did_lookup::WeightInfo for WeightInfo { // Storage: DidLookup ConnectedAccounts (r:0 w:2) // Proof: DidLookup ConnectedAccounts (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) fn associate_eth_account() -> Weight { - Weight::from_ref_time(93_205_000 as u64) + Weight::from_parts(93_205_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } @@ -99,7 +99,7 @@ impl pallet_did_lookup::WeightInfo for WeightInfo { // Storage: DidLookup ConnectedAccounts (r:0 w:2) // Proof: DidLookup ConnectedAccounts (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) fn associate_sender() -> Weight { - Weight::from_ref_time(44_691_000 as u64) + Weight::from_parts(44_691_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } @@ -110,7 +110,7 @@ impl pallet_did_lookup::WeightInfo for WeightInfo { // Storage: DidLookup ConnectedAccounts (r:0 w:1) // Proof: DidLookup ConnectedAccounts (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) fn remove_sender_association() -> Weight { - Weight::from_ref_time(28_757_000 as u64) + Weight::from_parts(28_757_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -121,7 +121,7 @@ impl pallet_did_lookup::WeightInfo for WeightInfo { // Storage: DidLookup ConnectedAccounts (r:0 w:1) // Proof: DidLookup ConnectedAccounts (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) fn remove_account_association() -> Weight { - Weight::from_ref_time(30_440_000 as u64) + Weight::from_parts(30_440_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -130,7 +130,7 @@ impl pallet_did_lookup::WeightInfo for WeightInfo { // Storage: System Account (r:2 w:2) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn change_deposit_owner() -> Weight { - Weight::from_ref_time(40_342_000 as u64) + Weight::from_parts(40_342_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -139,7 +139,7 @@ impl pallet_did_lookup::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn update_deposit() -> Weight { - Weight::from_ref_time(57_126_000 as u64) + Weight::from_parts(57_126_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -150,9 +150,9 @@ impl pallet_did_lookup::WeightInfo for WeightInfo { // Storage: DidLookup ConnectedAccounts (r:92 w:184) // Proof: DidLookup ConnectedAccounts (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) fn migrate(n: u32, ) -> Weight { - Weight::from_ref_time(64_929_466 as u64) + Weight::from_parts(64_929_466 as u64, 0) // Standard Error: 21_275 - .saturating_add(Weight::from_ref_time(16_042_707 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(16_042_707 as u64, 0).saturating_mul(n as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(n as u64))) .saturating_add(T::DbWeight::get().writes(3 as u64)) diff --git a/runtimes/spiritnet/src/weights/pallet_indices.rs b/runtimes/spiritnet/src/weights/pallet_indices.rs index 6e3e1c5746..27b9679c34 100644 --- a/runtimes/spiritnet/src/weights/pallet_indices.rs +++ b/runtimes/spiritnet/src/weights/pallet_indices.rs @@ -51,7 +51,7 @@ impl pallet_indices::WeightInfo for WeightInfo { // Storage: Indices Accounts (r:1 w:1) // Proof: Indices Accounts (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn claim() -> Weight { - Weight::from_ref_time(23_245_000 as u64) + Weight::from_parts(23_245_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -60,14 +60,14 @@ impl pallet_indices::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer() -> Weight { - Weight::from_ref_time(30_412_000 as u64) + Weight::from_parts(30_412_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Indices Accounts (r:1 w:1) // Proof: Indices Accounts (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn free() -> Weight { - Weight::from_ref_time(25_174_000 as u64) + Weight::from_parts(25_174_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -76,14 +76,14 @@ impl pallet_indices::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_transfer() -> Weight { - Weight::from_ref_time(29_725_000 as u64) + Weight::from_parts(29_725_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Indices Accounts (r:1 w:1) // Proof: Indices Accounts (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn freeze() -> Weight { - Weight::from_ref_time(27_373_000 as u64) + Weight::from_parts(27_373_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } diff --git a/runtimes/spiritnet/src/weights/pallet_inflation.rs b/runtimes/spiritnet/src/weights/pallet_inflation.rs index 43b138c2ac..5842a4512a 100644 --- a/runtimes/spiritnet/src/weights/pallet_inflation.rs +++ b/runtimes/spiritnet/src/weights/pallet_inflation.rs @@ -51,11 +51,11 @@ impl pallet_inflation::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn on_initialize_mint_to_treasury() -> Weight { - Weight::from_ref_time(31_117_000 as u64) + Weight::from_parts(31_117_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } fn on_initialize_no_action() -> Weight { - Weight::from_ref_time(309_000 as u64) + Weight::from_parts(309_000 as u64, 0) } } diff --git a/runtimes/spiritnet/src/weights/pallet_membership.rs b/runtimes/spiritnet/src/weights/pallet_membership.rs index ab1a012008..8ed470bd20 100644 --- a/runtimes/spiritnet/src/weights/pallet_membership.rs +++ b/runtimes/spiritnet/src/weights/pallet_membership.rs @@ -57,9 +57,9 @@ impl pallet_membership::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Prime (r:0 w:1) // Proof Skipped: TechnicalCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn add_member(m: u32, ) -> Weight { - Weight::from_ref_time(24_167_195 as u64) + Weight::from_parts(24_167_195 as u64, 0) // Standard Error: 7_543 - .saturating_add(Weight::from_ref_time(37_703 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(37_703 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -74,9 +74,9 @@ impl pallet_membership::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Prime (r:0 w:1) // Proof Skipped: TechnicalCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn remove_member(m: u32, ) -> Weight { - Weight::from_ref_time(24_816_490 as u64) + Weight::from_parts(24_816_490 as u64, 0) // Standard Error: 7_634 - .saturating_add(Weight::from_ref_time(55_649 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(55_649 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -91,9 +91,9 @@ impl pallet_membership::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Prime (r:0 w:1) // Proof Skipped: TechnicalCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn swap_member(m: u32, ) -> Weight { - Weight::from_ref_time(26_022_922 as u64) + Weight::from_parts(26_022_922 as u64, 0) // Standard Error: 8_446 - .saturating_add(Weight::from_ref_time(67_445 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(67_445 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -108,9 +108,9 @@ impl pallet_membership::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Prime (r:0 w:1) // Proof Skipped: TechnicalCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn reset_member(m: u32, ) -> Weight { - Weight::from_ref_time(27_154_127 as u64) + Weight::from_parts(27_154_127 as u64, 0) // Standard Error: 9_682 - .saturating_add(Weight::from_ref_time(167_406 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(167_406 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -125,9 +125,9 @@ impl pallet_membership::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Prime (r:0 w:1) // Proof Skipped: TechnicalCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn change_key(m: u32, ) -> Weight { - Weight::from_ref_time(25_355_298 as u64) + Weight::from_parts(25_355_298 as u64, 0) // Standard Error: 8_498 - .saturating_add(Weight::from_ref_time(85_642 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(85_642 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } @@ -138,9 +138,9 @@ impl pallet_membership::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Prime (r:0 w:1) // Proof Skipped: TechnicalCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn set_prime(m: u32, ) -> Weight { - Weight::from_ref_time(10_196_403 as u64) + Weight::from_parts(10_196_403 as u64, 0) // Standard Error: 2_878 - .saturating_add(Weight::from_ref_time(19_764 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(19_764 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -149,9 +149,9 @@ impl pallet_membership::WeightInfo for WeightInfo { // Storage: TechnicalCommittee Prime (r:0 w:1) // Proof Skipped: TechnicalCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn clear_prime(m: u32, ) -> Weight { - Weight::from_ref_time(4_737_401 as u64) + Weight::from_parts(4_737_401 as u64, 0) // Standard Error: 1_575 - .saturating_add(Weight::from_ref_time(4_713 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(4_713 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } } diff --git a/runtimes/spiritnet/src/weights/pallet_multisig.rs b/runtimes/spiritnet/src/weights/pallet_multisig.rs index 10abb79304..acf8806e29 100644 --- a/runtimes/spiritnet/src/weights/pallet_multisig.rs +++ b/runtimes/spiritnet/src/weights/pallet_multisig.rs @@ -49,29 +49,29 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_multisig::WeightInfo for WeightInfo { fn as_multi_threshold_1(z: u32, ) -> Weight { - Weight::from_ref_time(8_364_882 as u64) + Weight::from_parts(8_364_882 as u64, 0) // Standard Error: 79 - .saturating_add(Weight::from_ref_time(849 as u64).saturating_mul(z as u64)) + .saturating_add(Weight::from_parts(849 as u64, 0).saturating_mul(z as u64)) } // Storage: Multisig Multisigs (r:1 w:1) // Proof: Multisig Multisigs (max_values: None, max_size: Some(2198), added: 4673, mode: MaxEncodedLen) fn as_multi_create(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(20_285_811 as u64) + Weight::from_parts(20_285_811 as u64, 0) // Standard Error: 5_408 - .saturating_add(Weight::from_ref_time(80_065 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(80_065 as u64, 0).saturating_mul(s as u64)) // Standard Error: 33 - .saturating_add(Weight::from_ref_time(986 as u64).saturating_mul(z as u64)) + .saturating_add(Weight::from_parts(986 as u64, 0).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) // Proof: Multisig Multisigs (max_values: None, max_size: Some(2198), added: 4673, mode: MaxEncodedLen) fn as_multi_approve(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(12_705_025 as u64) + Weight::from_parts(12_705_025 as u64, 0) // Standard Error: 30_300 - .saturating_add(Weight::from_ref_time(20_431 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(20_431 as u64, 0).saturating_mul(s as u64)) // Standard Error: 186 - .saturating_add(Weight::from_ref_time(3_373 as u64).saturating_mul(z as u64)) + .saturating_add(Weight::from_parts(3_373 as u64, 0).saturating_mul(z as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -80,38 +80,38 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn as_multi_complete(s: u32, z: u32, ) -> Weight { - Weight::from_ref_time(20_642_060 as u64) + Weight::from_parts(20_642_060 as u64, 0) // Standard Error: 5_511 - .saturating_add(Weight::from_ref_time(104_693 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(104_693 as u64, 0).saturating_mul(s as u64)) // Standard Error: 34 - .saturating_add(Weight::from_ref_time(1_132 as u64).saturating_mul(z as u64)) + .saturating_add(Weight::from_parts(1_132 as u64, 0).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) // Proof: Multisig Multisigs (max_values: None, max_size: Some(2198), added: 4673, mode: MaxEncodedLen) fn approve_as_multi_create(s: u32, ) -> Weight { - Weight::from_ref_time(17_036_891 as u64) + Weight::from_parts(17_036_891 as u64, 0) // Standard Error: 4_200 - .saturating_add(Weight::from_ref_time(122_554 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(122_554 as u64, 0).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) // Proof: Multisig Multisigs (max_values: None, max_size: Some(2198), added: 4673, mode: MaxEncodedLen) fn approve_as_multi_approve(s: u32, ) -> Weight { - Weight::from_ref_time(12_421_505 as u64) + Weight::from_parts(12_421_505 as u64, 0) // Standard Error: 7_770 - .saturating_add(Weight::from_ref_time(81_668 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(81_668 as u64, 0).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) // Proof: Multisig Multisigs (max_values: None, max_size: Some(2198), added: 4673, mode: MaxEncodedLen) fn cancel_as_multi(s: u32, ) -> Weight { - Weight::from_ref_time(19_681_233 as u64) + Weight::from_parts(19_681_233 as u64, 0) // Standard Error: 4_292 - .saturating_add(Weight::from_ref_time(70_945 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(70_945 as u64, 0).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/runtimes/spiritnet/src/weights/pallet_preimage.rs b/runtimes/spiritnet/src/weights/pallet_preimage.rs index 75a53f688e..44a6850cb2 100644 --- a/runtimes/spiritnet/src/weights/pallet_preimage.rs +++ b/runtimes/spiritnet/src/weights/pallet_preimage.rs @@ -53,9 +53,9 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Storage: Preimage PreimageFor (r:0 w:1) // Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn note_preimage(s: u32, ) -> Weight { - Weight::from_ref_time(45_064_000 as u64) + Weight::from_parts(45_064_000 as u64, 0) // Standard Error: 1 - .saturating_add(Weight::from_ref_time(2_741 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(2_741 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -64,9 +64,9 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Storage: Preimage PreimageFor (r:0 w:1) // Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn note_requested_preimage(s: u32, ) -> Weight { - Weight::from_ref_time(27_532_000 as u64) + Weight::from_parts(27_532_000 as u64, 0) // Standard Error: 1 - .saturating_add(Weight::from_ref_time(2_744 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(2_744 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -75,9 +75,9 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Storage: Preimage PreimageFor (r:0 w:1) // Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn note_no_deposit_preimage(s: u32, ) -> Weight { - Weight::from_ref_time(26_595_000 as u64) + Weight::from_parts(26_595_000 as u64, 0) // Standard Error: 1 - .saturating_add(Weight::from_ref_time(2_743 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(2_743 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -86,7 +86,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Storage: Preimage PreimageFor (r:0 w:1) // Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn unnote_preimage() -> Weight { - Weight::from_ref_time(39_718_000 as u64) + Weight::from_parts(39_718_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -95,35 +95,35 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Storage: Preimage PreimageFor (r:0 w:1) // Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn unnote_no_deposit_preimage() -> Weight { - Weight::from_ref_time(25_937_000 as u64) + Weight::from_parts(25_937_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) // Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn request_preimage() -> Weight { - Weight::from_ref_time(23_314_000 as u64) + Weight::from_parts(23_314_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) // Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn request_no_deposit_preimage() -> Weight { - Weight::from_ref_time(14_546_000 as u64) + Weight::from_parts(14_546_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) // Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn request_unnoted_preimage() -> Weight { - Weight::from_ref_time(16_369_000 as u64) + Weight::from_parts(16_369_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) // Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn request_requested_preimage() -> Weight { - Weight::from_ref_time(10_153_000 as u64) + Weight::from_parts(10_153_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -132,21 +132,21 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Storage: Preimage PreimageFor (r:0 w:1) // Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn unrequest_preimage() -> Weight { - Weight::from_ref_time(24_453_000 as u64) + Weight::from_parts(24_453_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) // Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn unrequest_unnoted_preimage() -> Weight { - Weight::from_ref_time(10_128_000 as u64) + Weight::from_parts(10_128_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) // Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn unrequest_multi_referenced_preimage() -> Weight { - Weight::from_ref_time(10_132_000 as u64) + Weight::from_parts(10_132_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } diff --git a/runtimes/spiritnet/src/weights/pallet_proxy.rs b/runtimes/spiritnet/src/weights/pallet_proxy.rs index de233fb71e..db29243be8 100644 --- a/runtimes/spiritnet/src/weights/pallet_proxy.rs +++ b/runtimes/spiritnet/src/weights/pallet_proxy.rs @@ -51,7 +51,7 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Storage: Proxy Proxies (r:1 w:0) // Proof: Proxy Proxies (max_values: None, max_size: Some(467), added: 2942, mode: MaxEncodedLen) fn proxy(_p: u32, ) -> Weight { - Weight::from_ref_time(24_929_956 as u64) + Weight::from_parts(24_929_956 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) } // Storage: Proxy Proxies (r:1 w:0) @@ -61,9 +61,9 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn proxy_announced(a: u32, _p: u32, ) -> Weight { - Weight::from_ref_time(41_483_872 as u64) + Weight::from_parts(41_483_872 as u64, 0) // Standard Error: 43_404 - .saturating_add(Weight::from_ref_time(122_506 as u64).saturating_mul(a as u64)) + .saturating_add(Weight::from_parts(122_506 as u64, 0).saturating_mul(a as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -72,9 +72,9 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn remove_announcement(a: u32, _p: u32, ) -> Weight { - Weight::from_ref_time(25_637_685 as u64) + Weight::from_parts(25_637_685 as u64, 0) // Standard Error: 31_182 - .saturating_add(Weight::from_ref_time(310_154 as u64).saturating_mul(a as u64)) + .saturating_add(Weight::from_parts(310_154 as u64, 0).saturating_mul(a as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -83,11 +83,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn reject_announcement(a: u32, p: u32, ) -> Weight { - Weight::from_ref_time(23_441_094 as u64) + Weight::from_parts(23_441_094 as u64, 0) // Standard Error: 42_108 - .saturating_add(Weight::from_ref_time(486_177 as u64).saturating_mul(a as u64)) + .saturating_add(Weight::from_parts(486_177 as u64, 0).saturating_mul(a as u64)) // Standard Error: 46_746 - .saturating_add(Weight::from_ref_time(189_817 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(189_817 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -98,54 +98,54 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn announce(a: u32, p: u32, ) -> Weight { - Weight::from_ref_time(33_809_817 as u64) + Weight::from_parts(33_809_817 as u64, 0) // Standard Error: 63_991 - .saturating_add(Weight::from_ref_time(546_841 as u64).saturating_mul(a as u64)) + .saturating_add(Weight::from_parts(546_841 as u64, 0).saturating_mul(a as u64)) // Standard Error: 71_040 - .saturating_add(Weight::from_ref_time(163_484 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(163_484 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Proxy Proxies (r:1 w:1) // Proof: Proxy Proxies (max_values: None, max_size: Some(467), added: 2942, mode: MaxEncodedLen) fn add_proxy(p: u32, ) -> Weight { - Weight::from_ref_time(26_271_824 as u64) + Weight::from_parts(26_271_824 as u64, 0) // Standard Error: 68_528 - .saturating_add(Weight::from_ref_time(739_793 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(739_793 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Proxy Proxies (r:1 w:1) // Proof: Proxy Proxies (max_values: None, max_size: Some(467), added: 2942, mode: MaxEncodedLen) fn remove_proxy(_p: u32, ) -> Weight { - Weight::from_ref_time(31_310_212 as u64) + Weight::from_parts(31_310_212 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Proxy Proxies (r:1 w:1) // Proof: Proxy Proxies (max_values: None, max_size: Some(467), added: 2942, mode: MaxEncodedLen) fn remove_proxies(p: u32, ) -> Weight { - Weight::from_ref_time(22_999_382 as u64) + Weight::from_parts(22_999_382 as u64, 0) // Standard Error: 77_197 - .saturating_add(Weight::from_ref_time(89_076 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(89_076 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Proxy Proxies (r:1 w:1) // Proof: Proxy Proxies (max_values: None, max_size: Some(467), added: 2942, mode: MaxEncodedLen) fn create_pure(p: u32, ) -> Weight { - Weight::from_ref_time(29_724_514 as u64) + Weight::from_parts(29_724_514 as u64, 0) // Standard Error: 117_550 - .saturating_add(Weight::from_ref_time(1_203_667 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(1_203_667 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Proxy Proxies (r:1 w:1) // Proof: Proxy Proxies (max_values: None, max_size: Some(467), added: 2942, mode: MaxEncodedLen) fn kill_pure(p: u32, ) -> Weight { - Weight::from_ref_time(23_020_019 as u64) + Weight::from_parts(23_020_019 as u64, 0) // Standard Error: 63_735 - .saturating_add(Weight::from_ref_time(272_602 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(272_602 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } diff --git a/runtimes/spiritnet/src/weights/pallet_scheduler.rs b/runtimes/spiritnet/src/weights/pallet_scheduler.rs index 66e88a4987..23e863ca08 100644 --- a/runtimes/spiritnet/src/weights/pallet_scheduler.rs +++ b/runtimes/spiritnet/src/weights/pallet_scheduler.rs @@ -51,54 +51,54 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Storage: Scheduler IncompleteSince (r:1 w:1) // Proof: Scheduler IncompleteSince (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) fn service_agendas_base() -> Weight { - Weight::from_ref_time(7_259_000 as u64) + Weight::from_parts(7_259_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Scheduler Agenda (r:1 w:1) // Proof: Scheduler Agenda (max_values: None, max_size: Some(39167), added: 41642, mode: MaxEncodedLen) fn service_agenda_base(s: u32, ) -> Weight { - Weight::from_ref_time(8_732_296 as u64) + Weight::from_parts(8_732_296 as u64, 0) // Standard Error: 8_385 - .saturating_add(Weight::from_ref_time(1_201_595 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(1_201_595 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } fn service_task_base() -> Weight { - Weight::from_ref_time(6_936_000 as u64) + Weight::from_parts(6_936_000 as u64, 0) } // Storage: Preimage PreimageFor (r:1 w:1) // Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: Measured) // Storage: Preimage StatusFor (r:1 w:1) // Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn service_task_fetched(s: u32, ) -> Weight { - Weight::from_ref_time(36_011_000 as u64) + Weight::from_parts(36_011_000 as u64, 0) // Standard Error: 15 - .saturating_add(Weight::from_ref_time(1_768 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(1_768 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Scheduler Lookup (r:0 w:1) // Proof: Scheduler Lookup (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) fn service_task_named() -> Weight { - Weight::from_ref_time(8_568_000 as u64) + Weight::from_parts(8_568_000 as u64, 0) .saturating_add(T::DbWeight::get().writes(1 as u64)) } fn service_task_periodic() -> Weight { - Weight::from_ref_time(6_813_000 as u64) + Weight::from_parts(6_813_000 as u64, 0) } fn execute_dispatch_signed() -> Weight { - Weight::from_ref_time(3_487_000 as u64) + Weight::from_parts(3_487_000 as u64, 0) } fn execute_dispatch_unsigned() -> Weight { - Weight::from_ref_time(4_863_000 as u64) + Weight::from_parts(4_863_000 as u64, 0) } // Storage: Scheduler Agenda (r:1 w:1) // Proof: Scheduler Agenda (max_values: None, max_size: Some(39167), added: 41642, mode: MaxEncodedLen) fn schedule(s: u32, ) -> Weight { - Weight::from_ref_time(22_448_494 as u64) + Weight::from_parts(22_448_494 as u64, 0) // Standard Error: 12_694 - .saturating_add(Weight::from_ref_time(1_153_307 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(1_153_307 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -107,9 +107,9 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Storage: Scheduler Lookup (r:0 w:1) // Proof: Scheduler Lookup (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) fn cancel(s: u32, ) -> Weight { - Weight::from_ref_time(24_096_800 as u64) + Weight::from_parts(24_096_800 as u64, 0) // Standard Error: 13_060 - .saturating_add(Weight::from_ref_time(2_096_283 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(2_096_283 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -118,9 +118,9 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Storage: Scheduler Agenda (r:1 w:1) // Proof: Scheduler Agenda (max_values: None, max_size: Some(39167), added: 41642, mode: MaxEncodedLen) fn schedule_named(s: u32, ) -> Weight { - Weight::from_ref_time(28_799_568 as u64) + Weight::from_parts(28_799_568 as u64, 0) // Standard Error: 15_283 - .saturating_add(Weight::from_ref_time(1_110_018 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(1_110_018 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -129,9 +129,9 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Storage: Scheduler Agenda (r:1 w:1) // Proof: Scheduler Agenda (max_values: None, max_size: Some(39167), added: 41642, mode: MaxEncodedLen) fn cancel_named(s: u32, ) -> Weight { - Weight::from_ref_time(26_672_036 as u64) + Weight::from_parts(26_672_036 as u64, 0) // Standard Error: 15_001 - .saturating_add(Weight::from_ref_time(2_108_784 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(2_108_784 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/runtimes/spiritnet/src/weights/pallet_session.rs b/runtimes/spiritnet/src/weights/pallet_session.rs index a0852beffb..1df3c9509c 100644 --- a/runtimes/spiritnet/src/weights/pallet_session.rs +++ b/runtimes/spiritnet/src/weights/pallet_session.rs @@ -53,7 +53,7 @@ impl pallet_session::WeightInfo for WeightInfo { // Storage: Session KeyOwner (r:1 w:1) // Proof Skipped: Session KeyOwner (max_values: None, max_size: None, mode: Measured) fn set_keys() -> Weight { - Weight::from_ref_time(17_827_000 as u64) + Weight::from_parts(17_827_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -62,7 +62,7 @@ impl pallet_session::WeightInfo for WeightInfo { // Storage: Session KeyOwner (r:0 w:1) // Proof Skipped: Session KeyOwner (max_values: None, max_size: None, mode: Measured) fn purge_keys() -> Weight { - Weight::from_ref_time(13_772_000 as u64) + Weight::from_parts(13_772_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/runtimes/spiritnet/src/weights/pallet_timestamp.rs b/runtimes/spiritnet/src/weights/pallet_timestamp.rs index 7aac1c8cb7..35bf4dfc5e 100644 --- a/runtimes/spiritnet/src/weights/pallet_timestamp.rs +++ b/runtimes/spiritnet/src/weights/pallet_timestamp.rs @@ -51,11 +51,11 @@ impl pallet_timestamp::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:1) // Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) fn set() -> Weight { - Weight::from_ref_time(8_194_000 as u64) + Weight::from_parts(8_194_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } fn on_finalize() -> Weight { - Weight::from_ref_time(5_551_000 as u64) + Weight::from_parts(5_551_000 as u64, 0) } } diff --git a/runtimes/spiritnet/src/weights/pallet_tips.rs b/runtimes/spiritnet/src/weights/pallet_tips.rs index ead8a9c8b2..4d80aaffa0 100644 --- a/runtimes/spiritnet/src/weights/pallet_tips.rs +++ b/runtimes/spiritnet/src/weights/pallet_tips.rs @@ -53,9 +53,9 @@ impl pallet_tips::WeightInfo for WeightInfo { // Storage: Tips Tips (r:1 w:1) // Proof Skipped: Tips Tips (max_values: None, max_size: None, mode: Measured) fn report_awesome(r: u32, ) -> Weight { - Weight::from_ref_time(34_678_995 as u64) + Weight::from_parts(34_678_995 as u64, 0) // Standard Error: 63 - .saturating_add(Weight::from_ref_time(1_929 as u64).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(1_929 as u64, 0).saturating_mul(r as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -64,7 +64,7 @@ impl pallet_tips::WeightInfo for WeightInfo { // Storage: Tips Reasons (r:0 w:1) // Proof Skipped: Tips Reasons (max_values: None, max_size: None, mode: Measured) fn retract_tip() -> Weight { - Weight::from_ref_time(26_984_000 as u64) + Weight::from_parts(26_984_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -75,11 +75,11 @@ impl pallet_tips::WeightInfo for WeightInfo { // Storage: Tips Tips (r:0 w:1) // Proof Skipped: Tips Tips (max_values: None, max_size: None, mode: Measured) fn tip_new(r: u32, t: u32, ) -> Weight { - Weight::from_ref_time(23_331_637 as u64) + Weight::from_parts(23_331_637 as u64, 0) // Standard Error: 29 - .saturating_add(Weight::from_ref_time(2_083 as u64).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(2_083 as u64, 0).saturating_mul(r as u64)) // Standard Error: 4_929 - .saturating_add(Weight::from_ref_time(38_831 as u64).saturating_mul(t as u64)) + .saturating_add(Weight::from_parts(38_831 as u64, 0).saturating_mul(t as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -88,9 +88,9 @@ impl pallet_tips::WeightInfo for WeightInfo { // Storage: Tips Tips (r:1 w:1) // Proof Skipped: Tips Tips (max_values: None, max_size: None, mode: Measured) fn tip(t: u32, ) -> Weight { - Weight::from_ref_time(21_024_385 as u64) + Weight::from_parts(21_024_385 as u64, 0) // Standard Error: 4_827 - .saturating_add(Weight::from_ref_time(80_931 as u64).saturating_mul(t as u64)) + .saturating_add(Weight::from_parts(80_931 as u64, 0).saturating_mul(t as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -103,9 +103,9 @@ impl pallet_tips::WeightInfo for WeightInfo { // Storage: Tips Reasons (r:0 w:1) // Proof Skipped: Tips Reasons (max_values: None, max_size: None, mode: Measured) fn close_tip(t: u32, ) -> Weight { - Weight::from_ref_time(60_474_036 as u64) + Weight::from_parts(60_474_036 as u64, 0) // Standard Error: 9_536 - .saturating_add(Weight::from_ref_time(2_238 as u64).saturating_mul(t as u64)) + .saturating_add(Weight::from_parts(2_238 as u64, 0).saturating_mul(t as u64)) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } @@ -114,7 +114,7 @@ impl pallet_tips::WeightInfo for WeightInfo { // Storage: Tips Reasons (r:0 w:1) // Proof Skipped: Tips Reasons (max_values: None, max_size: None, mode: Measured) fn slash_tip(_t: u32, ) -> Weight { - Weight::from_ref_time(20_257_747 as u64) + Weight::from_parts(20_257_747 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/runtimes/spiritnet/src/weights/pallet_treasury.rs b/runtimes/spiritnet/src/weights/pallet_treasury.rs index 93dd32b824..aa3eeab56f 100644 --- a/runtimes/spiritnet/src/weights/pallet_treasury.rs +++ b/runtimes/spiritnet/src/weights/pallet_treasury.rs @@ -49,14 +49,14 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_treasury::WeightInfo for WeightInfo { fn spend() -> Weight { - Weight::from_ref_time(257_000 as u64) + Weight::from_parts(257_000 as u64, 0) } // Storage: Treasury ProposalCount (r:1 w:1) // Proof: Treasury ProposalCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) // Storage: Treasury Proposals (r:0 w:1) // Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) fn propose_spend() -> Weight { - Weight::from_ref_time(27_461_000 as u64) + Weight::from_parts(27_461_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -65,7 +65,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Storage: System Account (r:2 w:2) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn reject_proposal() -> Weight { - Weight::from_ref_time(68_602_000 as u64) + Weight::from_parts(68_602_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -74,16 +74,16 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Storage: Treasury Approvals (r:1 w:1) // Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen) fn approve_proposal(p: u32, ) -> Weight { - Weight::from_ref_time(14_674_204 as u64) + Weight::from_parts(14_674_204 as u64, 0) // Standard Error: 1_555 - .saturating_add(Weight::from_ref_time(24_451 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(24_451 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Treasury Approvals (r:1 w:1) // Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen) fn remove_approval() -> Weight { - Weight::from_ref_time(12_125_000 as u64) + Weight::from_parts(12_125_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -98,9 +98,9 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Storage: Treasury Proposals (r:100 w:100) // Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) fn on_initialize_proposals(p: u32, ) -> Weight { - Weight::from_ref_time(71_952_240 as u64) + Weight::from_parts(71_952_240 as u64, 0) // Standard Error: 22_654 - .saturating_add(Weight::from_ref_time(34_252_995 as u64).saturating_mul(p as u64)) + .saturating_add(Weight::from_parts(34_252_995 as u64, 0).saturating_mul(p as u64)) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(p as u64))) .saturating_add(T::DbWeight::get().writes(4 as u64)) diff --git a/runtimes/spiritnet/src/weights/pallet_utility.rs b/runtimes/spiritnet/src/weights/pallet_utility.rs index 5ca8468c19..6d7769aa73 100644 --- a/runtimes/spiritnet/src/weights/pallet_utility.rs +++ b/runtimes/spiritnet/src/weights/pallet_utility.rs @@ -49,24 +49,24 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_utility::WeightInfo for WeightInfo { fn batch(c: u32, ) -> Weight { - Weight::from_ref_time(79_134_909 as u64) + Weight::from_parts(79_134_909 as u64, 0) // Standard Error: 21_258 - .saturating_add(Weight::from_ref_time(5_084_810 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(5_084_810 as u64, 0).saturating_mul(c as u64)) } fn as_derivative() -> Weight { - Weight::from_ref_time(9_379_000 as u64) + Weight::from_parts(9_379_000 as u64, 0) } fn batch_all(c: u32, ) -> Weight { - Weight::from_ref_time(56_869_903 as u64) + Weight::from_parts(56_869_903 as u64, 0) // Standard Error: 18_968 - .saturating_add(Weight::from_ref_time(5_396_723 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(5_396_723 as u64, 0).saturating_mul(c as u64)) } fn dispatch_as() -> Weight { - Weight::from_ref_time(10_999_000 as u64) + Weight::from_parts(10_999_000 as u64, 0) } fn force_batch(c: u32, ) -> Weight { - Weight::from_ref_time(68_110_842 as u64) + Weight::from_parts(68_110_842 as u64, 0) // Standard Error: 9_807 - .saturating_add(Weight::from_ref_time(5_069_264 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(5_069_264 as u64, 0).saturating_mul(c as u64)) } } diff --git a/runtimes/spiritnet/src/weights/pallet_vesting.rs b/runtimes/spiritnet/src/weights/pallet_vesting.rs index 132fb96f32..22c3069d12 100644 --- a/runtimes/spiritnet/src/weights/pallet_vesting.rs +++ b/runtimes/spiritnet/src/weights/pallet_vesting.rs @@ -53,11 +53,11 @@ impl pallet_vesting::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn vest_locked(l: u32, s: u32, ) -> Weight { - Weight::from_ref_time(33_400_641 as u64) + Weight::from_parts(33_400_641 as u64, 0) // Standard Error: 7_324 - .saturating_add(Weight::from_ref_time(44_003 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(44_003 as u64, 0).saturating_mul(l as u64)) // Standard Error: 13_032 - .saturating_add(Weight::from_ref_time(97_512 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(97_512 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -66,9 +66,9 @@ impl pallet_vesting::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn vest_unlocked(l: u32, _s: u32, ) -> Weight { - Weight::from_ref_time(35_069_059 as u64) + Weight::from_parts(35_069_059 as u64, 0) // Standard Error: 4_836 - .saturating_add(Weight::from_ref_time(28_435 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(28_435 as u64, 0).saturating_mul(l as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -79,11 +79,11 @@ impl pallet_vesting::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn vest_other_locked(l: u32, s: u32, ) -> Weight { - Weight::from_ref_time(40_289_268 as u64) + Weight::from_parts(40_289_268 as u64, 0) // Standard Error: 4_796 - .saturating_add(Weight::from_ref_time(15_247 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(15_247 as u64, 0).saturating_mul(l as u64)) // Standard Error: 8_533 - .saturating_add(Weight::from_ref_time(19_258 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(19_258 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -94,11 +94,11 @@ impl pallet_vesting::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { - Weight::from_ref_time(38_349_682 as u64) + Weight::from_parts(38_349_682 as u64, 0) // Standard Error: 4_594 - .saturating_add(Weight::from_ref_time(35_747 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(35_747 as u64, 0).saturating_mul(l as u64)) // Standard Error: 8_173 - .saturating_add(Weight::from_ref_time(21_563 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(21_563 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -109,9 +109,9 @@ impl pallet_vesting::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn vested_transfer(l: u32, _s: u32, ) -> Weight { - Weight::from_ref_time(54_860_618 as u64) + Weight::from_parts(54_860_618 as u64, 0) // Standard Error: 12_316 - .saturating_add(Weight::from_ref_time(51_714 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(51_714 as u64, 0).saturating_mul(l as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -122,11 +122,11 @@ impl pallet_vesting::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn force_vested_transfer(l: u32, s: u32, ) -> Weight { - Weight::from_ref_time(61_203_879 as u64) + Weight::from_parts(61_203_879 as u64, 0) // Standard Error: 16_405 - .saturating_add(Weight::from_ref_time(50_578 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(50_578 as u64, 0).saturating_mul(l as u64)) // Standard Error: 29_187 - .saturating_add(Weight::from_ref_time(59_211 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(59_211 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } @@ -137,11 +137,11 @@ impl pallet_vesting::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { - Weight::from_ref_time(38_957_662 as u64) + Weight::from_parts(38_957_662 as u64, 0) // Standard Error: 3_010 - .saturating_add(Weight::from_ref_time(34_046 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(34_046 as u64, 0).saturating_mul(l as u64)) // Standard Error: 5_559 - .saturating_add(Weight::from_ref_time(37_367 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(37_367 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -152,11 +152,11 @@ impl pallet_vesting::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { - Weight::from_ref_time(38_940_362 as u64) + Weight::from_parts(38_940_362 as u64, 0) // Standard Error: 6_011 - .saturating_add(Weight::from_ref_time(28_458 as u64).saturating_mul(l as u64)) + .saturating_add(Weight::from_parts(28_458 as u64, 0).saturating_mul(l as u64)) // Standard Error: 11_100 - .saturating_add(Weight::from_ref_time(59_868 as u64).saturating_mul(s as u64)) + .saturating_add(Weight::from_parts(59_868 as u64, 0).saturating_mul(s as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } diff --git a/runtimes/spiritnet/src/weights/pallet_web3_names.rs b/runtimes/spiritnet/src/weights/pallet_web3_names.rs index 46dda16fce..14fc750023 100644 --- a/runtimes/spiritnet/src/weights/pallet_web3_names.rs +++ b/runtimes/spiritnet/src/weights/pallet_web3_names.rs @@ -57,7 +57,7 @@ impl pallet_web3_names::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn claim(_n: u32, ) -> Weight { - Weight::from_ref_time(40_237_964 as u64) + Weight::from_parts(40_237_964 as u64, 0) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -68,7 +68,7 @@ impl pallet_web3_names::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn release_by_owner() -> Weight { - Weight::from_ref_time(32_912_000 as u64) + Weight::from_parts(32_912_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -79,9 +79,9 @@ impl pallet_web3_names::WeightInfo for WeightInfo { // Storage: Web3Names Names (r:0 w:1) // Proof: Web3Names Names (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) fn reclaim_deposit(n: u32, ) -> Weight { - Weight::from_ref_time(31_703_821 as u64) + Weight::from_parts(31_703_821 as u64, 0) // Standard Error: 36_296 - .saturating_add(Weight::from_ref_time(235_783 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(235_783 as u64, 0).saturating_mul(n as u64)) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -94,14 +94,14 @@ impl pallet_web3_names::WeightInfo for WeightInfo { // Storage: Web3Names Names (r:0 w:1) // Proof: Web3Names Names (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) fn ban(_n: u32, ) -> Weight { - Weight::from_ref_time(43_007_574 as u64) + Weight::from_parts(43_007_574 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: Web3Names Banned (r:1 w:1) // Proof: Web3Names Banned (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn unban(_n: u32, ) -> Weight { - Weight::from_ref_time(17_954_246 as u64) + Weight::from_parts(17_954_246 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -112,7 +112,7 @@ impl pallet_web3_names::WeightInfo for WeightInfo { // Storage: System Account (r:2 w:2) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn change_deposit_owner() -> Weight { - Weight::from_ref_time(66_017_000 as u64) + Weight::from_parts(66_017_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -121,7 +121,7 @@ impl pallet_web3_names::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn update_deposit() -> Weight { - Weight::from_ref_time(57_911_000 as u64) + Weight::from_parts(57_911_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/runtimes/spiritnet/src/weights/pallet_xcm.rs b/runtimes/spiritnet/src/weights/pallet_xcm.rs index a9bc9f9956..8bb2babb73 100644 --- a/runtimes/spiritnet/src/weights/pallet_xcm.rs +++ b/runtimes/spiritnet/src/weights/pallet_xcm.rs @@ -59,35 +59,35 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn send() -> Weight { - Weight::from_ref_time(47_819_000 as u64) + Weight::from_parts(47_819_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(5 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Benchmark Override (r:0 w:0) // Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn teleport_assets() -> Weight { - Weight::from_ref_time(18_446_744_073_709_551_000 as u64) + Weight::from_parts(18_446_744_073_709_551_000 as u64, 0) } // Storage: Benchmark Override (r:0 w:0) // Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn reserve_transfer_assets() -> Weight { - Weight::from_ref_time(18_446_744_073_709_551_000 as u64) + Weight::from_parts(18_446_744_073_709_551_000 as u64, 0) } // Storage: Benchmark Override (r:0 w:0) // Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn execute() -> Weight { - Weight::from_ref_time(18_446_744_073_709_551_000 as u64) + Weight::from_parts(18_446_744_073_709_551_000 as u64, 0) } // Storage: PolkadotXcm SupportedVersion (r:0 w:1) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn force_xcm_version() -> Weight { - Weight::from_ref_time(11_906_000 as u64) + Weight::from_parts(11_906_000 as u64, 0) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: PolkadotXcm SafeXcmVersion (r:0 w:1) // Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) fn force_default_xcm_version() -> Weight { - Weight::from_ref_time(3_726_000 as u64) + Weight::from_parts(3_726_000 as u64, 0) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) @@ -107,7 +107,7 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Storage: PolkadotXcm Queries (r:0 w:1) // Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) fn force_subscribe_version_notify() -> Weight { - Weight::from_ref_time(39_357_000 as u64) + Weight::from_parts(39_357_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(7 as u64)) .saturating_add(T::DbWeight::get().writes(5 as u64)) } @@ -126,28 +126,28 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Storage: PolkadotXcm Queries (r:0 w:1) // Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) fn force_unsubscribe_version_notify() -> Weight { - Weight::from_ref_time(57_944_000 as u64) + Weight::from_parts(57_944_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: PolkadotXcm SupportedVersion (r:4 w:2) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { - Weight::from_ref_time(33_805_000 as u64) + Weight::from_parts(33_805_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PolkadotXcm VersionNotifiers (r:4 w:2) // Proof Skipped: PolkadotXcm VersionNotifiers (max_values: None, max_size: None, mode: Measured) fn migrate_version_notifiers() -> Weight { - Weight::from_ref_time(35_045_000 as u64) + Weight::from_parts(35_045_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PolkadotXcm VersionNotifyTargets (r:5 w:0) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) fn already_notified_target() -> Weight { - Weight::from_ref_time(39_994_000 as u64) + Weight::from_parts(39_994_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(5 as u64)) } // Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) @@ -163,20 +163,20 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn notify_current_targets() -> Weight { - Weight::from_ref_time(35_628_000 as u64) + Weight::from_parts(35_628_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(7 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: PolkadotXcm VersionNotifyTargets (r:3 w:0) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) fn notify_target_migration_fail() -> Weight { - Weight::from_ref_time(9_994_000 as u64) + Weight::from_parts(9_994_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) } // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) fn migrate_version_notify_targets() -> Weight { - Weight::from_ref_time(20_693_000 as u64) + Weight::from_parts(20_693_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -193,7 +193,7 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn migrate_and_notify_old_targets() -> Weight { - Weight::from_ref_time(44_084_000 as u64) + Weight::from_parts(44_084_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(9 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } diff --git a/runtimes/spiritnet/src/weights/parachain_staking.rs b/runtimes/spiritnet/src/weights/parachain_staking.rs index c42fca2c86..040ad9ff5a 100644 --- a/runtimes/spiritnet/src/weights/parachain_staking.rs +++ b/runtimes/spiritnet/src/weights/parachain_staking.rs @@ -51,13 +51,13 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking Round (r:1 w:0) // Proof: ParachainStaking Round (max_values: Some(1), max_size: Some(20), added: 515, mode: MaxEncodedLen) fn on_initialize_no_action() -> Weight { - Weight::from_ref_time(9_720_000 as u64) + Weight::from_parts(9_720_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) } // Storage: ParachainStaking Round (r:1 w:1) // Proof: ParachainStaking Round (max_values: Some(1), max_size: Some(20), added: 515, mode: MaxEncodedLen) fn on_initialize_round_update() -> Weight { - Weight::from_ref_time(19_583_000 as u64) + Weight::from_parts(19_583_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -72,14 +72,14 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn on_initialize_network_rewards() -> Weight { - Weight::from_ref_time(37_094_000 as u64) + Weight::from_parts(37_094_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(5 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: ParachainStaking ForceNewRound (r:0 w:1) // Proof: ParachainStaking ForceNewRound (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) fn force_new_round() -> Weight { - Weight::from_ref_time(3_573_000 as u64) + Weight::from_parts(3_573_000 as u64, 0) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: ParachainStaking CandidatePool (r:76 w:0) @@ -97,11 +97,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking CounterForCandidatePool (r:1 w:0) // Proof: ParachainStaking CounterForCandidatePool (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn set_inflation(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(663_557_000 as u64) + Weight::from_parts(663_557_000 as u64, 0) // Standard Error: 4_566_075 - .saturating_add(Weight::from_ref_time(143_112_464 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(143_112_464 as u64, 0).saturating_mul(n as u64)) // Standard Error: 9_803_263 - .saturating_add(Weight::from_ref_time(269_841_967 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(269_841_967 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(152 as u64)) .saturating_add(T::DbWeight::get().reads((27 as u64).saturating_mul(n as u64))) .saturating_add(T::DbWeight::get().reads((51 as u64).saturating_mul(m as u64))) @@ -118,11 +118,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking TotalCollatorStake (r:1 w:1) // Proof: ParachainStaking TotalCollatorStake (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) fn set_max_selected_candidates(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(34_791_000 as u64) + Weight::from_parts(34_791_000 as u64, 0) // Standard Error: 22_810 - .saturating_add(Weight::from_ref_time(3_158_790 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(3_158_790 as u64, 0).saturating_mul(n as u64)) // Standard Error: 50_488 - .saturating_add(Weight::from_ref_time(237_373 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(237_373 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(n as u64))) .saturating_add(T::DbWeight::get().writes(2 as u64)) @@ -130,7 +130,7 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking Round (r:1 w:1) // Proof: ParachainStaking Round (max_values: Some(1), max_size: Some(20), added: 515, mode: MaxEncodedLen) fn set_blocks_per_round() -> Weight { - Weight::from_ref_time(24_158_000 as u64) + Weight::from_parts(24_158_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -163,11 +163,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking MaxSelectedCandidates (r:1 w:0) // Proof: ParachainStaking MaxSelectedCandidates (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn force_remove_candidate(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(133_321_000 as u64) + Weight::from_parts(133_321_000 as u64, 0) // Standard Error: 23_503 - .saturating_add(Weight::from_ref_time(849_432 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(849_432 as u64, 0).saturating_mul(n as u64)) // Standard Error: 52_141 - .saturating_add(Weight::from_ref_time(24_512_322 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(24_512_322 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(29 as u64)) .saturating_add(T::DbWeight::get().reads((4 as u64).saturating_mul(m as u64))) .saturating_add(T::DbWeight::get().writes(10 as u64)) @@ -194,11 +194,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking TotalCollatorStake (r:1 w:1) // Proof: ParachainStaking TotalCollatorStake (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) fn join_candidates(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(58_290_006 as u64) + Weight::from_parts(58_290_006 as u64, 0) // Standard Error: 9_768 - .saturating_add(Weight::from_ref_time(452_557 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(452_557 as u64, 0).saturating_mul(n as u64)) // Standard Error: 20_284 - .saturating_add(Weight::from_ref_time(801_802 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(801_802 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(10 as u64)) .saturating_add(T::DbWeight::get().writes(7 as u64)) } @@ -213,11 +213,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking TotalCollatorStake (r:1 w:1) // Proof: ParachainStaking TotalCollatorStake (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) fn init_leave_candidates(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(82_719_648 as u64) + Weight::from_parts(82_719_648 as u64, 0) // Standard Error: 9_416 - .saturating_add(Weight::from_ref_time(540_449 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(540_449 as u64, 0).saturating_mul(n as u64)) // Standard Error: 15_271 - .saturating_add(Weight::from_ref_time(1_265_189 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(1_265_189 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(21 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -230,11 +230,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking TotalCollatorStake (r:1 w:1) // Proof: ParachainStaking TotalCollatorStake (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) fn cancel_leave_candidates(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(40_360_490 as u64) + Weight::from_parts(40_360_490 as u64, 0) // Standard Error: 6_610 - .saturating_add(Weight::from_ref_time(244_903 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(244_903 as u64, 0).saturating_mul(n as u64)) // Standard Error: 10_720 - .saturating_add(Weight::from_ref_time(568_999 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(568_999 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(5 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -265,11 +265,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking CounterForCandidatePool (r:1 w:1) // Proof: ParachainStaking CounterForCandidatePool (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn execute_leave_candidates(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(66_923_000 as u64) + Weight::from_parts(66_923_000 as u64, 0) // Standard Error: 20_476 - .saturating_add(Weight::from_ref_time(750_740 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(750_740 as u64, 0).saturating_mul(n as u64)) // Standard Error: 44_843 - .saturating_add(Weight::from_ref_time(24_654_644 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(24_654_644 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(12 as u64)) .saturating_add(T::DbWeight::get().reads((4 as u64).saturating_mul(m as u64))) .saturating_add(T::DbWeight::get().writes(8 as u64)) @@ -300,13 +300,13 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking InflationConfig (r:1 w:0) // Proof: ParachainStaking InflationConfig (max_values: Some(1), max_size: Some(96), added: 591, mode: MaxEncodedLen) fn candidate_stake_more(n: u32, m: u32, u: u32, ) -> Weight { - Weight::from_ref_time(55_908_884 as u64) + Weight::from_parts(55_908_884 as u64, 0) // Standard Error: 9_777 - .saturating_add(Weight::from_ref_time(500_279 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(500_279 as u64, 0).saturating_mul(n as u64)) // Standard Error: 20_296 - .saturating_add(Weight::from_ref_time(964_901 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(964_901 as u64, 0).saturating_mul(m as u64)) // Standard Error: 75_180 - .saturating_add(Weight::from_ref_time(1_126_340 as u64).saturating_mul(u as u64)) + .saturating_add(Weight::from_parts(1_126_340 as u64, 0).saturating_mul(u as u64)) .saturating_add(T::DbWeight::get().reads(12 as u64)) .saturating_add(T::DbWeight::get().writes(8 as u64)) } @@ -329,11 +329,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking InflationConfig (r:1 w:0) // Proof: ParachainStaking InflationConfig (max_values: Some(1), max_size: Some(96), added: 591, mode: MaxEncodedLen) fn candidate_stake_less(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(45_889_115 as u64) + Weight::from_parts(45_889_115 as u64, 0) // Standard Error: 10_474 - .saturating_add(Weight::from_ref_time(483_213 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(483_213 as u64, 0).saturating_mul(n as u64)) // Standard Error: 21_750 - .saturating_add(Weight::from_ref_time(905_984 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(905_984 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(9 as u64)) .saturating_add(T::DbWeight::get().writes(6 as u64)) } @@ -362,11 +362,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking BlocksRewarded (r:0 w:1) // Proof: ParachainStaking BlocksRewarded (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) fn join_delegators(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(62_585_140 as u64) + Weight::from_parts(62_585_140 as u64, 0) // Standard Error: 10_255 - .saturating_add(Weight::from_ref_time(588_425 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(588_425 as u64, 0).saturating_mul(n as u64)) // Standard Error: 22_793 - .saturating_add(Weight::from_ref_time(1_193_810 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(1_193_810 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(12 as u64)) .saturating_add(T::DbWeight::get().writes(9 as u64)) } @@ -395,13 +395,13 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking InflationConfig (r:1 w:0) // Proof: ParachainStaking InflationConfig (max_values: Some(1), max_size: Some(96), added: 591, mode: MaxEncodedLen) fn delegator_stake_more(n: u32, m: u32, u: u32, ) -> Weight { - Weight::from_ref_time(66_780_705 as u64) + Weight::from_parts(66_780_705 as u64, 0) // Standard Error: 9_176 - .saturating_add(Weight::from_ref_time(519_243 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(519_243 as u64, 0).saturating_mul(n as u64)) // Standard Error: 20_387 - .saturating_add(Weight::from_ref_time(950_103 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(950_103 as u64, 0).saturating_mul(m as u64)) // Standard Error: 79_072 - .saturating_add(Weight::from_ref_time(1_029_497 as u64).saturating_mul(u as u64)) + .saturating_add(Weight::from_parts(1_029_497 as u64, 0).saturating_mul(u as u64)) .saturating_add(T::DbWeight::get().reads(12 as u64)) .saturating_add(T::DbWeight::get().writes(9 as u64)) } @@ -426,11 +426,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking InflationConfig (r:1 w:0) // Proof: ParachainStaking InflationConfig (max_values: Some(1), max_size: Some(96), added: 591, mode: MaxEncodedLen) fn delegator_stake_less(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(55_304_698 as u64) + Weight::from_parts(55_304_698 as u64, 0) // Standard Error: 10_232 - .saturating_add(Weight::from_ref_time(495_173 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(495_173 as u64, 0).saturating_mul(n as u64)) // Standard Error: 22_742 - .saturating_add(Weight::from_ref_time(960_378 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(960_378 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(10 as u64)) .saturating_add(T::DbWeight::get().writes(7 as u64)) } @@ -455,11 +455,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking MaxSelectedCandidates (r:1 w:0) // Proof: ParachainStaking MaxSelectedCandidates (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn leave_delegators(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(62_004_177 as u64) + Weight::from_parts(62_004_177 as u64, 0) // Standard Error: 10_361 - .saturating_add(Weight::from_ref_time(490_342 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(490_342 as u64, 0).saturating_mul(n as u64)) // Standard Error: 23_027 - .saturating_add(Weight::from_ref_time(900_182 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(900_182 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(10 as u64)) .saturating_add(T::DbWeight::get().writes(7 as u64)) } @@ -470,14 +470,14 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn unlock_unstaked(_u: u32, ) -> Weight { - Weight::from_ref_time(40_259_781 as u64) + Weight::from_parts(40_259_781 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: ParachainStaking MaxCollatorCandidateStake (r:0 w:1) // Proof: ParachainStaking MaxCollatorCandidateStake (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) fn set_max_candidate_stake() -> Weight { - Weight::from_ref_time(9_402_000 as u64) + Weight::from_parts(9_402_000 as u64, 0) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: ParachainStaking DelegatorState (r:1 w:0) @@ -493,7 +493,7 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking InflationConfig (r:1 w:0) // Proof: ParachainStaking InflationConfig (max_values: Some(1), max_size: Some(96), added: 591, mode: MaxEncodedLen) fn increment_delegator_rewards() -> Weight { - Weight::from_ref_time(40_524_000 as u64) + Weight::from_parts(40_524_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -510,7 +510,7 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking InflationConfig (r:1 w:0) // Proof: ParachainStaking InflationConfig (max_values: Some(1), max_size: Some(96), added: 591, mode: MaxEncodedLen) fn increment_collator_rewards() -> Weight { - Weight::from_ref_time(24_257_000 as u64) + Weight::from_parts(24_257_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -519,7 +519,7 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn claim_rewards() -> Weight { - Weight::from_ref_time(48_168_000 as u64) + Weight::from_parts(48_168_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -540,11 +540,11 @@ impl parachain_staking::WeightInfo for WeightInfo { // Storage: ParachainStaking CounterForCandidatePool (r:1 w:0) // Proof: ParachainStaking CounterForCandidatePool (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn execute_scheduled_reward_change(n: u32, m: u32, ) -> Weight { - Weight::from_ref_time(657_155_000 as u64) + Weight::from_parts(657_155_000 as u64, 0) // Standard Error: 4_390_482 - .saturating_add(Weight::from_ref_time(136_436_522 as u64).saturating_mul(n as u64)) + .saturating_add(Weight::from_parts(136_436_522 as u64, 0).saturating_mul(n as u64)) // Standard Error: 9_426_268 - .saturating_add(Weight::from_ref_time(263_946_048 as u64).saturating_mul(m as u64)) + .saturating_add(Weight::from_parts(263_946_048 as u64, 0).saturating_mul(m as u64)) .saturating_add(T::DbWeight::get().reads(153 as u64)) .saturating_add(T::DbWeight::get().reads((27 as u64).saturating_mul(n as u64))) .saturating_add(T::DbWeight::get().reads((51 as u64).saturating_mul(m as u64))) diff --git a/runtimes/spiritnet/src/weights/public_credentials.rs b/runtimes/spiritnet/src/weights/public_credentials.rs index bcc43a16f6..89a23b8dfb 100644 --- a/runtimes/spiritnet/src/weights/public_credentials.rs +++ b/runtimes/spiritnet/src/weights/public_credentials.rs @@ -57,9 +57,9 @@ impl public_credentials::WeightInfo for WeightInfo { // Storage: PublicCredentials CredentialSubjects (r:0 w:1) // Proof: PublicCredentials CredentialSubjects (max_values: None, max_size: Some(312), added: 2787, mode: MaxEncodedLen) fn add(c: u32, ) -> Weight { - Weight::from_ref_time(52_767_011 as u64) + Weight::from_parts(52_767_011 as u64, 0) // Standard Error: 20 - .saturating_add(Weight::from_ref_time(3_182 as u64).saturating_mul(c as u64)) + .saturating_add(Weight::from_parts(3_182 as u64, 0).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -68,7 +68,7 @@ impl public_credentials::WeightInfo for WeightInfo { // Storage: PublicCredentials Credentials (r:1 w:1) // Proof: PublicCredentials Credentials (max_values: None, max_size: Some(475), added: 2950, mode: MaxEncodedLen) fn revoke() -> Weight { - Weight::from_ref_time(27_663_000 as u64) + Weight::from_parts(27_663_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -77,7 +77,7 @@ impl public_credentials::WeightInfo for WeightInfo { // Storage: PublicCredentials Credentials (r:1 w:1) // Proof: PublicCredentials Credentials (max_values: None, max_size: Some(475), added: 2950, mode: MaxEncodedLen) fn unrevoke() -> Weight { - Weight::from_ref_time(27_570_000 as u64) + Weight::from_parts(27_570_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -88,7 +88,7 @@ impl public_credentials::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn remove() -> Weight { - Weight::from_ref_time(45_902_000 as u64) + Weight::from_parts(45_902_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -99,7 +99,7 @@ impl public_credentials::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn reclaim_deposit() -> Weight { - Weight::from_ref_time(68_877_000 as u64) + Weight::from_parts(68_877_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -110,7 +110,7 @@ impl public_credentials::WeightInfo for WeightInfo { // Storage: System Account (r:2 w:2) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn change_deposit_owner() -> Weight { - Weight::from_ref_time(58_093_000 as u64) + Weight::from_parts(58_093_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -121,7 +121,7 @@ impl public_credentials::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn update_deposit() -> Weight { - Weight::from_ref_time(54_520_000 as u64) + Weight::from_parts(54_520_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index 3d3084a80b..3c6e2657da 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -29,7 +29,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); use frame_support::{ construct_runtime, parameter_types, - traits::{Currency, Everything, InstanceFilter, KeyOwnerProofSystem}, + traits::{Currency, Everything, InstanceFilter}, weights::{constants::RocksDbWeight, ConstantMultiplier, IdentityFee, Weight}, }; pub use frame_system::Call as SystemCall; @@ -40,11 +40,10 @@ use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use frame_try_runtime::UpgradeCheckSelect; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; -use pallet_session::historical as session_historical; use pallet_transaction_payment::{CurrencyAdapter, FeeDetails}; use sp_api::impl_runtime_apis; use sp_consensus_aura::{ed25519::AuthorityId as AuraId, SlotDuration}; -use sp_core::{crypto::KeyTypeId, ConstU64, OpaqueMetadata}; +use sp_core::{ConstU64, OpaqueMetadata}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, OpaqueKeys}, @@ -213,7 +212,7 @@ impl pallet_aura::Config for Runtime { impl pallet_grandpa::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type KeyOwnerProof = >::Proof; + type KeyOwnerProof = sp_core::Void; type WeightInfo = (); type MaxAuthorities = MaxAuthorities; // This is a purely random value @@ -675,7 +674,6 @@ construct_runtime!( Session: pallet_session = 15, Authorship: pallet_authorship = 16, - Historical: session_historical::{Pallet} = 17, // Democracy: pallet_democracy = 25, // Council: pallet_collective = 26, // TechnicalCommittee: pallet_collective = 27, From 8ddacc2873f741d5b2f7708b07948181b43e988b Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 8 May 2023 10:16:03 +0200 Subject: [PATCH 03/99] service file fix --- nodes/standalone/src/service.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nodes/standalone/src/service.rs b/nodes/standalone/src/service.rs index 8dceb0ee3c..eaa3efb1b5 100644 --- a/nodes/standalone/src/service.rs +++ b/nodes/standalone/src/service.rs @@ -27,6 +27,7 @@ use sc_keystore::LocalKeystore; use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams}; use sc_telemetry::{Telemetry, TelemetryWorker}; use sp_consensus_aura::ed25519::AuthorityPair as AuraPair; + use std::{sync::Arc, time::Duration}; use mashnet_node_runtime::{self, opaque::Block, RuntimeApi}; @@ -260,7 +261,7 @@ pub fn new_full(mut config: Configuration) -> Result let slot_duration = sc_consensus_aura::slot_duration(&*client)?; - let aura = sc_consensus_aura::start_aura::(StartAuraParams { + let aura = sc_consensus_aura::start_aura::(StartAuraParams { slot_duration, client, select_chain, @@ -279,8 +280,8 @@ pub fn new_full(mut config: Configuration) -> Result force_authoring, backoff_authoring_blocks, keystore: keystore_container.sync_keystore(), - sync_oracle: network.clone(), - justification_sync_link: network.clone(), + sync_oracle: sync.clone(), + justification_sync_link: sync.clone(), block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32), max_block_proposal_slot_portion: None, telemetry: telemetry.as_ref().map(|x| x.handle()), From e64973722be5de4684c11d6bff77e65da204ec22 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 8 May 2023 13:22:34 +0200 Subject: [PATCH 04/99] chore: finished v0.9.40 --- Cargo.lock | 1 + Cargo.toml | 1 + nodes/parachain/Cargo.toml | 1 + nodes/parachain/src/service.rs | 24 ++++++++++-------------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7dff2e08f..9d5a3d7ada 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3978,6 +3978,7 @@ dependencies = [ "sc-consensus", "sc-executor", "sc-network", + "sc-network-sync", "sc-rpc-api", "sc-service", "sc-sysinfo", diff --git a/Cargo.toml b/Cargo.toml index e3980bc174..bc6df078a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -163,6 +163,7 @@ sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkad sc-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} sc-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +sc-network-sync = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} sc-rpc-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} sc-sysinfo = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} diff --git a/nodes/parachain/Cargo.toml b/nodes/parachain/Cargo.toml index b64cb66bac..faa827c7a9 100644 --- a/nodes/parachain/Cargo.toml +++ b/nodes/parachain/Cargo.toml @@ -41,6 +41,7 @@ sc-client-api.workspace = true sc-consensus.workspace = true sc-executor = {workspace = true} sc-network.workspace = true +sc-network-sync.workspace = true sc-service = {workspace = true} sc-sysinfo.workspace = true sc-telemetry.workspace = true diff --git a/nodes/parachain/src/service.rs b/nodes/parachain/src/service.rs index 18e5bdd78c..a57aa9e993 100644 --- a/nodes/parachain/src/service.rs +++ b/nodes/parachain/src/service.rs @@ -27,12 +27,13 @@ use cumulus_client_service::{ }; use cumulus_primitives_core::ParaId; use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain; -use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult}; +use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult}; use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node; use polkadot_service::{CollatorPair, NativeExecutionDispatch}; use sc_consensus::ImportQueue; use sc_executor::NativeElseWasmExecutor; -use sc_network::NetworkService; +use sc_network::NetworkBlock; +use sc_network_sync::SyncingService; use sc_service::{Configuration, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sp_api::ConstructRuntimeApi; @@ -47,8 +48,6 @@ type Header = sp_runtime::generic::Header; -type Hash = sp_core::H256; - type ParachainExecutor = NativeElseWasmExecutor; type ParachainClient = TFullClient>; @@ -278,7 +277,7 @@ where &TaskManager, Arc, Arc>>, - Arc>, + Arc>, SyncCryptoStorePtr, bool, ParaId, @@ -302,10 +301,7 @@ where hwbench.clone(), ) .await - .map_err(|e| match e { - RelayChainError::ServiceError(polkadot_service::Error::Sub(x)) => x, - s => s.to_string().into(), - })?; + .map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?; let force_authoring = parachain_config.force_authoring; let validator = parachain_config.role.is_authority(); @@ -341,7 +337,7 @@ where sc_service::spawn_tasks(sc_service::SpawnTasksParams { rpc_builder, - sync_service, + sync_service: sync_service.clone(), client: client.clone(), transaction_pool: transaction_pool.clone(), task_manager: &mut task_manager, @@ -368,8 +364,8 @@ where } let announce_block = { - let network = network.clone(); - Arc::new(move |hash, data| network.announce_block(hash, data)) + let sync = sync_service.clone(); + Arc::new(move |hash, data| sync.announce_block(hash, data)) }; let relay_chain_slot_duration = Duration::from_secs(6); @@ -387,7 +383,7 @@ where &task_manager, relay_chain_interface.clone(), transaction_pool, - network, + sync_service, params.keystore_container.sync_keystore(), force_authoring, id, @@ -526,7 +522,7 @@ fn build_consensus( task_manager: &TaskManager, relay_chain_interface: Arc, transaction_pool: Arc>>, - sync_oracle: Arc>, + sync_oracle: Arc>, keystore: SyncCryptoStorePtr, force_authoring: bool, id: ParaId, From c699de59046c11c2f7f84a50ed19ca9863629e55 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 9 May 2023 10:38:41 +0200 Subject: [PATCH 05/99] version 0.9.41 --- Cargo.lock | 662 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 204 ++++++++--------- 2 files changed, 433 insertions(+), 433 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9d5a3d7ada..58706aaa6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -562,7 +562,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "hash-db", "log", @@ -1417,7 +1417,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "clap", "parity-scale-codec", @@ -1432,7 +1432,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1455,7 +1455,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1484,7 +1484,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1508,7 +1508,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1531,7 +1531,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1590,7 +1590,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "frame-support", "frame-system", @@ -1606,7 +1606,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1623,7 +1623,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1652,7 +1652,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1663,7 +1663,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "frame-benchmarking", "frame-support", @@ -1677,7 +1677,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1693,7 +1693,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1714,7 +1714,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1730,7 +1730,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1753,7 +1753,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "cumulus-primitives-core", "futures", @@ -1766,7 +1766,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1784,7 +1784,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1809,7 +1809,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1827,7 +1827,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -1849,6 +1849,7 @@ dependencies = [ "sc-network-common", "sc-service", "sc-tracing", + "sc-utils", "sp-api", "sp-blockchain", "sp-consensus", @@ -1861,7 +1862,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1891,7 +1892,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2709,7 +2710,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", ] @@ -2732,7 +2733,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-support-procedural", @@ -2757,7 +2758,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -2804,7 +2805,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2815,7 +2816,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2832,7 +2833,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -2861,7 +2862,7 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "futures", "log", @@ -2877,7 +2878,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "bitflags", "environmental", @@ -2910,7 +2911,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "Inflector", "cfg-expr", @@ -2925,7 +2926,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2937,7 +2938,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "proc-macro2", "quote", @@ -2947,7 +2948,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "log", @@ -2965,7 +2966,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -2980,7 +2981,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "sp-api", @@ -2989,7 +2990,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "parity-scale-codec", @@ -4056,8 +4057,8 @@ dependencies = [ [[package]] name = "kusama-runtime" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bitvec", "frame-benchmarking", @@ -4154,8 +4155,8 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "frame-support", "polkadot-primitives", @@ -5142,7 +5143,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "futures", "log", @@ -5161,7 +5162,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "anyhow", "jsonrpsee", @@ -5589,9 +5590,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "orchestra" -version = "0.2.1" +version = "0.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b0766f60d83cac01c6e3f3bc36aaa9056e48bea0deddb98a8c74de6021f3061" +checksum = "227585216d05ba65c7ab0a0450a3cf2cbd81a98862a54c4df8e14d5ac6adb015" dependencies = [ "async-trait", "dyn-clonable", @@ -5606,12 +5607,11 @@ dependencies = [ [[package]] name = "orchestra-proc-macro" -version = "0.2.1" +version = "0.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8e83dbd049009426b445424a1104c78e6172a4c13e3614e52a38262785a5d7" +checksum = "2871aadd82a2c216ee68a69837a526dfe788ecbe74c4c5038a6acdbff6653066" dependencies = [ - "expander 1.0.0", - "indexmap", + "expander 0.0.6", "itertools", "petgraph", "proc-macro-crate", @@ -5664,7 +5664,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -5680,7 +5680,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -5696,7 +5696,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -5710,7 +5710,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -5734,7 +5734,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5754,7 +5754,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -5769,7 +5769,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -5788,7 +5788,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "binary-merkle-tree", @@ -5812,7 +5812,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -5830,7 +5830,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -5849,7 +5849,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -5866,7 +5866,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "assert_matches", "frame-benchmarking", @@ -5883,7 +5883,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -5928,7 +5928,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5951,7 +5951,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5964,7 +5964,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -5982,7 +5982,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6000,7 +6000,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6023,7 +6023,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "enumflags2", "frame-benchmarking", @@ -6039,7 +6039,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6059,7 +6059,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6092,7 +6092,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6109,7 +6109,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6126,7 +6126,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6142,7 +6142,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6158,7 +6158,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -6175,7 +6175,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6195,7 +6195,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -6206,7 +6206,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -6223,7 +6223,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6247,7 +6247,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6264,7 +6264,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6279,7 +6279,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6297,7 +6297,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6312,7 +6312,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6331,7 +6331,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6348,7 +6348,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -6369,7 +6369,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6385,7 +6385,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -6399,7 +6399,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6422,7 +6422,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6433,7 +6433,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "log", "sp-arithmetic", @@ -6442,7 +6442,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "sp-api", @@ -6451,7 +6451,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6468,7 +6468,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -6482,7 +6482,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6500,7 +6500,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6519,7 +6519,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-support", "frame-system", @@ -6535,7 +6535,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -6551,7 +6551,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6563,7 +6563,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6580,7 +6580,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6596,7 +6596,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6629,7 +6629,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6643,8 +6643,8 @@ dependencies = [ [[package]] name = "pallet-xcm" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -6664,8 +6664,8 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "frame-benchmarking", "frame-support", @@ -6684,7 +6684,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.40#e05c8d7f71734ed71188337c6cb0d30715f6320f" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -7086,8 +7086,8 @@ checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" [[package]] name = "polkadot-approval-distribution" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "futures", "polkadot-node-metrics", @@ -7101,8 +7101,8 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -7115,8 +7115,8 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "derive_more", "fatality", @@ -7138,8 +7138,8 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "fatality", "futures", @@ -7159,8 +7159,8 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "clap", "frame-benchmarking-cli", @@ -7187,8 +7187,8 @@ dependencies = [ [[package]] name = "polkadot-client" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "async-trait", "frame-benchmarking", @@ -7229,8 +7229,8 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "always-assert", "bitvec", @@ -7251,8 +7251,8 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "parity-scale-codec", "scale-info", @@ -7263,8 +7263,8 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "derive_more", "fatality", @@ -7288,8 +7288,8 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -7302,8 +7302,8 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "futures", "futures-timer", @@ -7322,8 +7322,8 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "always-assert", "async-trait", @@ -7345,8 +7345,8 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "futures", "parity-scale-codec", @@ -7363,8 +7363,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bitvec", "derive_more", @@ -7392,8 +7392,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bitvec", "futures", @@ -7413,8 +7413,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bitvec", "fatality", @@ -7432,8 +7432,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "futures", "polkadot-node-subsystem", @@ -7447,8 +7447,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "async-trait", "futures", @@ -7467,8 +7467,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "futures", "polkadot-node-metrics", @@ -7482,8 +7482,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "futures", "futures-timer", @@ -7499,8 +7499,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "fatality", "futures", @@ -7518,8 +7518,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "async-trait", "futures", @@ -7535,8 +7535,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bitvec", "fatality", @@ -7553,8 +7553,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "always-assert", "assert_matches", @@ -7581,6 +7581,7 @@ dependencies = [ "sp-maybe-compressed-blob", "sp-tracing", "sp-wasm-interface", + "substrate-build-script-utils", "tempfile", "tikv-jemalloc-ctl", "tokio", @@ -7589,8 +7590,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "futures", "polkadot-node-primitives", @@ -7605,8 +7606,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "futures", "lru 0.9.0", @@ -7620,8 +7621,8 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "lazy_static", "log", @@ -7638,8 +7639,8 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bs58", "futures", @@ -7657,8 +7658,8 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "async-trait", "derive_more", @@ -7679,8 +7680,8 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bounded-vec", "futures", @@ -7702,8 +7703,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -7712,8 +7713,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "async-trait", "derive_more", @@ -7735,8 +7736,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "async-trait", "derive_more", @@ -7768,8 +7769,8 @@ dependencies = [ [[package]] name = "polkadot-overseer" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "async-trait", "futures", @@ -7791,8 +7792,8 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bounded-collections", "derive_more", @@ -7808,8 +7809,8 @@ dependencies = [ [[package]] name = "polkadot-performance-test" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "env_logger 0.9.3", "kusama-runtime", @@ -7824,8 +7825,8 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bitvec", "hex-literal", @@ -7850,8 +7851,8 @@ dependencies = [ [[package]] name = "polkadot-rpc" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "jsonrpsee", "mmr-rpc", @@ -7882,8 +7883,8 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bitvec", "frame-benchmarking", @@ -7972,8 +7973,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bitvec", "frame-benchmarking", @@ -8018,8 +8019,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "frame-support", "polkadot-primitives", @@ -8032,8 +8033,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bs58", "parity-scale-codec", @@ -8044,8 +8045,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bitflags", "bitvec", @@ -8088,8 +8089,8 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "async-trait", "frame-benchmarking-cli", @@ -8197,8 +8198,8 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -8218,8 +8219,8 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -8338,11 +8339,10 @@ dependencies = [ [[package]] name = "prioritized-metered-channel" -version = "0.4.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3caef72a78ca8e77cbdfa87dd516ebb79d4cbe5b42e3b8435b463a8261339ff" +checksum = "382698e48a268c832d0b181ed438374a6bb708a82a8ca273bb0f61c74cf209c4" dependencies = [ - "async-channel", "coarsetime", "crossbeam-queue", "derive_more", @@ -8886,8 +8886,8 @@ dependencies = [ [[package]] name = "rococo-runtime" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "binary-merkle-tree", "frame-benchmarking", @@ -8972,8 +8972,8 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "frame-support", "polkadot-primitives", @@ -9236,7 +9236,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "log", "sp-core", @@ -9247,7 +9247,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "futures", @@ -9275,7 +9275,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "futures", "futures-timer", @@ -9298,7 +9298,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -9313,7 +9313,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -9332,7 +9332,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9343,7 +9343,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -9383,7 +9383,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "fnv", "futures", @@ -9409,7 +9409,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "hash-db", "kvdb", @@ -9435,7 +9435,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "futures", @@ -9460,7 +9460,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "futures", @@ -9489,7 +9489,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "fork-tree", @@ -9528,7 +9528,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "futures", "jsonrpsee", @@ -9550,7 +9550,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -9585,7 +9585,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "futures", "jsonrpsee", @@ -9604,7 +9604,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "fork-tree", "parity-scale-codec", @@ -9617,7 +9617,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "ahash 0.8.3", "array-bytes 4.2.0", @@ -9657,7 +9657,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "finality-grandpa", "futures", @@ -9677,7 +9677,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "futures", @@ -9700,7 +9700,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "lru 0.8.1", "parity-scale-codec", @@ -9724,7 +9724,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -9737,7 +9737,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "log", "sc-allocator", @@ -9750,7 +9750,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "anyhow", "cfg-if", @@ -9768,7 +9768,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "ansi_term", "futures", @@ -9784,7 +9784,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -9799,7 +9799,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -9843,7 +9843,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "cid", "futures", @@ -9863,7 +9863,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -9891,7 +9891,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "ahash 0.8.3", "futures", @@ -9910,7 +9910,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "futures", @@ -9932,7 +9932,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -9966,7 +9966,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "futures", @@ -9986,7 +9986,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -10017,7 +10017,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "futures", "libp2p", @@ -10030,7 +10030,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -10039,7 +10039,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "futures", "jsonrpsee", @@ -10069,7 +10069,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10088,7 +10088,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "http", "jsonrpsee", @@ -10103,7 +10103,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10129,7 +10129,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "directories", @@ -10195,7 +10195,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "log", "parity-scale-codec", @@ -10206,7 +10206,7 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "clap", "fs4", @@ -10222,7 +10222,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10241,7 +10241,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "futures", "libc", @@ -10260,7 +10260,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "chrono", "futures", @@ -10279,7 +10279,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "ansi_term", "atty", @@ -10310,7 +10310,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10321,7 +10321,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "futures", @@ -10348,7 +10348,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "futures", @@ -10362,7 +10362,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-channel", "futures", @@ -10741,8 +10741,8 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "slot-range-helper" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "enumn", "parity-scale-codec", @@ -10819,7 +10819,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "hash-db", "log", @@ -10837,7 +10837,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "Inflector", "blake2", @@ -10851,7 +10851,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "scale-info", @@ -10864,7 +10864,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "integer-sqrt", "num-traits", @@ -10878,7 +10878,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "scale-info", @@ -10891,7 +10891,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "sp-api", @@ -10903,7 +10903,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "futures", "log", @@ -10921,7 +10921,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "futures", @@ -10936,7 +10936,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "parity-scale-codec", @@ -10954,7 +10954,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "merlin", @@ -10977,7 +10977,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "lazy_static", "parity-scale-codec", @@ -10996,7 +10996,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "finality-grandpa", "log", @@ -11014,7 +11014,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "scale-info", @@ -11026,7 +11026,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "scale-info", @@ -11039,7 +11039,7 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "array-bytes 4.2.0", "base58", @@ -11082,7 +11082,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "blake2b_simd", "byteorder", @@ -11096,7 +11096,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "proc-macro2", "quote", @@ -11107,7 +11107,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -11116,7 +11116,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "proc-macro2", "quote", @@ -11126,7 +11126,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "environmental", "parity-scale-codec", @@ -11137,7 +11137,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11152,7 +11152,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "bytes", "ed25519", @@ -11177,7 +11177,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "lazy_static", "sp-core", @@ -11188,7 +11188,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "futures", @@ -11205,7 +11205,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "thiserror", "zstd", @@ -11214,7 +11214,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -11232,7 +11232,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "scale-info", @@ -11246,7 +11246,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "sp-api", "sp-core", @@ -11256,7 +11256,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "backtrace", "lazy_static", @@ -11266,7 +11266,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "rustc-hash", "serde", @@ -11276,7 +11276,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "either", "hash256-std-hasher", @@ -11298,7 +11298,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -11316,7 +11316,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "Inflector", "proc-macro-crate", @@ -11328,7 +11328,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "scale-info", @@ -11342,7 +11342,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "scale-info", @@ -11354,7 +11354,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "hash-db", "log", @@ -11374,12 +11374,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11392,7 +11392,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "futures-timer", @@ -11407,7 +11407,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "sp-std", @@ -11419,7 +11419,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "sp-api", "sp-runtime", @@ -11428,7 +11428,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "log", @@ -11444,7 +11444,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "ahash 0.8.3", "hash-db", @@ -11467,7 +11467,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11484,7 +11484,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -11495,7 +11495,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -11509,7 +11509,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "parity-scale-codec", "scale-info", @@ -11758,7 +11758,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "platforms 2.0.0", ] @@ -11766,7 +11766,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -11785,7 +11785,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "hyper", "log", @@ -11797,7 +11797,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "jsonrpsee", @@ -11810,7 +11810,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "jsonrpsee", "log", @@ -11829,7 +11829,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "ansi_term", "build-helper", @@ -12306,8 +12306,8 @@ dependencies = [ [[package]] name = "tracing-gum" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -12317,8 +12317,8 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "expander 0.0.6", "proc-macro-crate", @@ -12448,7 +12448,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.40#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" dependencies = [ "async-trait", "clap", @@ -13321,8 +13321,8 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bitvec", "frame-benchmarking", @@ -13413,8 +13413,8 @@ dependencies = [ [[package]] name = "westend-runtime-constants" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "frame-support", "polkadot-primitives", @@ -13770,8 +13770,8 @@ dependencies = [ [[package]] name = "xcm" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "bounded-collections", "derivative", @@ -13786,8 +13786,8 @@ dependencies = [ [[package]] name = "xcm-builder" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "frame-support", "frame-system", @@ -13807,8 +13807,8 @@ dependencies = [ [[package]] name = "xcm-executor" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "environmental", "frame-benchmarking", @@ -13827,8 +13827,8 @@ dependencies = [ [[package]] name = "xcm-procedural" -version = "0.9.40" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.40#95fe4c8862810bffd68343231a517e62689c05c0" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" dependencies = [ "Inflector", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index bc6df078a7..5ab18c8c01 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ panic = "unwind" [workspace.dependencies] # Build deps -substrate-wasm-builder = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +substrate-wasm-builder = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} # External (without extra features and with default disabled if necessary) base58 = {version = "0.2.0", default-features = false} @@ -71,112 +71,112 @@ peregrine-runtime = {path = "runtimes/peregrine", default-features = false} spiritnet-runtime = {path = "runtimes/spiritnet", default-features = false} # Benchmarking (with default disabled) -cumulus-pallet-session-benchmarking = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} -frame-system-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +cumulus-pallet-session-benchmarking = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +frame-system-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} # Cumulus (with default disabled) -cumulus-pallet-aura-ext = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} -cumulus-pallet-dmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} -cumulus-pallet-parachain-system = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} -cumulus-pallet-xcm = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} -cumulus-pallet-xcmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} -cumulus-primitives-core = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} -cumulus-primitives-timestamp = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} -cumulus-primitives-utility = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} -pallet-collator-selection = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} -parachain-info = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.40"} +cumulus-pallet-aura-ext = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +cumulus-pallet-dmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +cumulus-pallet-parachain-system = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +cumulus-pallet-xcm = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +cumulus-pallet-xcmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +cumulus-primitives-core = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +cumulus-primitives-timestamp = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +cumulus-primitives-utility = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +pallet-collator-selection = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +parachain-info = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} # Substrate (with default disabled) -frame-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -frame-executive = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -frame-support = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -frame-system = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -frame-system-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -frame-try-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-authorship = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-balances = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-collective = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-democracy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-grandpa = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-indices = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-membership = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-preimage = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-proxy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-scheduler = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-sudo = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-timestamp = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-tips = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-transaction-payment-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-treasury = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-utility = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-vesting = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -pallet-multisig = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-block-builder = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-consensus-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-inherents = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-io = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-offchain = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-staking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-std = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-transaction-pool = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-version = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -sp-weights = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} -try-runtime-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} +frame-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +frame-executive = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +frame-support = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +frame-system = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +frame-system-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +frame-try-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-authorship = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-balances = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-collective = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-democracy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-grandpa = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-indices = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-membership = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-preimage = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-proxy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-scheduler = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-sudo = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-timestamp = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-tips = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-transaction-payment-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-treasury = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-utility = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-vesting = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +pallet-multisig = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-block-builder = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-consensus-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-inherents = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-io = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-offchain = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-staking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-std = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-transaction-pool = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-version = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +sp-weights = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +try-runtime-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} # Polkadot (with default disabled) -pallet-xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"} -polkadot-parachain = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"} -xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"} -xcm-builder = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"} -xcm-executor = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"} +pallet-xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41"} +polkadot-parachain = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41"} +xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41"} +xcm-builder = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41"} +xcm-executor = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41"} # Client-only (with default enabled) -cumulus-client-cli = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} -cumulus-client-consensus-aura = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} -cumulus-client-consensus-common = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} -cumulus-client-network = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} -cumulus-client-service = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} -cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} -cumulus-relay-chain-inprocess-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} -cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} -cumulus-relay-chain-minimal-node = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} -cumulus-relay-chain-rpc-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40"} -pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -polkadot-cli = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40"} -polkadot-primitives = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40"} -polkadot-service = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40"} -sc-basic-authorship = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-chain-spec = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-client-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-network-sync = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-rpc-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-sysinfo = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-telemetry = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-tracing = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sp-blockchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sp-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sp-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sp-keyring = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sp-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -sp-timestamp = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -substrate-build-script-utils = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -substrate-frame-rpc-system = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} -substrate-prometheus-endpoint = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"} +cumulus-client-cli = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} +cumulus-client-consensus-aura = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} +cumulus-client-consensus-common = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} +cumulus-client-network = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} +cumulus-client-service = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} +cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} +cumulus-relay-chain-inprocess-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} +cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} +cumulus-relay-chain-minimal-node = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} +cumulus-relay-chain-rpc-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} +pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +polkadot-cli = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.41"} +polkadot-primitives = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.41"} +polkadot-service = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.41"} +sc-basic-authorship = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-chain-spec = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-client-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-network-sync = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-rpc-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-sysinfo = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-telemetry = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-tracing = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sp-blockchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sp-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sp-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sp-keyring = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sp-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +sp-timestamp = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +substrate-build-script-utils = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +substrate-frame-rpc-system = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +substrate-prometheus-endpoint = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} From d461d2eb96282b3607018743558fc9badcb2fb25 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 9 May 2023 14:57:30 +0200 Subject: [PATCH 06/99] intermediate state --- Cargo.lock | 1139 +++++++++++------- Cargo.toml | 204 ++-- runtime-api/did/src/lib.rs | 4 +- runtimes/common/src/xcm_config.rs | 8 +- runtimes/peregrine/src/lib.rs | 2 + runtimes/peregrine/src/weights/pallet_xcm.rs | 3 + runtimes/peregrine/src/xcm_config.rs | 2 + runtimes/spiritnet/src/xcm_config.rs | 2 + runtimes/standalone/src/lib.rs | 10 + 9 files changed, 833 insertions(+), 541 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 58706aaa6e..003a374dac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -431,6 +431,17 @@ dependencies = [ "event-listener", ] +[[package]] +name = "async-recursion" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "async-trait" version = "0.1.68" @@ -526,6 +537,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base58" version = "0.2.0" @@ -562,7 +579,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "hash-db", "log", @@ -1346,6 +1363,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "crypto-bigint" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1417,7 +1446,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "clap", "parity-scale-codec", @@ -1432,7 +1461,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1455,7 +1484,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1484,7 +1513,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1508,7 +1537,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1531,7 +1560,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1555,7 +1584,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1590,7 +1619,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "frame-support", "frame-system", @@ -1606,7 +1635,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1623,7 +1652,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1652,18 +1681,18 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "frame-benchmarking", "frame-support", @@ -1677,7 +1706,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1693,7 +1722,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1714,12 +1743,13 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", "polkadot-parachain", "polkadot-primitives", + "scale-info", "sp-api", "sp-runtime", "sp-std", @@ -1730,7 +1760,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1753,7 +1783,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "cumulus-primitives-core", "futures", @@ -1766,7 +1796,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1784,7 +1814,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1809,7 +1839,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1827,7 +1857,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -1836,13 +1866,16 @@ dependencies = [ "cumulus-relay-chain-rpc-interface", "futures", "lru 0.9.0", + "polkadot-availability-recovery", + "polkadot-collator-protocol", "polkadot-core-primitives", "polkadot-network-bridge", + "polkadot-node-collation-generation", + "polkadot-node-core-runtime-api", "polkadot-node-network-protocol", "polkadot-node-subsystem-util", "polkadot-overseer", "polkadot-primitives", - "polkadot-service", "sc-authority-discovery", "sc-client-api", "sc-network", @@ -1862,7 +1895,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1892,7 +1925,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2081,6 +2114,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e58dffcdcc8ee7b22f0c1f71a69243d7c2d9ad87b5a14361f2424a1565c219" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "der-parser" version = "7.0.0" @@ -2227,6 +2270,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle", ] @@ -2334,10 +2378,23 @@ version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 1.6.4", +] + +[[package]] +name = "ecdsa" +version = "0.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a48e5d537b8a30c0b023116d981b16334be1485af7ca68db3a2b7024cbc957fd" +dependencies = [ + "der 0.7.5", + "digest 0.10.6", + "elliptic-curve 0.13.4", + "rfc6979 0.4.0", + "signature 2.1.0", ] [[package]] @@ -2346,7 +2403,7 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ - "signature", + "signature 1.6.4", ] [[package]] @@ -2389,18 +2446,37 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ - "base16ct", - "crypto-bigint", - "der", + "base16ct 0.1.1", + "crypto-bigint 0.4.9", + "der 0.6.1", "digest 0.10.6", - "ff", + "ff 0.12.1", "generic-array 0.14.7", - "group", + "group 0.12.1", "hkdf", "pem-rfc7468", - "pkcs8", + "pkcs8 0.9.0", + "rand_core 0.6.4", + "sec1 0.3.0", + "subtle", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75c71eaa367f2e5d556414a8eea812bc62985c879748d6403edabd9cb03f16e7" +dependencies = [ + "base16ct 0.2.0", + "crypto-bigint 0.5.2", + "digest 0.10.6", + "ff 0.13.0", + "generic-array 0.14.7", + "group 0.13.0", + "pkcs8 0.10.2", "rand_core 0.6.4", - "sec1", + "sec1 0.7.2", "subtle", "zeroize", ] @@ -2538,7 +2614,6 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 1.0.109", ] [[package]] @@ -2554,6 +2629,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "expander" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f86a749cf851891866c10515ef6c299b5c69661465e9c3bbe7e07a2b77fb0f7" +dependencies = [ + "blake2", + "fs-err", + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -2619,6 +2707,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "fiat-crypto" version = "0.1.20" @@ -2710,7 +2808,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", ] @@ -2733,7 +2831,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-support-procedural", @@ -2758,7 +2856,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -2805,18 +2903,18 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2833,7 +2931,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -2862,9 +2960,11 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ + "async-recursion", "futures", + "jsonrpsee", "log", "parity-scale-codec", "serde", @@ -2878,7 +2978,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "bitflags", "environmental", @@ -2911,44 +3011,45 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "Inflector", "cfg-expr", "derive-syn-parse", "frame-support-procedural-tools", "itertools", + "proc-macro-warning", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "log", @@ -2966,7 +3067,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -2981,7 +3082,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "sp-api", @@ -2990,7 +3091,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "parity-scale-codec", @@ -3179,6 +3280,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -3275,7 +3377,18 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ - "ff", + "ff 0.12.1", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff 0.13.0", "rand_core 0.6.4", "subtle", ] @@ -3388,6 +3501,12 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + [[package]] name = "hkdf" version = "0.12.3" @@ -3531,6 +3650,7 @@ dependencies = [ "rustls-native-certs", "tokio", "tokio-rustls", + "webpki-roots", ] [[package]] @@ -3792,6 +3912,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" dependencies = [ "jsonrpsee-core", + "jsonrpsee-http-client", "jsonrpsee-proc-macros", "jsonrpsee-server", "jsonrpsee-types", @@ -3848,6 +3969,25 @@ dependencies = [ "tracing", ] +[[package]] +name = "jsonrpsee-http-client" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +dependencies = [ + "async-trait", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "jsonrpsee-proc-macros" version = "0.16.2" @@ -3911,13 +4051,14 @@ dependencies = [ [[package]] name = "k256" -version = "0.11.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", - "ecdsa", - "elliptic-curve", + "ecdsa 0.16.6", + "elliptic-curve 0.13.4", + "once_cell", "sha2 0.10.6", ] @@ -3937,7 +4078,7 @@ dependencies = [ "base58", "frame-support", "hex", - "hex-literal", + "hex-literal 0.3.4", "log", "parity-scale-codec", "scale-info", @@ -3962,7 +4103,7 @@ dependencies = [ "cumulus-relay-chain-minimal-node", "frame-benchmarking", "frame-benchmarking-cli", - "hex-literal", + "hex-literal 0.3.4", "jsonrpsee", "log", "pallet-transaction-payment-rpc", @@ -4057,8 +4198,8 @@ dependencies = [ [[package]] name = "kusama-runtime" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bitvec", "frame-benchmarking", @@ -4069,7 +4210,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "kusama-runtime-constants", "log", "pallet-authority-discovery", @@ -4155,8 +4296,8 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "frame-support", "polkadot-primitives", @@ -4188,9 +4329,9 @@ dependencies = [ [[package]] name = "kvdb-rocksdb" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2182b8219fee6bd83aacaab7344e840179ae079d5216aa4e249b4d704646a844" +checksum = "fe7a749456510c45f795e8b04a6a3e0976d0139213ecbf465843830ad55e2217" dependencies = [ "kvdb", "num_cpus", @@ -4299,7 +4440,7 @@ dependencies = [ "prost-build", "rand 0.8.5", "rw-stream-sink", - "sec1", + "sec1 0.3.0", "sha2 0.10.6", "smallvec", "thiserror", @@ -4695,9 +4836,9 @@ dependencies = [ [[package]] name = "librocksdb-sys" -version = "0.8.3+7.4.4" +version = "0.10.0+7.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "557b255ff04123fcc176162f56ed0c9cd42d8f357cf55b3fabeb60f7413741b3" +checksum = "0fe4d5874f5ff2bc616e55e8c6086d478fcda13faf9495768a4aa1c22042d30b" dependencies = [ "bindgen", "bzip2-sys", @@ -4896,7 +5037,7 @@ dependencies = [ "frame-benchmarking-cli", "frame-system", "futures", - "hex-literal", + "hex-literal 0.3.4", "jsonrpsee", "mashnet-node-runtime", "pallet-transaction-payment", @@ -4946,7 +5087,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.3.4", "kilt-runtime-api-did", "kilt-runtime-api-public-credentials", "kilt-support", @@ -5143,7 +5284,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "futures", "log", @@ -5162,7 +5303,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "anyhow", "jsonrpsee", @@ -5635,8 +5776,8 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" dependencies = [ - "ecdsa", - "elliptic-curve", + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", "sha2 0.10.6", ] @@ -5646,8 +5787,8 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" dependencies = [ - "ecdsa", - "elliptic-curve", + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", "sha2 0.10.6", ] @@ -5664,7 +5805,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -5680,7 +5821,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -5696,7 +5837,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -5710,7 +5851,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5723,7 +5864,7 @@ dependencies = [ "scale-info", "sp-application-crypto", "sp-consensus-babe", - "sp-consensus-vrf", + "sp-core", "sp-io", "sp-runtime", "sp-session", @@ -5734,7 +5875,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5754,7 +5895,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5769,7 +5910,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -5788,7 +5929,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "binary-merkle-tree", @@ -5812,7 +5953,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5830,7 +5971,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5849,7 +5990,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5866,7 +6007,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "assert_matches", "frame-benchmarking", @@ -5883,7 +6024,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5928,7 +6069,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5951,7 +6092,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5964,7 +6105,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5982,7 +6123,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6000,7 +6141,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6023,7 +6164,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "enumflags2", "frame-benchmarking", @@ -6039,7 +6180,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6059,7 +6200,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6092,7 +6233,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6109,7 +6250,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6126,7 +6267,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6142,7 +6283,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6158,7 +6299,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -6175,7 +6316,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6195,7 +6336,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -6206,7 +6347,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -6223,7 +6364,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6247,7 +6388,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6264,7 +6405,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6279,7 +6420,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6297,7 +6438,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6312,7 +6453,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6331,7 +6472,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6348,7 +6489,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -6369,7 +6510,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6385,7 +6526,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -6399,7 +6540,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6422,18 +6563,18 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "log", "sp-arithmetic", @@ -6442,7 +6583,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "sp-api", @@ -6451,7 +6592,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6468,7 +6609,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -6482,7 +6623,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6500,7 +6641,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6519,7 +6660,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-support", "frame-system", @@ -6535,7 +6676,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -6551,7 +6692,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6563,7 +6704,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6580,7 +6721,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6596,7 +6737,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6629,7 +6770,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-benchmarking", "frame-support", @@ -6643,8 +6784,8 @@ dependencies = [ [[package]] name = "pallet-xcm" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -6664,8 +6805,8 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "frame-benchmarking", "frame-support", @@ -6684,7 +6825,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.41#ae4e75b077c220bdf29b299b36a63b87ccb46b4c" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#48cc5ab56fd2662554bee24635bac96bcd42c68e" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -6909,7 +7050,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.3.4", "kilt-runtime-api-did", "kilt-runtime-api-public-credentials", "kilt-runtime-api-staking", @@ -7062,8 +7203,18 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ - "der", - "spki", + "der 0.6.1", + "spki 0.6.0", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der 0.7.5", + "spki 0.7.2", ] [[package]] @@ -7086,10 +7237,11 @@ checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" [[package]] name = "polkadot-approval-distribution" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "futures", + "polkadot-node-jaeger", "polkadot-node-metrics", "polkadot-node-network-protocol", "polkadot-node-primitives", @@ -7101,8 +7253,8 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -7115,8 +7267,8 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "derive_more", "fatality", @@ -7138,8 +7290,8 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "fatality", "futures", @@ -7159,15 +7311,15 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "clap", "frame-benchmarking-cli", "futures", "log", "polkadot-client", - "polkadot-node-core-pvf", + "polkadot-node-core-pvf-worker", "polkadot-node-metrics", "polkadot-performance-test", "polkadot-service", @@ -7180,6 +7332,7 @@ dependencies = [ "sp-core", "sp-io", "sp-keyring", + "sp-maybe-compressed-blob", "substrate-build-script-utils", "thiserror", "try-runtime-cli", @@ -7187,8 +7340,8 @@ dependencies = [ [[package]] name = "polkadot-client" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "async-trait", "frame-benchmarking", @@ -7229,8 +7382,8 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "always-assert", "bitvec", @@ -7251,8 +7404,8 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "parity-scale-codec", "scale-info", @@ -7263,8 +7416,8 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "derive_more", "fatality", @@ -7288,8 +7441,8 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -7302,8 +7455,8 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "futures", "futures-timer", @@ -7322,8 +7475,8 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "always-assert", "async-trait", @@ -7345,8 +7498,8 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "futures", "parity-scale-codec", @@ -7363,8 +7516,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bitvec", "derive_more", @@ -7392,8 +7545,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bitvec", "futures", @@ -7413,8 +7566,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bitvec", "fatality", @@ -7432,8 +7585,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "futures", "polkadot-node-subsystem", @@ -7447,8 +7600,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "async-trait", "futures", @@ -7467,8 +7620,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "futures", "polkadot-node-metrics", @@ -7482,8 +7635,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "futures", "futures-timer", @@ -7499,8 +7652,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "fatality", "futures", @@ -7518,8 +7671,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "async-trait", "futures", @@ -7535,8 +7688,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bitvec", "fatality", @@ -7553,12 +7706,10 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "always-assert", - "assert_matches", - "cpu-time", "futures", "futures-timer", "libc", @@ -7570,28 +7721,20 @@ dependencies = [ "polkadot-parachain", "polkadot-primitives", "rand 0.8.5", - "rayon", - "sc-executor", - "sc-executor-common", - "sc-executor-wasmtime", "slotmap", "sp-core", - "sp-externalities", - "sp-io", "sp-maybe-compressed-blob", "sp-tracing", "sp-wasm-interface", "substrate-build-script-utils", - "tempfile", - "tikv-jemalloc-ctl", "tokio", "tracing-gum", ] [[package]] name = "polkadot-node-core-pvf-checker" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "futures", "polkadot-node-primitives", @@ -7604,10 +7747,39 @@ dependencies = [ "tracing-gum", ] +[[package]] +name = "polkadot-node-core-pvf-worker" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" +dependencies = [ + "assert_matches", + "cpu-time", + "futures", + "libc", + "parity-scale-codec", + "polkadot-node-core-pvf", + "polkadot-parachain", + "polkadot-primitives", + "rayon", + "sc-executor", + "sc-executor-common", + "sc-executor-wasmtime", + "sp-core", + "sp-externalities", + "sp-io", + "sp-maybe-compressed-blob", + "sp-tracing", + "substrate-build-script-utils", + "tempfile", + "tikv-jemalloc-ctl", + "tokio", + "tracing-gum", +] + [[package]] name = "polkadot-node-core-runtime-api" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "futures", "lru 0.9.0", @@ -7621,8 +7793,8 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "lazy_static", "log", @@ -7639,8 +7811,8 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bs58", "futures", @@ -7658,8 +7830,8 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "async-trait", "derive_more", @@ -7680,8 +7852,8 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bounded-vec", "futures", @@ -7692,19 +7864,18 @@ dependencies = [ "serde", "sp-application-crypto", "sp-consensus-babe", - "sp-consensus-vrf", "sp-core", "sp-keystore", "sp-maybe-compressed-blob", "sp-runtime", "thiserror", - "zstd", + "zstd 0.11.2+zstd.1.5.2", ] [[package]] name = "polkadot-node-subsystem" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -7713,8 +7884,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "async-trait", "derive_more", @@ -7736,8 +7907,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "async-trait", "derive_more", @@ -7769,8 +7940,8 @@ dependencies = [ [[package]] name = "polkadot-overseer" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "async-trait", "futures", @@ -7792,8 +7963,8 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bounded-collections", "derive_more", @@ -7809,27 +7980,29 @@ dependencies = [ [[package]] name = "polkadot-performance-test" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "env_logger 0.9.3", "kusama-runtime", "log", "polkadot-erasure-coding", - "polkadot-node-core-pvf", + "polkadot-node-core-pvf-worker", "polkadot-node-primitives", "polkadot-primitives", "quote", + "sc-executor-common", + "sp-maybe-compressed-blob", "thiserror", ] [[package]] name = "polkadot-primitives" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bitvec", - "hex-literal", + "hex-literal 0.4.1", "parity-scale-codec", "polkadot-core-primitives", "polkadot-parachain", @@ -7851,8 +8024,8 @@ dependencies = [ [[package]] name = "polkadot-rpc" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "jsonrpsee", "mmr-rpc", @@ -7883,8 +8056,8 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bitvec", "frame-benchmarking", @@ -7895,7 +8068,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-authority-discovery", "pallet-authorship", @@ -7905,6 +8078,7 @@ dependencies = [ "pallet-bounties", "pallet-child-bounties", "pallet-collective", + "pallet-conviction-voting", "pallet-democracy", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", @@ -7923,6 +8097,7 @@ dependencies = [ "pallet-offences-benchmarking", "pallet-preimage", "pallet-proxy", + "pallet-referenda", "pallet-scheduler", "pallet-session", "pallet-session-benchmarking", @@ -7936,6 +8111,7 @@ dependencies = [ "pallet-treasury", "pallet-utility", "pallet-vesting", + "pallet-whitelist", "pallet-xcm", "parity-scale-codec", "polkadot-primitives", @@ -7948,6 +8124,7 @@ dependencies = [ "serde_derive", "smallvec", "sp-api", + "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-babe", @@ -7973,8 +8150,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bitvec", "frame-benchmarking", @@ -8019,8 +8196,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "frame-support", "polkadot-primitives", @@ -8033,8 +8210,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bs58", "parity-scale-codec", @@ -8045,8 +8222,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bitflags", "bitvec", @@ -8089,15 +8266,15 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "async-trait", "frame-benchmarking-cli", "frame-support", "frame-system-rpc-runtime-api", "futures", - "hex-literal", + "hex-literal 0.4.1", "kusama-runtime", "kvdb", "kvdb-rocksdb", @@ -8198,8 +8375,8 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -8219,8 +8396,8 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -8387,6 +8564,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-warning" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e99670bafb56b9a106419397343bdbc8b8742c3cc449fec6345f86173f47cd4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "proc-macro2" version = "1.0.56" @@ -8854,11 +9042,21 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ - "crypto-bigint", + "crypto-bigint 0.4.9", "hmac 0.12.1", "zeroize", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle", +] + [[package]] name = "ring" version = "0.16.20" @@ -8876,9 +9074,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9562ea1d70c0cc63a34a22d977753b50cca91cc6b6527750463bd5dd8697bc" +checksum = "015439787fce1e75d55f279078d33ff14b4af5d93d995e8838ee4631301c8a99" dependencies = [ "libc", "librocksdb-sys", @@ -8886,8 +9084,8 @@ dependencies = [ [[package]] name = "rococo-runtime" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "binary-merkle-tree", "frame-benchmarking", @@ -8897,7 +9095,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-authority-discovery", "pallet-authorship", @@ -8972,8 +9170,8 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "frame-support", "polkadot-primitives", @@ -9236,7 +9434,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "log", "sp-core", @@ -9247,7 +9445,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "futures", @@ -9275,7 +9473,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "futures", "futures-timer", @@ -9298,7 +9496,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -9313,7 +9511,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -9332,18 +9530,18 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -9383,7 +9581,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "fnv", "futures", @@ -9409,7 +9607,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "hash-db", "kvdb", @@ -9435,7 +9633,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "futures", @@ -9460,7 +9658,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "futures", @@ -9489,13 +9687,12 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "fork-tree", "futures", "log", - "merlin", "num-bigint", "num-rational", "num-traits", @@ -9508,7 +9705,6 @@ dependencies = [ "sc-keystore", "sc-telemetry", "scale-info", - "schnorrkel", "sp-api", "sp-application-crypto", "sp-block-builder", @@ -9516,7 +9712,6 @@ dependencies = [ "sp-consensus", "sp-consensus-babe", "sp-consensus-slots", - "sp-consensus-vrf", "sp-core", "sp-inherents", "sp-keystore", @@ -9528,7 +9723,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "futures", "jsonrpsee", @@ -9550,7 +9745,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -9585,7 +9780,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "futures", "jsonrpsee", @@ -9604,7 +9799,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "fork-tree", "parity-scale-codec", @@ -9617,7 +9812,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "ahash 0.8.3", "array-bytes 4.2.0", @@ -9657,7 +9852,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "finality-grandpa", "futures", @@ -9677,7 +9872,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "futures", @@ -9700,7 +9895,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "lru 0.8.1", "parity-scale-codec", @@ -9724,7 +9919,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -9737,7 +9932,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "log", "sc-allocator", @@ -9750,7 +9945,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "anyhow", "cfg-if", @@ -9768,7 +9963,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "ansi_term", "futures", @@ -9784,7 +9979,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -9799,7 +9994,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -9829,6 +10024,7 @@ dependencies = [ "serde", "serde_json", "smallvec", + "snow", "sp-arithmetic", "sp-blockchain", "sp-consensus", @@ -9843,7 +10039,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "cid", "futures", @@ -9863,7 +10059,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -9891,7 +10087,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "ahash 0.8.3", "futures", @@ -9910,7 +10106,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "futures", @@ -9932,7 +10128,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -9966,7 +10162,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "futures", @@ -9986,7 +10182,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -10017,7 +10213,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "futures", "libp2p", @@ -10030,7 +10226,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -10039,7 +10235,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "futures", "jsonrpsee", @@ -10069,7 +10265,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10088,7 +10284,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "http", "jsonrpsee", @@ -10103,7 +10299,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10129,7 +10325,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "directories", @@ -10195,7 +10391,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "log", "parity-scale-codec", @@ -10206,7 +10402,7 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "clap", "fs4", @@ -10222,7 +10418,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10241,7 +10437,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "futures", "libc", @@ -10260,7 +10456,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "chrono", "futures", @@ -10279,7 +10475,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "ansi_term", "atty", @@ -10310,18 +10506,18 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "futures", @@ -10348,7 +10544,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "futures", @@ -10362,7 +10558,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-channel", "futures", @@ -10488,10 +10684,24 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ - "base16ct", - "der", + "base16ct 0.1.1", + "der 0.6.1", + "generic-array 0.14.7", + "pkcs8 0.9.0", + "subtle", + "zeroize", +] + +[[package]] +name = "sec1" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" +dependencies = [ + "base16ct 0.2.0", + "der 0.7.5", "generic-array 0.14.7", - "pkcs8", + "pkcs8 0.10.2", "subtle", "zeroize", ] @@ -10601,6 +10811,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + [[package]] name = "sha-1" version = "0.9.8" @@ -10705,6 +10924,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest 0.10.6", + "rand_core 0.6.4", +] + [[package]] name = "simba" version = "0.8.1" @@ -10741,8 +10970,8 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "slot-range-helper" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "enumn", "parity-scale-codec", @@ -10819,13 +11048,15 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "hash-db", "log", "parity-scale-codec", + "scale-info", "sp-api-proc-macro", "sp-core", + "sp-metadata-ir", "sp-runtime", "sp-state-machine", "sp-std", @@ -10837,7 +11068,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "Inflector", "blake2", @@ -10845,13 +11076,13 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "scale-info", @@ -10864,7 +11095,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "integer-sqrt", "num-traits", @@ -10878,7 +11109,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "scale-info", @@ -10891,7 +11122,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "sp-api", @@ -10903,7 +11134,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "futures", "log", @@ -10921,7 +11152,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "futures", @@ -10936,7 +11167,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "parity-scale-codec", @@ -10954,10 +11185,9 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", - "merlin", "parity-scale-codec", "scale-info", "serde", @@ -10965,7 +11195,6 @@ dependencies = [ "sp-application-crypto", "sp-consensus", "sp-consensus-slots", - "sp-consensus-vrf", "sp-core", "sp-inherents", "sp-keystore", @@ -10977,7 +11206,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "lazy_static", "parity-scale-codec", @@ -10996,7 +11225,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "finality-grandpa", "log", @@ -11014,7 +11243,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "scale-info", @@ -11023,29 +11252,16 @@ dependencies = [ "sp-timestamp", ] -[[package]] -name = "sp-consensus-vrf" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" -dependencies = [ - "parity-scale-codec", - "scale-info", - "schnorrkel", - "sp-core", - "sp-runtime", - "sp-std", -] - [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "array-bytes 4.2.0", - "base58", "bitflags", "blake2", "bounded-collections", + "bs58", "dyn-clonable", "ed25519-zebra", "futures", @@ -11058,6 +11274,7 @@ dependencies = [ "merlin", "parity-scale-codec", "parking_lot 0.12.1", + "paste", "primitive-types", "rand 0.8.5", "regex", @@ -11082,7 +11299,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "blake2b_simd", "byteorder", @@ -11096,18 +11313,18 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "proc-macro2", "quote", "sp-core-hashing", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -11116,17 +11333,17 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "environmental", "parity-scale-codec", @@ -11137,7 +11354,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11152,7 +11369,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "bytes", "ed25519", @@ -11161,6 +11378,7 @@ dependencies = [ "libsecp256k1", "log", "parity-scale-codec", + "rustversion", "secp256k1", "sp-core", "sp-externalities", @@ -11177,7 +11395,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "lazy_static", "sp-core", @@ -11188,14 +11406,11 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ - "async-trait", "futures", - "merlin", "parity-scale-codec", "parking_lot 0.12.1", - "schnorrkel", "serde", "sp-core", "sp-externalities", @@ -11205,16 +11420,27 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "thiserror", - "zstd", + "zstd 0.12.3+zstd.1.5.2", +] + +[[package]] +name = "sp-metadata-ir" +version = "0.1.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" +dependencies = [ + "frame-metadata", + "parity-scale-codec", + "scale-info", + "sp-std", ] [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -11232,7 +11458,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "scale-info", @@ -11246,7 +11472,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "sp-api", "sp-core", @@ -11256,7 +11482,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "backtrace", "lazy_static", @@ -11266,7 +11492,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "rustc-hash", "serde", @@ -11276,7 +11502,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "either", "hash256-std-hasher", @@ -11298,7 +11524,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -11316,19 +11542,19 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "scale-info", @@ -11342,10 +11568,11 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "scale-info", + "serde", "sp-core", "sp-runtime", "sp-std", @@ -11354,7 +11581,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "hash-db", "log", @@ -11374,12 +11601,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11392,7 +11619,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "futures-timer", @@ -11407,7 +11634,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "sp-std", @@ -11419,7 +11646,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "sp-api", "sp-runtime", @@ -11428,7 +11655,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "log", @@ -11444,11 +11671,11 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "ahash 0.8.3", "hash-db", - "hashbrown 0.12.3", + "hashbrown 0.13.2", "lazy_static", "memory-db", "nohash-hasher", @@ -11467,7 +11694,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11484,18 +11711,18 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -11509,7 +11736,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "parity-scale-codec", "scale-info", @@ -11551,7 +11778,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.3.4", "kilt-runtime-api-did", "kilt-runtime-api-public-credentials", "kilt-runtime-api-staking", @@ -11612,7 +11839,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", - "der", + "der 0.6.1", +] + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der 0.7.5", ] [[package]] @@ -11758,7 +11995,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "platforms 2.0.0", ] @@ -11766,7 +12003,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -11785,7 +12022,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "hyper", "log", @@ -11797,7 +12034,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "jsonrpsee", @@ -11810,7 +12047,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "jsonrpsee", "log", @@ -11829,7 +12066,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "ansi_term", "build-helper", @@ -11838,7 +12075,7 @@ dependencies = [ "sp-maybe-compressed-blob", "strum", "tempfile", - "toml", + "toml 0.7.3", "walkdir", "wasm-opt", ] @@ -12202,11 +12439,26 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + [[package]] name = "toml_datetime" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -12215,6 +12467,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" dependencies = [ "indexmap", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] @@ -12306,8 +12560,8 @@ dependencies = [ [[package]] name = "tracing-gum" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -12317,14 +12571,14 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ - "expander 0.0.6", + "expander 2.0.0", "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -12448,7 +12702,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.41#3bd809d59c31c7205a0f36c6ddcba603e43051fc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#bca8a29dbde0009e80c4c4737be47abff6b3e2c2" dependencies = [ "async-trait", "clap", @@ -12479,7 +12733,7 @@ dependencies = [ "sp-version", "sp-weights", "substrate-rpc-client", - "zstd", + "zstd 0.12.3+zstd.1.5.2", ] [[package]] @@ -12944,9 +13198,9 @@ dependencies = [ "rustix 0.36.13", "serde", "sha2 0.10.6", - "toml", + "toml 0.5.11", "windows-sys 0.42.0", - "zstd", + "zstd 0.11.2+zstd.1.5.2", ] [[package]] @@ -13181,7 +13435,7 @@ dependencies = [ "ccm", "curve25519-dalek 3.2.0", "der-parser 8.2.0", - "elliptic-curve", + "elliptic-curve 0.12.3", "hkdf", "hmac 0.12.1", "log", @@ -13193,11 +13447,11 @@ dependencies = [ "rcgen 0.9.3", "ring", "rustls 0.19.1", - "sec1", + "sec1 0.3.0", "serde", "sha1", "sha2 0.10.6", - "signature", + "signature 1.6.4", "subtle", "thiserror", "tokio", @@ -13321,8 +13575,8 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bitvec", "frame-benchmarking", @@ -13333,7 +13587,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-authority-discovery", "pallet-authorship", @@ -13413,8 +13667,8 @@ dependencies = [ [[package]] name = "westend-runtime-constants" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "frame-support", "polkadot-primitives", @@ -13770,8 +14024,8 @@ dependencies = [ [[package]] name = "xcm" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "bounded-collections", "derivative", @@ -13786,8 +14040,8 @@ dependencies = [ [[package]] name = "xcm-builder" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "frame-support", "frame-system", @@ -13807,8 +14061,8 @@ dependencies = [ [[package]] name = "xcm-executor" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "environmental", "frame-benchmarking", @@ -13827,13 +14081,13 @@ dependencies = [ [[package]] name = "xcm-procedural" -version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af" +version = "0.9.42" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#9b1fc27cec47f01a2c229532ee7ab79cc5bb28ef" dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -13885,7 +14139,16 @@ version = "0.11.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" dependencies = [ - "zstd-safe", + "zstd-safe 5.0.2+zstd.1.5.2", +] + +[[package]] +name = "zstd" +version = "0.12.3+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" +dependencies = [ + "zstd-safe 6.0.5+zstd.1.5.4", ] [[package]] @@ -13898,6 +14161,16 @@ dependencies = [ "zstd-sys", ] +[[package]] +name = "zstd-safe" +version = "6.0.5+zstd.1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b" +dependencies = [ + "libc", + "zstd-sys", +] + [[package]] name = "zstd-sys" version = "2.0.8+zstd.1.5.5" diff --git a/Cargo.toml b/Cargo.toml index 5ab18c8c01..8aea59266c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ panic = "unwind" [workspace.dependencies] # Build deps -substrate-wasm-builder = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +substrate-wasm-builder = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} # External (without extra features and with default disabled if necessary) base58 = {version = "0.2.0", default-features = false} @@ -71,112 +71,112 @@ peregrine-runtime = {path = "runtimes/peregrine", default-features = false} spiritnet-runtime = {path = "runtimes/spiritnet", default-features = false} # Benchmarking (with default disabled) -cumulus-pallet-session-benchmarking = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} -frame-system-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +cumulus-pallet-session-benchmarking = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} +frame-system-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} # Cumulus (with default disabled) -cumulus-pallet-aura-ext = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} -cumulus-pallet-dmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} -cumulus-pallet-parachain-system = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} -cumulus-pallet-xcm = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} -cumulus-pallet-xcmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} -cumulus-primitives-core = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} -cumulus-primitives-timestamp = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} -cumulus-primitives-utility = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} -pallet-collator-selection = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} -parachain-info = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.41"} +cumulus-pallet-aura-ext = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} +cumulus-pallet-dmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} +cumulus-pallet-parachain-system = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} +cumulus-pallet-xcm = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} +cumulus-pallet-xcmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} +cumulus-primitives-core = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} +cumulus-primitives-timestamp = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} +cumulus-primitives-utility = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} +pallet-collator-selection = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} +parachain-info = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.42"} # Substrate (with default disabled) -frame-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -frame-executive = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -frame-support = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -frame-system = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -frame-system-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -frame-try-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-authorship = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-balances = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-collective = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-democracy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-grandpa = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-indices = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-membership = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-preimage = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-proxy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-scheduler = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-sudo = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-timestamp = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-tips = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-transaction-payment-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-treasury = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-utility = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-vesting = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -pallet-multisig = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-block-builder = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-consensus-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-inherents = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-io = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-offchain = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-staking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-std = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-transaction-pool = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-version = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -sp-weights = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} -try-runtime-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41"} +frame-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +frame-executive = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +frame-support = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +frame-system = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +frame-system-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +frame-try-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-authorship = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-balances = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-collective = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-democracy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-grandpa = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-indices = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-membership = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-preimage = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-proxy = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-scheduler = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-sudo = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-timestamp = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-tips = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-transaction-payment-rpc-runtime-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-treasury = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-utility = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-vesting = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +pallet-multisig = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-api = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-block-builder = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-consensus-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-inherents = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-io = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-offchain = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-staking = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-std = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-transaction-pool = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-version = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +sp-weights = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} +try-runtime-cli = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42"} # Polkadot (with default disabled) -pallet-xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41"} -polkadot-parachain = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41"} -xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41"} -xcm-builder = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41"} -xcm-executor = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41"} +pallet-xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.42"} +polkadot-parachain = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.42"} +xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.42"} +xcm-builder = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.42"} +xcm-executor = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.42"} # Client-only (with default enabled) -cumulus-client-cli = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} -cumulus-client-consensus-aura = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} -cumulus-client-consensus-common = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} -cumulus-client-network = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} -cumulus-client-service = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} -cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} -cumulus-relay-chain-inprocess-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} -cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} -cumulus-relay-chain-minimal-node = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} -cumulus-relay-chain-rpc-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41"} -pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -polkadot-cli = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.41"} -polkadot-primitives = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.41"} -polkadot-service = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.41"} -sc-basic-authorship = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-chain-spec = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-client-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-network-sync = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-rpc-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-sysinfo = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-telemetry = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-tracing = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sp-blockchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sp-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sp-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sp-keyring = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sp-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -sp-timestamp = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -substrate-build-script-utils = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -substrate-frame-rpc-system = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} -substrate-prometheus-endpoint = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41"} +cumulus-client-cli = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42"} +cumulus-client-consensus-aura = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42"} +cumulus-client-consensus-common = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42"} +cumulus-client-network = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42"} +cumulus-client-service = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42"} +cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42"} +cumulus-relay-chain-inprocess-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42"} +cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42"} +cumulus-relay-chain-minimal-node = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42"} +cumulus-relay-chain-rpc-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42"} +pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +polkadot-cli = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42"} +polkadot-primitives = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42"} +polkadot-service = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42"} +sc-basic-authorship = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-chain-spec = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-client-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-network-sync = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-rpc-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-sysinfo = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-telemetry = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-tracing = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sp-blockchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sp-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sp-consensus-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sp-keyring = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sp-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +sp-timestamp = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +substrate-build-script-utils = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +substrate-frame-rpc-system = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} +substrate-prometheus-endpoint = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42"} diff --git a/runtime-api/did/src/lib.rs b/runtime-api/did/src/lib.rs index 291e779601..ce509776fa 100644 --- a/runtime-api/did/src/lib.rs +++ b/runtime-api/did/src/lib.rs @@ -67,11 +67,11 @@ pub type RawDidLinkedInfo where + pub trait Did where DidIdentifier: Codec, AccountId: Codec, LinkableAccountId: Codec, - BlockNumber: Codec + MaxEncodedLen, + BlockNumber: Codec, Key: Codec, Balance: Codec, { diff --git a/runtimes/common/src/xcm_config.rs b/runtimes/common/src/xcm_config.rs index 51eed3b5f3..2dc1a7ea1d 100644 --- a/runtimes/common/src/xcm_config.rs +++ b/runtimes/common/src/xcm_config.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use core::marker::PhantomData; -use frame_support::{log, match_types, parameter_types, weights::Weight}; +use frame_support::{log, match_types, parameter_types, traits::ProcessMessageError, weights::Weight}; use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{AccountId32Aliases, CurrencyAdapter, IsConcrete, ParentIsPreset, SiblingParachainConvertsVia}; @@ -55,7 +55,7 @@ where instructions: &mut [Instruction], max_weight: Weight, weight_credit: &mut Weight, - ) -> Result<(), ()> { + ) -> Result<(), ProcessMessageError> { Deny::should_execute(origin, instructions, max_weight, weight_credit)?; Allow::should_execute(origin, instructions, max_weight, weight_credit) } @@ -69,7 +69,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { instructions: &mut [Instruction], _max_weight: Weight, _weight_credit: &mut Weight, - ) -> Result<(), ()> { + ) -> Result<(), ProcessMessageError> { if instructions.iter().any(|inst| { matches!( inst, @@ -94,7 +94,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { } ) }) { - return Err(()); // Deny + return Err(ProcessMessageError::Corrupt); // Deny } // Allow reserve transfers to arrive from relay chain diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 8bedf0b7e0..394088e958 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -464,6 +464,7 @@ impl pallet_treasury::Config for Runtime { type CouncilCollective = pallet_collective::Instance1; impl pallet_collective::Config for Runtime { + type MaxProposalWeight = (); type RuntimeOrigin = RuntimeOrigin; type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; @@ -478,6 +479,7 @@ impl pallet_collective::Config for Runtime { type TechnicalCollective = pallet_collective::Instance2; impl pallet_collective::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; + type MaxProposalWeight = (); type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type MotionDuration = constants::governance::TechnicalMotionDuration; diff --git a/runtimes/peregrine/src/weights/pallet_xcm.rs b/runtimes/peregrine/src/weights/pallet_xcm.rs index 088f55bb68..171a4e085a 100644 --- a/runtimes/peregrine/src/weights/pallet_xcm.rs +++ b/runtimes/peregrine/src/weights/pallet_xcm.rs @@ -72,6 +72,9 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } + + + fn force_suspension() -> sp_weights::Weight { todo!() } // !TODO! /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn teleport_assets() -> Weight { diff --git a/runtimes/peregrine/src/xcm_config.rs b/runtimes/peregrine/src/xcm_config.rs index a21d4e1049..b358227a51 100644 --- a/runtimes/peregrine/src/xcm_config.rs +++ b/runtimes/peregrine/src/xcm_config.rs @@ -25,6 +25,7 @@ use frame_support::{ parameter_types, traits::{Contains, Nothing}, }; +use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; use sp_core::ConstU32; use xcm::latest::prelude::*; @@ -170,6 +171,7 @@ impl pallet_xcm::Config for Runtime { type XcmExecuteFilter = Nothing; type XcmTeleportFilter = Nothing; type XcmReserveTransferFilter = Nothing; + type AdminOrigin = EnsureRoot; type XcmExecutor = XcmExecutor; type Weigher = FixedWeightBounds; type RuntimeOrigin = RuntimeOrigin; diff --git a/runtimes/spiritnet/src/xcm_config.rs b/runtimes/spiritnet/src/xcm_config.rs index e399457755..698ff47eeb 100644 --- a/runtimes/spiritnet/src/xcm_config.rs +++ b/runtimes/spiritnet/src/xcm_config.rs @@ -25,6 +25,7 @@ use frame_support::{ parameter_types, traits::{Contains, Nothing}, }; +use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; use sp_core::ConstU32; use xcm::latest::prelude::*; @@ -167,6 +168,7 @@ impl pallet_xcm::Config for Runtime { type XcmExecuteFilter = Nothing; type XcmTeleportFilter = Nothing; type XcmReserveTransferFilter = Nothing; + type AdminOrigin = EnsureRoot; type XcmExecutor = XcmExecutor; type Weigher = FixedWeightBounds; type RuntimeOrigin = RuntimeOrigin; diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index 3c6e2657da..b0fa1c021f 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -245,9 +245,15 @@ parameter_types! { pub const ExistentialDeposit: u128 = EXISTENTIAL_DEPOSIT; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; + pub const MaxFreezes: u32 = 50; + pub const MaxHolds: u32 = 50; } impl pallet_balances::Config for Runtime { + type FreezeIdentifier = AccountId; + type HoldIdentifier = AccountId; + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; @@ -827,6 +833,10 @@ impl_runtime_apis! { fn metadata() -> OpaqueMetadata { OpaqueMetadata::new(Runtime::metadata().into()) } + + fn metadata_at_version(_: u32) -> Option { todo!() } + + fn metadata_versions() -> sp_std::prelude::Vec { todo!() } } impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { From 11983e8c1e668aeba08853b5f66df8c6913085ba Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 12 May 2023 14:56:01 +0200 Subject: [PATCH 07/99] compiling --- nodes/parachain/src/chain_spec.rs | 2 +- nodes/parachain/src/service.rs | 21 +++++----- nodes/standalone/src/service.rs | 38 +++--------------- runtimes/peregrine/src/lib.rs | 10 ++++- .../peregrine/src/weights/pallet_balances.rs | 39 +++++-------------- runtimes/spiritnet/src/lib.rs | 11 +++++- .../spiritnet/src/weights/pallet_balances.rs | 23 ++++------- runtimes/spiritnet/src/weights/pallet_xcm.rs | 2 + runtimes/standalone/src/lib.rs | 10 ++--- 9 files changed, 58 insertions(+), 98 deletions(-) diff --git a/nodes/parachain/src/chain_spec.rs b/nodes/parachain/src/chain_spec.rs index 42725d5dfa..a89a1ef51e 100644 --- a/nodes/parachain/src/chain_spec.rs +++ b/nodes/parachain/src/chain_spec.rs @@ -22,7 +22,7 @@ #![allow(clippy::derive_partial_eq_without_eq)] use cumulus_primitives_core::ParaId; -use polkadot_primitives::v2::LOWEST_PUBLIC_ID; +use polkadot_primitives::v4::LOWEST_PUBLIC_ID; use runtime_common::{AccountId, AccountPublic}; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::Properties; diff --git a/nodes/parachain/src/service.rs b/nodes/parachain/src/service.rs index a57aa9e993..20873ee45e 100644 --- a/nodes/parachain/src/service.rs +++ b/nodes/parachain/src/service.rs @@ -37,7 +37,7 @@ use sc_network_sync::SyncingService; use sc_service::{Configuration, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sp_api::ConstructRuntimeApi; -use sp_keystore::SyncCryptoStorePtr; +use sp_keystore::KeystorePtr; use sp_runtime::traits::BlakeTwo256; use std::{sync::Arc, time::Duration}; use substrate_prometheus_endpoint::Registry; @@ -146,12 +146,7 @@ where }) .transpose()?; - let executor = sc_executor::NativeElseWasmExecutor::::new( - config.wasm_method, - config.default_heap_pages, - config.max_runtime_instances, - config.runtime_cache_size, - ); + let executor = sc_service::new_native_or_wasm_executor(&config); let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( config, @@ -278,7 +273,7 @@ where Arc, Arc>>, Arc>, - SyncCryptoStorePtr, + KeystorePtr, bool, ParaId, ) -> Result>, sc_service::Error>, @@ -342,7 +337,7 @@ where transaction_pool: transaction_pool.clone(), task_manager: &mut task_manager, config: parachain_config, - keystore: params.keystore_container.sync_keystore(), + keystore: params.keystore_container.keystore(), backend: backend.clone(), network: network.clone(), system_rpc_tx, @@ -383,8 +378,8 @@ where &task_manager, relay_chain_interface.clone(), transaction_pool, - sync_service, - params.keystore_container.sync_keystore(), + sync_service.clone(), + params.keystore_container.keystore(), force_authoring, id, )?; @@ -397,6 +392,7 @@ where client: client.clone(), task_manager: &mut task_manager, relay_chain_interface, + sync_service: sync_service.clone(), spawner, parachain_consensus, import_queue: import_queue_service, @@ -413,6 +409,7 @@ where task_manager: &mut task_manager, para_id: id, relay_chain_interface, + sync_service, relay_chain_slot_duration, import_queue: import_queue_service, recovery_handle: Box::new(overseer_handle), @@ -523,7 +520,7 @@ fn build_consensus( relay_chain_interface: Arc, transaction_pool: Arc>>, sync_oracle: Arc>, - keystore: SyncCryptoStorePtr, + keystore: KeystorePtr, force_authoring: bool, id: ParaId, ) -> Result>, sc_service::Error> diff --git a/nodes/standalone/src/service.rs b/nodes/standalone/src/service.rs index eaa3efb1b5..41cb2ff630 100644 --- a/nodes/standalone/src/service.rs +++ b/nodes/standalone/src/service.rs @@ -23,7 +23,6 @@ use sc_client_api::BlockBackend; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; use sc_consensus_grandpa::SharedVoterState; pub use sc_executor::NativeElseWasmExecutor; -use sc_keystore::LocalKeystore; use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams}; use sc_telemetry::{Telemetry, TelemetryWorker}; use sp_consensus_aura::ed25519::AuthorityPair as AuraPair; @@ -65,10 +64,6 @@ type PartialComponents = sc_service::PartialComponents< >; pub fn new_partial(config: &Configuration) -> Result { - if config.keystore_remote.is_some() { - return Err(ServiceError::Other("Remote Keystores are not supported.".to_string())); - } - let telemetry = config .telemetry_endpoints .clone() @@ -80,12 +75,7 @@ pub fn new_partial(config: &Configuration) -> Result::new( - config.wasm_method, - config.default_heap_pages, - config.max_runtime_instances, - config.runtime_cache_size, - ); + let executor = sc_service::new_native_or_wasm_executor(&config); let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( config, @@ -151,13 +141,6 @@ pub fn new_partial(config: &Configuration) -> Result Result, &'static str> { - // FIXME: here would the concrete keystore be built, - // must return a concrete type (NOT `LocalKeystore`) that - // implements `CryptoStore` and `SyncCryptoStore` - Err("Remote Keystore not supported.") -} - /// Builds a new service for a full client. pub fn new_full(mut config: Configuration) -> Result { let sc_service::PartialComponents { @@ -165,23 +148,12 @@ pub fn new_full(mut config: Configuration) -> Result backend, mut task_manager, import_queue, - mut keystore_container, + keystore_container, select_chain, transaction_pool, other: (block_import, grandpa_link, mut telemetry), } = new_partial(&config)?; - if let Some(url) = &config.keystore_remote { - match remote_keystore(url) { - Ok(k) => keystore_container.set_remote_keystore(k), - Err(e) => { - return Err(ServiceError::Other(format!( - "Error hooking up remote keystore for {}: {}", - url, e - ))) - } - }; - } let grandpa_protocol_name = sc_consensus_grandpa::protocol_standard_name( &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"), &config.chain_spec, @@ -239,7 +211,7 @@ pub fn new_full(mut config: Configuration) -> Result network: network.clone(), client: client.clone(), sync_service: sync.clone(), - keystore: keystore_container.sync_keystore(), + keystore: keystore_container.keystore(), task_manager: &mut task_manager, transaction_pool: transaction_pool.clone(), rpc_builder: rpc_extensions_builder, @@ -279,7 +251,7 @@ pub fn new_full(mut config: Configuration) -> Result }, force_authoring, backoff_authoring_blocks, - keystore: keystore_container.sync_keystore(), + keystore: keystore_container.keystore(), sync_oracle: sync.clone(), justification_sync_link: sync.clone(), block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32), @@ -299,7 +271,7 @@ pub fn new_full(mut config: Configuration) -> Result // if the node isn't actively participating in consensus then it doesn't // need a keystore, regardless of which protocol we use below. let keystore = if role.is_authority() { - Some(keystore_container.sync_keystore()) + Some(keystore_container.keystore()) } else { None }; diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 394088e958..b8b4297f23 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -197,9 +197,14 @@ impl pallet_indices::Config for Runtime { impl pallet_balances::Config for Runtime { /// The type for recording an account's balance. type Balance = Balance; + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); + /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; - type DustRemoval = Treasury; + type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = weights::pallet_balances::WeightInfo; @@ -1132,6 +1137,9 @@ impl_runtime_apis! { fn metadata() -> OpaqueMetadata { OpaqueMetadata::new(Runtime::metadata().into()) } + + fn metadata_at_version(_: u32) -> Option { todo!() } + fn metadata_versions() -> sp_std::prelude::Vec { todo!() } } impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { diff --git a/runtimes/peregrine/src/weights/pallet_balances.rs b/runtimes/peregrine/src/weights/pallet_balances.rs index ff0e1c5cce..9b2cb09a9a 100644 --- a/runtimes/peregrine/src/weights/pallet_balances.rs +++ b/runtimes/peregrine/src/weights/pallet_balances.rs @@ -52,18 +52,15 @@ use sp_std::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { + + + fn transfer_allow_death() -> sp_weights::Weight { todo!() } + fn force_set_balance_creating() -> sp_weights::Weight { todo!() } + fn force_set_balance_killing() -> sp_weights::Weight { todo!() } + fn upgrade_accounts(_: u32) -> sp_weights::Weight { todo!() } /// Storage: System Account (r:2 w:2) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - fn transfer() -> Weight { - // Proof Size summary in bytes: - // Measured: `2759` - // Estimated: `5214` - // Minimum execution time: 55_797_000 picoseconds. - Weight::from_parts(55_797_000, 0) - .saturating_add(Weight::from_parts(0, 5214)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } + /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_keep_alive() -> Weight { @@ -78,28 +75,10 @@ impl pallet_balances::WeightInfo for WeightInfo { } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - fn set_balance_creating() -> Weight { - // Proof Size summary in bytes: - // Measured: `2166` - // Estimated: `2607` - // Minimum execution time: 42_209_000 picoseconds. - Weight::from_parts(42_209_000, 0) - .saturating_add(Weight::from_parts(0, 2607)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } + /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - fn set_balance_killing() -> Weight { - // Proof Size summary in bytes: - // Measured: `2166` - // Estimated: `2607` - // Minimum execution time: 55_056_000 picoseconds. - Weight::from_parts(55_056_000, 0) - .saturating_add(Weight::from_parts(0, 2607)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } + /// Storage: System Account (r:3 w:3) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_transfer() -> Weight { diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 5efb9ac4f0..7ac3b518a8 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -195,11 +195,15 @@ impl pallet_indices::Config for Runtime { } impl pallet_balances::Config for Runtime { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; - type DustRemoval = Treasury; + type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = weights::pallet_balances::WeightInfo; @@ -462,6 +466,7 @@ impl pallet_collective::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; + type MaxProposalWeight = (); type MotionDuration = constants::governance::CouncilMotionDuration; type MaxProposals = constants::governance::CouncilMaxProposals; type MaxMembers = constants::governance::CouncilMaxMembers; @@ -473,6 +478,7 @@ impl pallet_collective::Config for Runtime { type TechnicalCollective = pallet_collective::Instance2; impl pallet_collective::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; + type MaxProposalWeight = (); type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type MotionDuration = constants::governance::TechnicalMotionDuration; @@ -1123,6 +1129,9 @@ impl_runtime_apis! { fn metadata() -> OpaqueMetadata { OpaqueMetadata::new(Runtime::metadata().into()) } + + fn metadata_at_version(_: u32) -> Option { todo!() } + fn metadata_versions() -> sp_std::prelude::Vec { todo!() } } impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { diff --git a/runtimes/spiritnet/src/weights/pallet_balances.rs b/runtimes/spiritnet/src/weights/pallet_balances.rs index 6bb8bbfe5d..7c89545af7 100644 --- a/runtimes/spiritnet/src/weights/pallet_balances.rs +++ b/runtimes/spiritnet/src/weights/pallet_balances.rs @@ -48,13 +48,14 @@ use sp_std::marker::PhantomData; /// Weights for `pallet_balances`. pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { + + fn transfer_allow_death() -> sp_weights::Weight { todo!() } + fn force_set_balance_creating() -> sp_weights::Weight { todo!() } + fn force_set_balance_killing() -> sp_weights::Weight { todo!() } + fn upgrade_accounts(_: u32) -> sp_weights::Weight { todo!() } // Storage: System Account (r:2 w:2) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - fn transfer() -> Weight { - Weight::from_parts(72_209_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } + // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_keep_alive() -> Weight { @@ -64,18 +65,10 @@ impl pallet_balances::WeightInfo for WeightInfo { } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - fn set_balance_creating() -> Weight { - Weight::from_parts(49_562_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } + // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - fn set_balance_killing() -> Weight { - Weight::from_parts(39_743_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } + // Storage: System Account (r:3 w:3) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_transfer() -> Weight { diff --git a/runtimes/spiritnet/src/weights/pallet_xcm.rs b/runtimes/spiritnet/src/weights/pallet_xcm.rs index 8bb2babb73..655b58f6b1 100644 --- a/runtimes/spiritnet/src/weights/pallet_xcm.rs +++ b/runtimes/spiritnet/src/weights/pallet_xcm.rs @@ -63,6 +63,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(5 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } + + fn force_suspension() -> sp_weights::Weight { todo!() } // Storage: Benchmark Override (r:0 w:0) // Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn teleport_assets() -> Weight { diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index b0fa1c021f..7fcd625d66 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -250,10 +250,10 @@ parameter_types! { } impl pallet_balances::Config for Runtime { - type FreezeIdentifier = AccountId; - type HoldIdentifier = AccountId; - type MaxFreezes = MaxFreezes; - type MaxHolds = MaxHolds; + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; @@ -834,7 +834,7 @@ impl_runtime_apis! { OpaqueMetadata::new(Runtime::metadata().into()) } - fn metadata_at_version(_: u32) -> Option { todo!() } + fn metadata_at_version(_: u32) -> Option { todo!() } fn metadata_versions() -> sp_std::prelude::Vec { todo!() } } From d0c6a86b8c541011bd6c82d8909c577b371ec8d5 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 16 May 2023 15:09:14 +0200 Subject: [PATCH 08/99] With metadata runtime api --- runtimes/peregrine/src/lib.rs | 9 +++++++-- runtimes/spiritnet/src/lib.rs | 9 +++++++-- runtimes/standalone/src/lib.rs | 8 ++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index b8b4297f23..10e35fe96c 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -1138,8 +1138,13 @@ impl_runtime_apis! { OpaqueMetadata::new(Runtime::metadata().into()) } - fn metadata_at_version(_: u32) -> Option { todo!() } - fn metadata_versions() -> sp_std::prelude::Vec { todo!() } + fn metadata_at_version(version: u32) -> Option { + Runtime::metadata_at_version(version) + } + + fn metadata_versions() -> sp_std::vec::Vec { + Runtime::metadata_versions() + } } impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 7ac3b518a8..c8a4ee3697 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -1130,8 +1130,13 @@ impl_runtime_apis! { OpaqueMetadata::new(Runtime::metadata().into()) } - fn metadata_at_version(_: u32) -> Option { todo!() } - fn metadata_versions() -> sp_std::prelude::Vec { todo!() } + fn metadata_at_version(version: u32) -> Option { + Runtime::metadata_at_version(version) + } + + fn metadata_versions() -> sp_std::vec::Vec { + Runtime::metadata_versions() + } } impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index 7fcd625d66..08abe7c3e3 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -834,9 +834,13 @@ impl_runtime_apis! { OpaqueMetadata::new(Runtime::metadata().into()) } - fn metadata_at_version(_: u32) -> Option { todo!() } + fn metadata_at_version(version: u32) -> Option { + Runtime::metadata_at_version(version) + } - fn metadata_versions() -> sp_std::prelude::Vec { todo!() } + fn metadata_versions() -> sp_std::vec::Vec { + Runtime::metadata_versions() + } } impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { From b2f69cac5090ca7c4107a0ce0ecb8ee04c559c89 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 17 May 2023 09:39:49 +0200 Subject: [PATCH 09/99] With metadata runtime api --- pallets/attestation/src/mock.rs | 4 ++++ pallets/ctype/src/mock.rs | 4 ++++ pallets/delegation/src/mock.rs | 6 +++++- pallets/delegation/src/tests.rs | 18 +++++++++++++++--- pallets/did/src/mock.rs | 4 ++++ pallets/pallet-did-lookup/src/mock.rs | 4 ++++ pallets/pallet-inflation/src/mock.rs | 4 ++++ pallets/pallet-web3-names/src/mock.rs | 4 ++++ pallets/parachain-staking/src/mock.rs | 4 ++++ pallets/public-credentials/src/mock.rs | 4 ++++ runtimes/common/src/fees.rs | 4 ++++ 11 files changed, 56 insertions(+), 4 deletions(-) diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index ab9eced08f..4e23da7ece 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -249,6 +249,10 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type Balance = Balance; type DustRemoval = (); type RuntimeEvent = (); diff --git a/pallets/ctype/src/mock.rs b/pallets/ctype/src/mock.rs index e441c4c528..380c0d8475 100644 --- a/pallets/ctype/src/mock.rs +++ b/pallets/ctype/src/mock.rs @@ -113,6 +113,10 @@ pub mod runtime { } impl pallet_balances::Config for Test { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type Balance = Balance; type DustRemoval = (); type RuntimeEvent = (); diff --git a/pallets/delegation/src/mock.rs b/pallets/delegation/src/mock.rs index 8278353f32..99adda3f3e 100644 --- a/pallets/delegation/src/mock.rs +++ b/pallets/delegation/src/mock.rs @@ -253,12 +253,16 @@ pub(crate) mod runtime { } parameter_types! { - pub const ExistentialDeposit: Balance = 0; + pub const ExistentialDeposit: Balance = 1; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; } impl pallet_balances::Config for Test { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type Balance = Balance; type DustRemoval = (); type RuntimeEvent = (); diff --git a/pallets/delegation/src/tests.rs b/pallets/delegation/src/tests.rs index 32f17f62ba..b5dd3d84e3 100644 --- a/pallets/delegation/src/tests.rs +++ b/pallets/delegation/src/tests.rs @@ -16,7 +16,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{assert_err, assert_noop, assert_ok}; +use frame_support::{assert_err, assert_noop, assert_ok, traits::Currency}; use kilt_support::mock::mock_origin::DoubleOrigin; use crate::{ @@ -138,8 +138,16 @@ fn create_delegation_direct_root_successful() { ACCOUNT_00, )]) .with_balances(vec![ - (ACCOUNT_00, ::Deposit::get()), - (ACCOUNT_01, ::Deposit::get()), + ( + ACCOUNT_00, + ::Deposit::get() + + <::Currency as Currency>>::minimum_balance(), + ), + ( + ACCOUNT_01, + ::Deposit::get() + + <::Currency as Currency>>::minimum_balance(), + ), ]) .build() .execute_with(|| { @@ -1990,6 +1998,10 @@ fn is_delegating_delegation_not_found() { // Root -> Delegation 1 let mut ext = ExtBuilder::default() + .with_balances(vec![( + ACCOUNT_00, + <::Currency as Currency>>::minimum_balance(), + )]) .with_delegation_hierarchies(vec![(hierarchy_root_id, hierarchy_details, user_1.clone(), ACCOUNT_00)]) .build(); diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index f5e539d577..38bb372d1b 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -167,6 +167,10 @@ parameter_types! { } impl pallet_balances::Config for Test { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type Balance = Balance; type DustRemoval = (); type RuntimeEvent = (); diff --git a/pallets/pallet-did-lookup/src/mock.rs b/pallets/pallet-did-lookup/src/mock.rs index 34e72d41e1..be194b92de 100644 --- a/pallets/pallet-did-lookup/src/mock.rs +++ b/pallets/pallet-did-lookup/src/mock.rs @@ -94,6 +94,10 @@ parameter_types! { } impl pallet_balances::Config for Test { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type Balance = Balance; type DustRemoval = (); type RuntimeEvent = RuntimeEvent; diff --git a/pallets/pallet-inflation/src/mock.rs b/pallets/pallet-inflation/src/mock.rs index 10c66444c6..2a3faa010f 100644 --- a/pallets/pallet-inflation/src/mock.rs +++ b/pallets/pallet-inflation/src/mock.rs @@ -98,6 +98,10 @@ parameter_types! { } impl pallet_balances::Config for Test { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; diff --git a/pallets/pallet-web3-names/src/mock.rs b/pallets/pallet-web3-names/src/mock.rs index bc6bf4b357..e8c9f553f5 100644 --- a/pallets/pallet-web3-names/src/mock.rs +++ b/pallets/pallet-web3-names/src/mock.rs @@ -128,6 +128,10 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type Balance = Balance; type DustRemoval = (); type RuntimeEvent = RuntimeEvent; diff --git a/pallets/parachain-staking/src/mock.rs b/pallets/parachain-staking/src/mock.rs index 65a9569e5e..92353e6e22 100644 --- a/pallets/parachain-staking/src/mock.rs +++ b/pallets/parachain-staking/src/mock.rs @@ -102,6 +102,10 @@ parameter_types! { } impl pallet_balances::Config for Test { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = [u8; 8]; diff --git a/pallets/public-credentials/src/mock.rs b/pallets/public-credentials/src/mock.rs index b3bfa4f0b8..2567aac63f 100644 --- a/pallets/public-credentials/src/mock.rs +++ b/pallets/public-credentials/src/mock.rs @@ -319,6 +319,10 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type Balance = Balance; type DustRemoval = (); type RuntimeEvent = (); diff --git a/runtimes/common/src/fees.rs b/runtimes/common/src/fees.rs index c22146249c..b8846dbd55 100644 --- a/runtimes/common/src/fees.rs +++ b/runtimes/common/src/fees.rs @@ -214,6 +214,10 @@ mod tests { } impl pallet_balances::Config for Test { + type FreezeIdentifier = (); + type HoldIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); type Balance = u64; type RuntimeEvent = RuntimeEvent; type DustRemoval = (); From 7337c8adaa031ce0069100c40c09523d7ef39b12 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 17 May 2023 14:37:45 +0200 Subject: [PATCH 10/99] working tests --- pallets/delegation/src/tests.rs | 24 ++++++++++--- pallets/public-credentials/src/mock.rs | 2 ++ pallets/public-credentials/src/tests.rs | 46 ++++++++++++++----------- runtimes/common/src/fees.rs | 4 +-- 4 files changed, 50 insertions(+), 26 deletions(-) diff --git a/pallets/delegation/src/tests.rs b/pallets/delegation/src/tests.rs index b5dd3d84e3..f8967813d5 100644 --- a/pallets/delegation/src/tests.rs +++ b/pallets/delegation/src/tests.rs @@ -37,7 +37,11 @@ fn create_root_delegation_successful() { ExtBuilder::default() .with_ctypes(vec![(operation.ctype_hash, creator.clone())]) - .with_balances(vec![(ACCOUNT_00, ::Deposit::get())]) + .with_balances(vec![( + ACCOUNT_00, + ::Deposit::get() + + <::Currency as Currency>>::minimum_balance(), + )]) .build() .execute_with(|| { // Create root hierarchy @@ -222,8 +226,16 @@ fn create_delegation_with_parent_successful() { )]) .with_delegations(vec![(parent_id, parent_node)]) .with_balances(vec![ - (ACCOUNT_00, ::Deposit::get()), - (ACCOUNT_01, ::Deposit::get()), + ( + ACCOUNT_00, + ::Deposit::get() + + <::Currency as Currency>>::minimum_balance(), + ), + ( + ACCOUNT_01, + ::Deposit::get() + + <::Currency as Currency>>::minimum_balance(), + ), ]) .build() .execute_with(|| { @@ -2212,7 +2224,11 @@ fn test_change_deposit_owner() { ExtBuilder::default() .with_balances(vec![ (ACCOUNT_00, ::Deposit::get() * 2), - (ACCOUNT_01, ::Deposit::get()), + ( + ACCOUNT_01, + ::Deposit::get() + + <::Currency as Currency>>::minimum_balance(), + ), ]) .with_ctypes(vec![(hierarchy_details.ctype_hash, root_owner.clone())]) .with_delegation_hierarchies(vec![(hierarchy_root_id, hierarchy_details, root_owner, ACCOUNT_00)]) diff --git a/pallets/public-credentials/src/mock.rs b/pallets/public-credentials/src/mock.rs index 2567aac63f..160364adad 100644 --- a/pallets/public-credentials/src/mock.rs +++ b/pallets/public-credentials/src/mock.rs @@ -366,6 +366,8 @@ pub(crate) mod runtime { pub(crate) const ACCOUNT_00: AccountId = AccountId::new([1u8; 32]); pub(crate) const ACCOUNT_01: AccountId = AccountId::new([2u8; 32]); + // Min Balance has to be >= [ExistentialDeposit] + pub(crate) const MIN_BALANCE: Balance = MILLI_UNIT; pub(crate) const ALICE_SEED: [u8; 32] = [0u8; 32]; pub(crate) const BOB_SEED: [u8; 32] = [1u8; 32]; diff --git a/pallets/public-credentials/src/tests.rs b/pallets/public-credentials/src/tests.rs index e804b23596..f26b40afd2 100644 --- a/pallets/public-credentials/src/tests.rs +++ b/pallets/public-credentials/src/tests.rs @@ -47,7 +47,7 @@ fn add_successful_without_authorization() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, (deposit) * 2)]) + .with_balances(vec![(ACCOUNT_00, (deposit) * 2 + MIN_BALANCE)]) .with_ctypes(vec![(ctype_hash_1, attester.clone()), (ctype_hash_2, attester.clone())]) .build() .execute_with(|| { @@ -123,7 +123,7 @@ fn add_successful_with_authorization() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_ctypes(vec![(ctype_hash, attester.clone())]) .build() .execute_with(|| { @@ -265,7 +265,7 @@ fn revoke_successful() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -306,7 +306,7 @@ fn revoke_same_attester_wrong_ac() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -335,7 +335,7 @@ fn revoke_unauthorized() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -361,7 +361,7 @@ fn revoke_ac_not_found() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -405,7 +405,7 @@ fn unrevoke_successful() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -447,7 +447,7 @@ fn unrevoke_same_attester_wrong_ac() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -477,7 +477,7 @@ fn unrevoke_unauthorized() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -504,7 +504,7 @@ fn unrevoke_ac_not_found() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -547,7 +547,7 @@ fn remove_successful() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -583,7 +583,7 @@ fn remove_same_attester_wrong_ac() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -610,7 +610,7 @@ fn remove_unauthorized() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -636,7 +636,7 @@ fn remove_ac_not_found() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -679,7 +679,7 @@ fn reclaim_deposit_successful() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -733,7 +733,7 @@ fn reclaim_deposit_unauthorized() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -764,7 +764,10 @@ fn test_change_deposit_owner() { let credential_id: CredentialIdOf = CredentialIdOf::::default(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit), (ACCOUNT_01, deposit)]) + .with_balances(vec![ + (ACCOUNT_00, deposit + MIN_BALANCE), + (ACCOUNT_01, deposit + MIN_BALANCE), + ]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -825,7 +828,10 @@ fn test_change_deposit_owner_unauthorized() { let credential_id: CredentialIdOf = CredentialIdOf::::default(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit), (ACCOUNT_01, deposit)]) + .with_balances(vec![ + (ACCOUNT_00, deposit + MIN_BALANCE), + (ACCOUNT_01, deposit + MIN_BALANCE), + ]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -856,7 +862,7 @@ fn test_update_deposit() { let credential_id: CredentialIdOf = CredentialIdOf::::default(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit_old)]) + .with_balances(vec![(ACCOUNT_00, deposit_old + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { @@ -902,7 +908,7 @@ fn test_update_deposit_unauthorized() { let deposit: Balance = ::Deposit::get(); ExtBuilder::default() - .with_balances(vec![(ACCOUNT_00, deposit)]) + .with_balances(vec![(ACCOUNT_00, deposit + MIN_BALANCE)]) .with_public_credentials(vec![(subject_id, credential_id, new_credential)]) .build() .execute_with(|| { diff --git a/runtimes/common/src/fees.rs b/runtimes/common/src/fees.rs index b8846dbd55..5b058f9e59 100644 --- a/runtimes/common/src/fees.rs +++ b/runtimes/common/src/fees.rs @@ -139,7 +139,7 @@ mod tests { }; use frame_support::{dispatch::DispatchClass, parameter_types, traits::FindAuthor}; use frame_system::limits; - use sp_core::H256; + use sp_core::{ConstU64, H256}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, @@ -221,7 +221,7 @@ mod tests { type Balance = u64; type RuntimeEvent = RuntimeEvent; type DustRemoval = (); - type ExistentialDeposit = (); + type ExistentialDeposit = ConstU64<1>; type AccountStore = System; type MaxLocks = (); type MaxReserves = (); From 771a4206d9605b0016afe3fd43fd004ee836de91 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 23 May 2023 09:11:29 +0200 Subject: [PATCH 11/99] first draft --- pallets/attestation/src/lib.rs | 8 +++- pallets/attestation/src/migration.rs | 30 +++++++++++++++ support/Cargo.toml | 2 +- support/src/lib.rs | 1 + support/src/migration.rs | 55 ++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 pallets/attestation/src/migration.rs create mode 100644 support/src/migration.rs diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 67b54274b5..08463fc141 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -63,6 +63,7 @@ pub mod attestations; pub mod default_weights; +pub mod migration; #[cfg(any(feature = "mock", test))] pub mod mock; @@ -147,7 +148,12 @@ pub mod pallet { pub struct Pallet(_); #[pallet::hooks] - impl Hooks> for Pallet {} + impl Hooks> for Pallet { + fn on_runtime_upgrade() -> Weight { + migration::do_migration(); + () + } + } /// Attestations stored on chain. /// diff --git a/pallets/attestation/src/migration.rs b/pallets/attestation/src/migration.rs new file mode 100644 index 0000000000..7eef16e533 --- /dev/null +++ b/pallets/attestation/src/migration.rs @@ -0,0 +1,30 @@ +// KILT Blockchain – https://botlabs.org +// Copyright (C) 2019-2023 BOTLabs GmbH + +// The KILT Blockchain is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The KILT Blockchain is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@botlabs.org + +use frame_support::pallet_prelude::DispatchResult; +use kilt_support::migration::switch_reserved_to_holds; + + +use crate::{AttestationDetails, Attestations, Config}; + +pub(crate) fn do_migration() { + Attestations::::iter_values().map(|attestations_detail: AttestationDetails| -> DispatchResult { + + attestations_detail.deposit + Ok(()) }); +} diff --git a/support/Cargo.toml b/support/Cargo.toml index bb7fe90158..282e8b2add 100644 --- a/support/Cargo.toml +++ b/support/Cargo.toml @@ -13,7 +13,7 @@ version.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] -[dependencies] +[dependencies] # External dependencies parity-scale-codec = {workspace = true, features = ["derive"]} scale-info = {workspace = true, features = ["derive"]} diff --git a/support/src/lib.rs b/support/src/lib.rs index 722a00a0fe..e8133d2dc2 100644 --- a/support/src/lib.rs +++ b/support/src/lib.rs @@ -20,6 +20,7 @@ pub mod deposit; pub use deposit::{free_deposit, reserve_deposit}; +pub mod migration; #[cfg(any(feature = "runtime-benchmarks", feature = "mock"))] pub mod mock; pub mod signature; diff --git a/support/src/migration.rs b/support/src/migration.rs new file mode 100644 index 0000000000..391325b4fa --- /dev/null +++ b/support/src/migration.rs @@ -0,0 +1,55 @@ +// KILT Blockchain – https://botlabs.org +// Copyright (C) 2019-2023 BOTLabs GmbH + +// The KILT Blockchain is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The KILT Blockchain is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@botlabs.org + +use frame_support::{ + pallet_prelude::DispatchResult, + traits::{ + fungible::hold::{Inspect, Mutate}, + ReservableCurrency, + }, +}; +use frame_system::Config; +use sp_runtime::SaturatedConversion; + +use crate::deposit; + +pub fn ensure_upgraded + Mutate>( + account: &T::AccountId, + reason: &>::Reason, +) { +} + +/// Mutate the balance of the given account. +/// Moves all reserved balance to holds. This is a migration function and should +/// be deleted once all accounts are updated. +pub fn switch_reserved_to_holds + Mutate>( + deposit: &T::AccountId, + deposit: >::Balance, + reason: &>::Reason, +) -> DispatchResult { + let reserved_balance = Currency::reserved_balance(account); + Currency::unreserve(account, reserved_balance); + let hold_balance = reserved_balance.saturated_into::(); + Currency::hold(reason, account, hold_balance.saturated_into()) +} + +fn switch_locked_to_freezes + Mutate>( + account: &T::AccountId, +) -> DispatchResult { + Ok(()) +} From 601a5805e5e19ee4382f9c5750ab7a1787a60238 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 23 May 2023 10:01:34 +0200 Subject: [PATCH 12/99] first draft --- nodes/parachain/src/service.rs | 2 +- nodes/standalone/src/service.rs | 2 +- pallets/attestation/src/lib.rs | 14 +++++----- pallets/attestation/src/migration.rs | 15 ++++++----- support/src/migration.rs | 38 ---------------------------- 5 files changed, 17 insertions(+), 54 deletions(-) diff --git a/nodes/parachain/src/service.rs b/nodes/parachain/src/service.rs index 20873ee45e..8d047042df 100644 --- a/nodes/parachain/src/service.rs +++ b/nodes/parachain/src/service.rs @@ -146,7 +146,7 @@ where }) .transpose()?; - let executor = sc_service::new_native_or_wasm_executor(&config); + let executor = sc_service::new_native_or_wasm_executor(config); let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( config, diff --git a/nodes/standalone/src/service.rs b/nodes/standalone/src/service.rs index 41cb2ff630..64c4bab891 100644 --- a/nodes/standalone/src/service.rs +++ b/nodes/standalone/src/service.rs @@ -75,7 +75,7 @@ pub fn new_partial(config: &Configuration) -> Result( config, diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 08463fc141..9a723b6992 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -147,13 +147,13 @@ pub mod pallet { #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); - #[pallet::hooks] - impl Hooks> for Pallet { - fn on_runtime_upgrade() -> Weight { - migration::do_migration(); - () - } - } + // #[pallet::hooks] + // impl Hooks> for Pallet { + // fn on_runtime_upgrade() -> Weight { + // migration::do_migration(); + // () + // } + // } /// Attestations stored on chain. /// diff --git a/pallets/attestation/src/migration.rs b/pallets/attestation/src/migration.rs index 7eef16e533..2221331d98 100644 --- a/pallets/attestation/src/migration.rs +++ b/pallets/attestation/src/migration.rs @@ -17,14 +17,15 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::pallet_prelude::DispatchResult; -use kilt_support::migration::switch_reserved_to_holds; - -use crate::{AttestationDetails, Attestations, Config}; +use crate::{AttestationDetails, Attestations, BalanceOf, Config}; pub(crate) fn do_migration() { - Attestations::::iter_values().map(|attestations_detail: AttestationDetails| -> DispatchResult { - - attestations_detail.deposit - Ok(()) }); + Attestations::::iter_values().map(|attestations_detail: AttestationDetails| -> DispatchResult { + let deposit = attestations_detail.deposit; + switch_reserved_to_hold::(deposit.owner, deposit.amount); + Ok(()) + }); } + +fn switch_reserved_to_hold(owner: T::AccountId, amount: BalanceOf) {} diff --git a/support/src/migration.rs b/support/src/migration.rs index 391325b4fa..79e74681a2 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -15,41 +15,3 @@ // along with this program. If not, see . // If you feel like getting in touch with us, you can do so at info@botlabs.org - -use frame_support::{ - pallet_prelude::DispatchResult, - traits::{ - fungible::hold::{Inspect, Mutate}, - ReservableCurrency, - }, -}; -use frame_system::Config; -use sp_runtime::SaturatedConversion; - -use crate::deposit; - -pub fn ensure_upgraded + Mutate>( - account: &T::AccountId, - reason: &>::Reason, -) { -} - -/// Mutate the balance of the given account. -/// Moves all reserved balance to holds. This is a migration function and should -/// be deleted once all accounts are updated. -pub fn switch_reserved_to_holds + Mutate>( - deposit: &T::AccountId, - deposit: >::Balance, - reason: &>::Reason, -) -> DispatchResult { - let reserved_balance = Currency::reserved_balance(account); - Currency::unreserve(account, reserved_balance); - let hold_balance = reserved_balance.saturated_into::(); - Currency::hold(reason, account, hold_balance.saturated_into()) -} - -fn switch_locked_to_freezes + Mutate>( - account: &T::AccountId, -) -> DispatchResult { - Ok(()) -} From 633beb2c0074714522e80078413667292b53e9f3 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 23 May 2023 10:18:19 +0200 Subject: [PATCH 13/99] fmt --- pallets/ctype/src/default_weights.rs | 4 +-- pallets/delegation/src/default_weights.rs | 32 +++++++++---------- pallets/did/src/default_weights.rs | 28 ++++++++-------- .../pallet-web3-names/src/default_weights.rs | 16 +++++----- .../parachain-staking/src/default_weights.rs | 8 ++--- .../public-credentials/src/default_weights.rs | 4 +-- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/pallets/ctype/src/default_weights.rs b/pallets/ctype/src/default_weights.rs index f32e2a5d93..0c46cf315e 100644 --- a/pallets/ctype/src/default_weights.rs +++ b/pallets/ctype/src/default_weights.rs @@ -69,7 +69,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 48_042 nanoseconds. Weight::from_parts(48_883_000, 7777) // Standard Error: 1 - .saturating_add(Weight::from_ref_time(1_195).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(1_195, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -100,7 +100,7 @@ impl WeightInfo for () { // Minimum execution time: 48_042 nanoseconds. Weight::from_parts(48_883_000, 7777) // Standard Error: 1 - .saturating_add(Weight::from_ref_time(1_195).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(1_195, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } diff --git a/pallets/delegation/src/default_weights.rs b/pallets/delegation/src/default_weights.rs index 7e1ac3353e..543ea1a297 100644 --- a/pallets/delegation/src/default_weights.rs +++ b/pallets/delegation/src/default_weights.rs @@ -150,12 +150,12 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 38_077 nanoseconds. Weight::from_parts(26_891_977, 39837) // Standard Error: 40_521 - .saturating_add(Weight::from_ref_time(15_313_221).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(15_313_221, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 34675).saturating_mul(r.into())) } /// Storage: Delegation DelegationNodes (r:6 w:6) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) @@ -171,12 +171,12 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 33_920 nanoseconds. Weight::from_parts(22_100_902, 37282) // Standard Error: 41_250 - .saturating_add(Weight::from_ref_time(15_249_932).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(15_249_932, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 34675).saturating_mul(r.into())) } /// Storage: Delegation DelegationNodes (r:1 w:0) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) @@ -200,10 +200,10 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 6_421 nanoseconds. Weight::from_parts(4_790_851, 34675) // Standard Error: 12_806 - .saturating_add(Weight::from_ref_time(2_552_728).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(2_552_728, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 34675).saturating_mul(c.into())) } /// Storage: Delegation DelegationNodes (r:6 w:0) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) @@ -215,10 +215,10 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 6_283 nanoseconds. Weight::from_parts(4_764_126, 34675) // Standard Error: 12_366 - .saturating_add(Weight::from_ref_time(2_603_091).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(2_603_091, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 34675).saturating_mul(c.into())) } /// Storage: Delegation DelegationNodes (r:1 w:1) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) @@ -334,12 +334,12 @@ impl WeightInfo for () { // Minimum execution time: 38_077 nanoseconds. Weight::from_parts(26_891_977, 39837) // Standard Error: 40_521 - .saturating_add(Weight::from_ref_time(15_313_221).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(15_313_221, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 34675).saturating_mul(r.into())) } /// Storage: Delegation DelegationNodes (r:6 w:6) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) @@ -355,12 +355,12 @@ impl WeightInfo for () { // Minimum execution time: 33_920 nanoseconds. Weight::from_parts(22_100_902, 37282) // Standard Error: 41_250 - .saturating_add(Weight::from_ref_time(15_249_932).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(15_249_932, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 34675).saturating_mul(r.into())) } /// Storage: Delegation DelegationNodes (r:1 w:0) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) @@ -384,10 +384,10 @@ impl WeightInfo for () { // Minimum execution time: 6_421 nanoseconds. Weight::from_parts(4_790_851, 34675) // Standard Error: 12_806 - .saturating_add(Weight::from_ref_time(2_552_728).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(2_552_728, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 34675).saturating_mul(c.into())) } /// Storage: Delegation DelegationNodes (r:6 w:0) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) @@ -399,10 +399,10 @@ impl WeightInfo for () { // Minimum execution time: 6_283 nanoseconds. Weight::from_parts(4_764_126, 34675) // Standard Error: 12_366 - .saturating_add(Weight::from_ref_time(2_603_091).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(2_603_091, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_proof_size(34675).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 34675).saturating_mul(c.into())) } /// Storage: Delegation DelegationNodes (r:1 w:1) /// Proof: Delegation DelegationNodes (max_values: None, max_size: Some(32200), added: 34675, mode: MaxEncodedLen) diff --git a/pallets/did/src/default_weights.rs b/pallets/did/src/default_weights.rs index 93eb16d3ba..10430b152c 100644 --- a/pallets/did/src/default_weights.rs +++ b/pallets/did/src/default_weights.rs @@ -185,12 +185,12 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 15_346 nanoseconds. Weight::from_parts(17_226_638, 7314) // Standard Error: 19_165 - .saturating_add(Weight::from_ref_time(921_753).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(921_753, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_proof_size(3090).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 3090).saturating_mul(c.into())) } /// Storage: Did Did (r:1 w:1) /// Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) @@ -208,12 +208,12 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 17_363 nanoseconds. Weight::from_parts(18_240_688, 7314) // Standard Error: 5_930 - .saturating_add(Weight::from_ref_time(928_602).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(928_602, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_proof_size(3090).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 3090).saturating_mul(c.into())) } /// Storage: Did Did (r:1 w:1) /// Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) @@ -607,7 +607,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 37_516 nanoseconds. Weight::from_parts(37_912_000, 4787) // Standard Error: 1 - .saturating_add(Weight::from_ref_time(2_150).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(2_150, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Did Did (r:1 w:0) @@ -620,7 +620,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 36_395 nanoseconds. Weight::from_parts(36_951_000, 4787) // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_366).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(1_366, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Did Did (r:1 w:0) @@ -633,7 +633,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 32_273 nanoseconds. Weight::from_parts(33_274_000, 4787) // Standard Error: 0 - .saturating_add(Weight::from_ref_time(979).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(979, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Did Did (r:1 w:1) @@ -762,12 +762,12 @@ impl WeightInfo for () { // Minimum execution time: 15_346 nanoseconds. Weight::from_parts(17_226_638, 7314) // Standard Error: 19_165 - .saturating_add(Weight::from_ref_time(921_753).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(921_753, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_proof_size(3090).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 3090).saturating_mul(c.into())) } /// Storage: Did Did (r:1 w:1) /// Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) @@ -785,12 +785,12 @@ impl WeightInfo for () { // Minimum execution time: 17_363 nanoseconds. Weight::from_parts(18_240_688, 7314) // Standard Error: 5_930 - .saturating_add(Weight::from_ref_time(928_602).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(928_602, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_proof_size(3090).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 3090).saturating_mul(c.into())) } /// Storage: Did Did (r:1 w:1) /// Proof: Did Did (max_values: None, max_size: Some(2312), added: 4787, mode: MaxEncodedLen) @@ -1184,7 +1184,7 @@ impl WeightInfo for () { // Minimum execution time: 37_516 nanoseconds. Weight::from_parts(37_912_000, 4787) // Standard Error: 1 - .saturating_add(Weight::from_ref_time(2_150).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(2_150, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Did Did (r:1 w:0) @@ -1197,7 +1197,7 @@ impl WeightInfo for () { // Minimum execution time: 36_395 nanoseconds. Weight::from_parts(36_951_000, 4787) // Standard Error: 0 - .saturating_add(Weight::from_ref_time(1_366).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(1_366, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Did Did (r:1 w:0) @@ -1210,7 +1210,7 @@ impl WeightInfo for () { // Minimum execution time: 32_273 nanoseconds. Weight::from_parts(33_274_000, 4787) // Standard Error: 0 - .saturating_add(Weight::from_ref_time(979).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(979, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Did Did (r:1 w:1) diff --git a/pallets/pallet-web3-names/src/default_weights.rs b/pallets/pallet-web3-names/src/default_weights.rs index 4c976d1f6a..67cf4c39ac 100644 --- a/pallets/pallet-web3-names/src/default_weights.rs +++ b/pallets/pallet-web3-names/src/default_weights.rs @@ -78,7 +78,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 19_822 nanoseconds. Weight::from_parts(21_345_315, 10299) // Standard Error: 17_787 - .saturating_add(Weight::from_ref_time(23_241).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(23_241, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -111,7 +111,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 16_811 nanoseconds. Weight::from_parts(18_600_543, 5219) // Standard Error: 15_740 - .saturating_add(Weight::from_ref_time(12_826).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(12_826, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -131,7 +131,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 18_069 nanoseconds. Weight::from_parts(19_324_271, 7743) // Standard Error: 12_698 - .saturating_add(Weight::from_ref_time(62_295).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(62_295, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -145,7 +145,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 7_796 nanoseconds. Weight::from_parts(8_240_564, 2524) // Standard Error: 5_757 - .saturating_add(Weight::from_ref_time(47_283).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(47_283, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -197,7 +197,7 @@ impl WeightInfo for () { // Minimum execution time: 19_822 nanoseconds. Weight::from_parts(21_345_315, 10299) // Standard Error: 17_787 - .saturating_add(Weight::from_ref_time(23_241).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(23_241, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -230,7 +230,7 @@ impl WeightInfo for () { // Minimum execution time: 16_811 nanoseconds. Weight::from_parts(18_600_543, 5219) // Standard Error: 15_740 - .saturating_add(Weight::from_ref_time(12_826).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(12_826, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -250,7 +250,7 @@ impl WeightInfo for () { // Minimum execution time: 18_069 nanoseconds. Weight::from_parts(19_324_271, 7743) // Standard Error: 12_698 - .saturating_add(Weight::from_ref_time(62_295).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(62_295, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -264,7 +264,7 @@ impl WeightInfo for () { // Minimum execution time: 7_796 nanoseconds. Weight::from_parts(8_240_564, 2524) // Standard Error: 5_757 - .saturating_add(Weight::from_ref_time(47_283).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(47_283, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/pallets/parachain-staking/src/default_weights.rs b/pallets/parachain-staking/src/default_weights.rs index dc0f7bd58a..11dc1bd1b9 100644 --- a/pallets/parachain-staking/src/default_weights.rs +++ b/pallets/parachain-staking/src/default_weights.rs @@ -281,7 +281,7 @@ impl WeightInfo for SubstrateWeight { .saturating_add(Weight::from_parts(1_279_959, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) - .saturating_add(Weight::from_proof_size(15).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 15).saturating_mul(m.into())) } /// Storage: ParachainStaking CandidatePool (r:17 w:1) /// Proof: ParachainStaking CandidatePool (max_values: None, max_size: Some(1790), added: 4265, mode: MaxEncodedLen) @@ -616,7 +616,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 19_448 nanoseconds. Weight::from_parts(21_370_153, 9137) // Standard Error: 12_069 - .saturating_add(Weight::from_ref_time(306_624).saturating_mul(u.into())) + .saturating_add(Weight::from_parts(306_624, 0).saturating_mul(u.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -1245,7 +1245,7 @@ impl WeightInfo for () { // Standard Error: 44_482 .saturating_add(Weight::from_parts(987_177, 0).saturating_mul(n.into())) // Standard Error: 98_860 - .saturating_add(Weight::from_from_partsref_time(859_000, 0).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(859_000, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1263,7 +1263,7 @@ impl WeightInfo for () { // Minimum execution time: 19_448 nanoseconds. Weight::from_parts(21_370_153, 9137) // Standard Error: 12_069 - .saturating_add(Weight::from_ref_time(306_624).saturating_mul(u.into())) + .saturating_add(Weight::from_parts(306_624, 0).saturating_mul(u.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } diff --git a/pallets/public-credentials/src/default_weights.rs b/pallets/public-credentials/src/default_weights.rs index 7e2e6766eb..bc799841a5 100644 --- a/pallets/public-credentials/src/default_weights.rs +++ b/pallets/public-credentials/src/default_weights.rs @@ -78,7 +78,7 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 27_323 nanoseconds. Weight::from_parts(27_065_888, 8120) // Standard Error: 15 - .saturating_add(Weight::from_ref_time(1_595).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_595, 0 ).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -188,7 +188,7 @@ impl WeightInfo for () { // Minimum execution time: 27_323 nanoseconds. Weight::from_parts(27_065_888, 8120) // Standard Error: 15 - .saturating_add(Weight::from_ref_time(1_595).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_595, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } From 88a10cc630deaa695471016519d6c655191d29de Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 26 May 2023 11:31:09 +0200 Subject: [PATCH 14/99] 2 errors --- pallets/attestation/src/lib.rs | 33 ++++----- pallets/attestation/src/migration.rs | 93 +++++++++++++++++++++++--- pallets/attestation/src/mock.rs | 9 ++- pallets/delegation/src/lib.rs | 31 ++++++--- pallets/delegation/src/mock.rs | 19 ++++-- pallets/did/src/lib.rs | 28 +++++--- pallets/did/src/mock.rs | 5 +- pallets/pallet-did-lookup/src/lib.rs | 38 +++++++---- pallets/pallet-did-lookup/src/mock.rs | 11 +-- pallets/pallet-web3-names/src/lib.rs | 49 +++++++++----- pallets/pallet-web3-names/src/mock.rs | 20 +++--- pallets/public-credentials/src/lib.rs | 28 ++++---- pallets/public-credentials/src/mock.rs | 15 +++-- runtimes/peregrine/src/lib.rs | 6 +- runtimes/spiritnet/src/lib.rs | 6 +- runtimes/standalone/src/lib.rs | 6 +- support/src/deposit.rs | 22 ++++-- support/src/migration.rs | 45 +++++++++++++ support/src/traits.rs | 29 ++++---- 19 files changed, 343 insertions(+), 150 deletions(-) diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 9a723b6992..9ebb165867 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -85,13 +85,13 @@ pub mod pallet { use frame_support::{ dispatch::{DispatchResult, DispatchResultWithPostInfo}, pallet_prelude::*, - traits::{Currency, Get, ReservableCurrency, StorageVersion}, + traits::{fungible::MutateHold, tokens::fungible::Inspect, Get, ReservableCurrency, StorageVersion}, }; use frame_system::pallet_prelude::*; use ctype::CtypeHashOf; use kilt_support::{ - deposit::Deposit, + deposit::{Deposit, HFIdentifier}, traits::{CallSources, StorageDepositCollector}, }; @@ -109,7 +109,7 @@ pub mod pallet { pub(crate) type AccountIdOf = ::AccountId; - pub(crate) type BalanceOf = <::Currency as Currency>>::Balance; + pub(crate) type BalanceOf = <::Currency as Inspect>>::Balance; pub(crate) type CurrencyOf = ::Currency; @@ -123,8 +123,8 @@ pub mod pallet { type RuntimeEvent: From> + IsType<::RuntimeEvent>; type WeightInfo: WeightInfo; - /// The currency that is used to reserve funds for each attestation. - type Currency: ReservableCurrency>; + /// The currency that is used to hold funds for each attestation. + type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; /// The deposit that is required for storing an attestation. #[pallet::constant] @@ -147,14 +147,6 @@ pub mod pallet { #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); - // #[pallet::hooks] - // impl Hooks> for Pallet { - // fn on_runtime_upgrade() -> Weight { - // migration::do_migration(); - // () - // } - // } - /// Attestations stored on chain. /// /// It maps from a claim hash to the full attestation. @@ -392,7 +384,7 @@ pub mod pallet { log::debug!("removing Attestation"); - Self::remove_attestation(attestation, claim_hash); + Self::remove_attestation(attestation, claim_hash)?; Self::deposit_event(Event::AttestationRemoved(who, claim_hash)); Ok(Some(::WeightInfo::remove()).into()) @@ -417,7 +409,7 @@ pub mod pallet { log::debug!("removing Attestation"); - Self::remove_attestation(attestation, claim_hash); + Self::remove_attestation(attestation, claim_hash)?; Self::deposit_event(Event::DepositReclaimed(who, claim_hash)); Ok(()) @@ -463,12 +455,13 @@ pub mod pallet { } impl Pallet { - fn remove_attestation(attestation: AttestationDetails, claim_hash: ClaimHashOf) { - kilt_support::free_deposit::, CurrencyOf>(&attestation.deposit); + fn remove_attestation(attestation: AttestationDetails, claim_hash: ClaimHashOf) -> DispatchResult { + kilt_support::free_deposit::, CurrencyOf>(&attestation.deposit)?; Attestations::::remove(claim_hash); if let Some(authorization_id) = &attestation.authorization_id { ExternalAttestations::::remove(authorization_id, claim_hash); } + Ok(()) } } @@ -478,18 +471,18 @@ pub mod pallet { fn deposit( key: &ClaimHashOf, - ) -> Result, >>::Balance>, DispatchError> { + ) -> Result, >>::Balance>, DispatchError> { let attestation = Attestations::::get(key).ok_or(Error::::NotFound)?; Ok(attestation.deposit) } - fn deposit_amount(_key: &ClaimHashOf) -> >>::Balance { + fn deposit_amount(_key: &ClaimHashOf) -> >>::Balance { T::Deposit::get() } fn store_deposit( key: &ClaimHashOf, - deposit: Deposit, >>::Balance>, + deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { let attestation = Attestations::::get(key).ok_or(Error::::NotFound)?; Attestations::::insert(key, AttestationDetails { deposit, ..attestation }); diff --git a/pallets/attestation/src/migration.rs b/pallets/attestation/src/migration.rs index 2221331d98..c202879cbf 100644 --- a/pallets/attestation/src/migration.rs +++ b/pallets/attestation/src/migration.rs @@ -16,16 +16,91 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::pallet_prelude::DispatchResult; +use frame_support::{ + traits::{Get, OnRuntimeUpgrade}, + weights::Weight, +}; +use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use log; +use sp_runtime::SaturatedConversion; +use sp_std::marker::PhantomData; -use crate::{AttestationDetails, Attestations, BalanceOf, Config}; +use crate::{AccountIdOf, AttestationDetails, Attestations, Config, CurrencyOf}; -pub(crate) fn do_migration() { - Attestations::::iter_values().map(|attestations_detail: AttestationDetails| -> DispatchResult { - let deposit = attestations_detail.deposit; - switch_reserved_to_hold::(deposit.owner, deposit.amount); - Ok(()) - }); +pub struct BalanceMigration(PhantomData); + +impl OnRuntimeUpgrade for BalanceMigration { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + log::info!("Attestation: Initiating migration"); + if ensure_upgraded::() { + return do_migration::(); + } else { + log::info!("Attestation: No migration needed. This file should be deleted."); + } + ::DbWeight::get().reads_writes(0, 0) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + use frame_support::ensure; + use sp_std::vec; + + let has_one_user_holds = Attestations::::iter_values() + .map(|details: AttestationDetails| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| !user); + + // before the upgrade, there should be no account with holds + ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + + Ok(vec![]) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { + let has_all_user_holds = Attestations::::iter_values() + .map(|details: AttestationDetails| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| user); + + // before the upgrade, there should be no account with holds + ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); + + Ok(vec![]) + } +} + +/// Checks if there is an user, who has still reserved balance and no holds. If +/// yes, the migration is not executed yet. +fn ensure_upgraded() -> bool { + Attestations::::iter_values() + .map(|details: AttestationDetails| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .any(|user| !user) } -fn switch_reserved_to_hold(owner: T::AccountId, amount: BalanceOf) {} +fn do_migration() -> Weight { + Attestations::::iter() + .map(|(key, attestations_detail)| -> Weight { + let deposit = attestations_detail.deposit; + let error = switch_reserved_to_hold::, CurrencyOf>( + deposit.owner, + deposit.amount.saturated_into(), + ); + + if error.is_ok() { + return ::DbWeight::get().reads_writes(1, 1); + } + + log::error!( + " Attestation: Could not convert reserves to hold from attestation: {:?} ", + key + ); + + ::DbWeight::get().reads_writes(0, 0) + }) + .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) +} diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index 4e23da7ece..7082a62402 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -178,7 +178,10 @@ pub(crate) mod runtime { }; use ctype::{CtypeCreatorOf, CtypeEntryOf}; - use kilt_support::mock::{mock_origin, SubjectId}; + use kilt_support::{ + deposit::HFIdentifier, + mock::{mock_origin, SubjectId}, + }; use super::*; @@ -249,8 +252,8 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { - type FreezeIdentifier = (); - type HoldIdentifier = (); + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; type MaxFreezes = (); type MaxHolds = (); type Balance = Balance; diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index 697c9b52d4..3f69c0f271 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -95,11 +95,14 @@ pub mod pallet { use super::*; use frame_support::{ pallet_prelude::*, - traits::{Currency, StorageVersion}, + traits::{ + fungible::{Inspect, Mutate, MutateHold}, + StorageVersion, + }, }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::Deposit, + deposit::{Deposit, HFIdentifier}, signature::{SignatureVerificationError, VerifySignature}, traits::CallSources, }; @@ -126,7 +129,7 @@ pub mod pallet { pub(crate) type AccountIdOf = ::AccountId; - pub(crate) type BalanceOf = <::Currency as Currency>>::Balance; + pub(crate) type BalanceOf = <::Currency as Inspect>>::Balance; pub(crate) type CurrencyOf = ::Currency; @@ -149,7 +152,9 @@ pub mod pallet { type WeightInfo: WeightInfo; /// The currency that is used to reserve funds for each delegation. - type Currency: ReservableCurrency>; + type Currency: ReservableCurrency> + + Mutate> + + MutateHold, Reason = HFIdentifier>; /// The deposit that is required for storing a delegation. #[pallet::constant] @@ -717,7 +722,10 @@ pub mod pallet { hierarchy_owner: DelegatorIdOf, deposit_owner: AccountIdOf, ) -> DispatchResult { - CurrencyOf::::reserve(&deposit_owner, ::Deposit::get())?; + kilt_support::reserve_deposit::, CurrencyOf>( + deposit_owner.clone(), + ::Deposit::get(), + )?; let root_node = DelegationNode::new_root_node( root_id, @@ -744,7 +752,10 @@ pub mod pallet { mut parent_node: DelegationNode, deposit_owner: AccountIdOf, ) -> DispatchResult { - CurrencyOf::::reserve(&deposit_owner, ::Deposit::get())?; + kilt_support::reserve_deposit::, CurrencyOf>( + deposit_owner, + ::Deposit::get(), + )?; // Add the new node as a child of that node parent_node.try_add_child(delegation_id)?; @@ -955,7 +966,7 @@ pub mod pallet { // We can clear storage now that all children have been removed DelegationNodes::::remove(*delegation); - kilt_support::free_deposit::, CurrencyOf>(&delegation_node.deposit); + kilt_support::free_deposit::, CurrencyOf>(&delegation_node.deposit)?; consumed_weight = consumed_weight.saturating_add(T::DbWeight::get().reads_writes(1, 2)); @@ -972,18 +983,18 @@ pub mod pallet { fn deposit( key: &DelegationNodeIdOf, - ) -> Result, >>::Balance>, DispatchError> { + ) -> Result, >>::Balance>, DispatchError> { let delegation_node = DelegationNodes::::get(key).ok_or(Error::::DelegationNotFound)?; Ok(delegation_node.deposit) } - fn deposit_amount(_key: &DelegationNodeIdOf) -> >>::Balance { + fn deposit_amount(_key: &DelegationNodeIdOf) -> >>::Balance { ::Deposit::get() } fn store_deposit( key: &DelegationNodeIdOf, - deposit: Deposit, >>::Balance>, + deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { let delegation_node = DelegationNodes::::get(key).ok_or(Error::::DelegationNotFound)?; DelegationNodes::::insert( diff --git a/pallets/delegation/src/mock.rs b/pallets/delegation/src/mock.rs index 99adda3f3e..734c9ed842 100644 --- a/pallets/delegation/src/mock.rs +++ b/pallets/delegation/src/mock.rs @@ -18,7 +18,10 @@ use frame_support::{ storage::bounded_btree_set::BoundedBTreeSet, - traits::{Currency, Get}, + traits::{ + fungible::{Inspect, Mutate}, + Get, + }, }; use sp_core::H256; @@ -76,8 +79,9 @@ pub fn initialize_pallet( { for (root_id, details, hierarchy_owner, deposit_owner) in delegation_hierarchies { // manually mint to enable deposit reserving - let balance = CurrencyOf::::free_balance(&deposit_owner); - CurrencyOf::::make_free_balance_be(&deposit_owner, balance + ::Deposit::get()); + + let balance = CurrencyOf::::balance(&deposit_owner); + CurrencyOf::::set_balance(&deposit_owner, balance + ::Deposit::get()); // reserve deposit and store delegation::Pallet::::create_and_store_new_hierarchy( @@ -98,8 +102,8 @@ pub fn initialize_pallet( // manually mint to enable deposit reserving let deposit_owner = del.1.deposit.owner.clone(); - let balance = CurrencyOf::::free_balance(&deposit_owner.clone()); - CurrencyOf::::make_free_balance_be(&deposit_owner.clone(), balance + ::Deposit::get()); + let balance = CurrencyOf::::balance(&deposit_owner); + CurrencyOf::::set_balance(&deposit_owner, balance + ::Deposit::get()); // reserve deposit and store delegation::Pallet::::store_delegation_under_parent( @@ -186,6 +190,7 @@ pub(crate) mod runtime { use attestation::{mock::insert_attestation, AttestationDetails, ClaimHashOf}; use ctype::CtypeEntryOf; use kilt_support::{ + deposit::HFIdentifier, mock::{mock_origin, SubjectId}, signature::EqualVerify, }; @@ -259,8 +264,8 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { - type FreezeIdentifier = (); - type HoldIdentifier = (); + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; type MaxFreezes = (); type MaxHolds = (); type Balance = Balance; diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index 7cd91c4a78..00d9ed95f5 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -117,7 +117,10 @@ use frame_support::{ dispatch::{DispatchResult, Dispatchable, GetDispatchInfo, PostDispatchInfo}, ensure, storage::types::StorageMap, - traits::{Get, OnUnbalanced, WithdrawReasons}, + traits::{ + fungible::{Inspect, InspectHold, MutateHold}, + Get, OnUnbalanced, WithdrawReasons, + }, Parameter, }; use frame_system::ensure_signed; @@ -141,7 +144,7 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::Deposit, + deposit::{Deposit, HFIdentifier}, traits::{CallSources, StorageDepositCollector}, }; use sp_runtime::traits::BadOrigin; @@ -180,7 +183,7 @@ pub mod pallet { #[pallet::origin] pub type Origin = DidRawOrigin, AccountIdOf>; - pub type BalanceOf = as Currency>>::Balance; + pub type BalanceOf = as Inspect>>::Balance; pub(crate) type CurrencyOf = ::Currency; pub(crate) type NegativeImbalanceOf = <::Currency as Currency>>::NegativeImbalance; @@ -215,7 +218,7 @@ pub mod pallet { type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The currency that is used to reserve funds for each did. - type Currency: ReservableCurrency>; + type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; /// The amount of balance that will be taken for each DID as a deposit /// to incentivise fair use of the on chain storage. The deposit can be @@ -529,9 +532,10 @@ pub mod pallet { // Check the free balance before we do any heavy work. ensure!( - >>::can_reserve( + >>::can_hold( + &HFIdentifier::Deposit, &sender, - ::Deposit::get() + ::Fee::get() + ::Deposit::get() ), Error::::UnableToPayFees ); @@ -558,11 +562,15 @@ pub mod pallet { let did_entry = DidDetails::from_creation_details(*details, account_did_auth_key).map_err(Error::::from)?; - CurrencyOf::::reserve(&did_entry.deposit.owner, did_entry.deposit.amount)?; + kilt_support::reserve_deposit::, CurrencyOf>( + did_entry.deposit.owner.clone(), + did_entry.deposit.amount, + )?; // Withdraw the fee. We made sure that enough balance is available. But if this // fails, we don't withdraw anything. let imbalance = >>::withdraw( + /// !TODO! &did_entry.deposit.owner, T::Fee::get(), WithdrawReasons::FEE, @@ -1234,18 +1242,18 @@ pub mod pallet { fn deposit( key: &DidIdentifierOf, - ) -> Result, >>::Balance>, DispatchError> { + ) -> Result, >>::Balance>, DispatchError> { let did_entry = Did::::get(key).ok_or(Error::::NotFound)?; Ok(did_entry.deposit) } - fn deposit_amount(_key: &DidIdentifierOf) -> >>::Balance { + fn deposit_amount(_key: &DidIdentifierOf) -> >>::Balance { T::Deposit::get() } fn store_deposit( key: &DidIdentifierOf, - deposit: Deposit, >>::Balance>, + deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { let did_entry = Did::::get(key).ok_or(Error::::NotFound)?; Did::::insert(key, DidDetails { deposit, ..did_entry }); diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index 38bb372d1b..c8522b94ce 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -22,6 +22,7 @@ use frame_support::{ weights::constants::RocksDbWeight, }; use frame_system::EnsureSigned; +use kilt_support::deposit::HFIdentifier; use pallet_balances::NegativeImbalance; use sp_core::{ecdsa, ed25519, sr25519, Pair}; use sp_runtime::{ @@ -167,8 +168,8 @@ parameter_types! { } impl pallet_balances::Config for Test { - type FreezeIdentifier = (); - type HoldIdentifier = (); + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; type MaxFreezes = (); type MaxHolds = (); type Balance = Balance; diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index d0eb6d5572..468b96a8fb 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -54,11 +54,15 @@ pub mod pallet { use frame_support::{ ensure, pallet_prelude::*, - traits::{Currency, ReservableCurrency, StorageVersion}, + traits::{ + fungible::{InspectHold, MutateHold}, + tokens::fungible::Inspect, + Currency, ReservableCurrency, StorageVersion, + }, }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::Deposit, + deposit::{Deposit, HFIdentifier}, traits::{CallSources, StorageDepositCollector}, }; @@ -73,7 +77,7 @@ pub mod pallet { pub(crate) type DidIdentifierOf = ::DidIdentifier; /// The type used to describe a balance. - pub(crate) type BalanceOf = <::Currency as Currency>>::Balance; + pub(crate) type BalanceOf = <::Currency as Inspect>>::Balance; /// The currency module that keeps track of balances. pub(crate) type CurrencyOf = ::Currency; @@ -97,7 +101,7 @@ pub mod pallet { type DidIdentifier: Parameter + AsRef<[u8]> + MaxEncodedLen + MaybeSerializeDeserialize; /// The currency that is used to reserve funds for each did. - type Currency: ReservableCurrency>; + type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; /// The amount of balance that will be taken for each DID as a deposit /// to incentivise fair use of the on chain storage. The deposit can be @@ -235,7 +239,8 @@ pub mod pallet { ); ensure!( - >>::can_reserve( + >>::can_hold( + &HFIdentifier::Deposit, &sender, ::Deposit::get() ), @@ -269,7 +274,8 @@ pub mod pallet { let source = ::EnsureOrigin::ensure_origin(origin)?; ensure!( - >>::can_reserve( + >>::can_hold( + &HFIdentifier::Deposit, &source.sender(), ::Deposit::get() ), @@ -394,15 +400,19 @@ pub mod pallet { did: did_identifier.clone(), }; - CurrencyOf::::reserve(&record.deposit.owner, record.deposit.amount)?; + kilt_support::deposit::reserve_deposit::, CurrencyOf>( + record.deposit.owner.clone(), + record.deposit.amount, + )?; - ConnectedDids::::mutate(&account, |did_entry| { + ConnectedDids::::mutate(&account, |did_entry| -> DispatchResult { if let Some(old_connection) = did_entry.replace(record) { ConnectedAccounts::::remove(&old_connection.did, &account); Self::deposit_event(Event::::AssociationRemoved(account.clone(), old_connection.did)); - kilt_support::free_deposit::, CurrencyOf>(&old_connection.deposit); + kilt_support::free_deposit::, CurrencyOf>(&old_connection.deposit)?; } - }); + Ok(()) + })?; ConnectedAccounts::::insert(&did_identifier, &account, ()); Self::deposit_event(Event::AssociationEstablished(account, did_identifier)); @@ -412,7 +422,7 @@ pub mod pallet { pub(crate) fn remove_association(account: LinkableAccountId) -> DispatchResult { if let Some(connection) = ConnectedDids::::take(&account) { ConnectedAccounts::::remove(&connection.did, &account); - kilt_support::free_deposit::, CurrencyOf>(&connection.deposit); + kilt_support::free_deposit::, CurrencyOf>(&connection.deposit)?; Self::deposit_event(Event::AssociationRemoved(account, connection.did)); Ok(()) @@ -428,18 +438,18 @@ pub mod pallet { fn deposit( key: &LinkableAccountId, - ) -> Result, >>::Balance>, DispatchError> { + ) -> Result, >>::Balance>, DispatchError> { let record = ConnectedDids::::get(key).ok_or(Error::::NotFound)?; Ok(record.deposit) } - fn deposit_amount(_key: &LinkableAccountId) -> >>::Balance { + fn deposit_amount(_key: &LinkableAccountId) -> >>::Balance { T::Deposit::get() } fn store_deposit( key: &LinkableAccountId, - deposit: Deposit, >>::Balance>, + deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { let record = ConnectedDids::::get(key).ok_or(Error::::NotFound)?; ConnectedDids::::insert(key, ConnectionRecord { deposit, ..record }); diff --git a/pallets/pallet-did-lookup/src/mock.rs b/pallets/pallet-did-lookup/src/mock.rs index be194b92de..3ad741304b 100644 --- a/pallets/pallet-did-lookup/src/mock.rs +++ b/pallets/pallet-did-lookup/src/mock.rs @@ -16,9 +16,9 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{parameter_types, traits::ReservableCurrency}; +use frame_support::{parameter_types, traits::fungible::MutateHold}; use kilt_support::{ - deposit::Deposit, + deposit::{Deposit, HFIdentifier}, mock::{mock_origin, SubjectId}, }; use sp_runtime::{ @@ -94,8 +94,8 @@ parameter_types! { } impl pallet_balances::Config for Test { - type FreezeIdentifier = (); - type HoldIdentifier = (); + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; type MaxFreezes = (); type MaxHolds = (); type Balance = Balance; @@ -153,7 +153,8 @@ pub(crate) fn insert_raw_connection( did: did_identifier.clone(), }; - CurrencyOf::::reserve(&record.deposit.owner, record.deposit.amount).expect("Account should have enough balance"); + CurrencyOf::::hold(&HFIdentifier::Deposit, &record.deposit.owner, record.deposit.amount) + .expect("Account should have enough balance"); ConnectedDids::::mutate(&account, |did_entry| { if let Some(old_connection) = did_entry.replace(record) { diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index a89c119fa4..046c35aee1 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -41,15 +41,19 @@ pub mod pallet { use frame_support::{ pallet_prelude::*, sp_runtime::SaturatedConversion, - traits::{Currency, ReservableCurrency, StorageVersion}, + traits::{ + fungible::{Inspect, InspectHold, MutateHold}, + ReservableCurrency, StorageVersion, + }, Blake2_128Concat, }; use frame_system::pallet_prelude::*; use parity_scale_codec::FullCodec; + use sp_runtime::DispatchError; use sp_std::{fmt::Debug, vec::Vec}; use kilt_support::{ - deposit::Deposit, + deposit::{Deposit, HFIdentifier}, traits::{CallSources, StorageDepositCollector}, }; @@ -67,7 +71,7 @@ pub mod pallet { Web3NameOwnership, Deposit, BalanceOf>, BlockNumberFor>; pub(crate) type CurrencyOf = ::Currency; - pub type BalanceOf = as Currency>>::Balance; + pub type BalanceOf = as Inspect>>::Balance; #[pallet::pallet] #[pallet::storage_version(STORAGE_VERSION)] @@ -99,7 +103,7 @@ pub mod pallet { /// The type of origin after a successful origin check. type OriginSuccess: CallSources, Web3NameOwnerOf>; /// The currency type to reserve and release deposits. - type Currency: ReservableCurrency>; + type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; /// The amount of KILT to deposit to claim a name. #[pallet::constant] type Deposit: Get>; @@ -202,7 +206,7 @@ pub mod pallet { let decoded_name = Self::check_claiming_preconditions(name, &owner, &payer)?; - Self::register_name(decoded_name.clone(), owner.clone(), payer); + Self::register_name(decoded_name.clone(), owner.clone(), payer)?; Self::deposit_event(Event::::Web3NameClaimed { owner, name: decoded_name, @@ -231,7 +235,7 @@ pub mod pallet { let owned_name = Self::check_releasing_preconditions(&owner)?; - Self::unregister_name(&owned_name); + Self::unregister_name(&owned_name)?; Self::deposit_event(Event::::Web3NameReleased { owner, name: owned_name, @@ -259,7 +263,7 @@ pub mod pallet { let decoded_name = Self::check_reclaim_deposit_preconditions(name, &caller)?; - let Web3OwnershipOf:: { owner, .. } = Self::unregister_name(&decoded_name); + let Web3OwnershipOf:: { owner, .. } = Self::unregister_name(&decoded_name)?; Self::deposit_event(Event::::Web3NameReleased { owner, name: decoded_name, @@ -292,7 +296,7 @@ pub mod pallet { let (decoded_name, is_claimed) = Self::check_banning_preconditions(name)?; if is_claimed { - Self::unregister_name(&decoded_name); + Self::unregister_name(&decoded_name)?; } Self::ban_name(&decoded_name); @@ -382,7 +386,11 @@ pub mod pallet { ensure!(!Banned::::contains_key(&name), Error::::Banned); ensure!( - >>::can_reserve(deposit_payer, T::Deposit::get()), + >>::can_hold( + &HFIdentifier::Deposit, + deposit_payer, + T::Deposit::get() + ), Error::::InsufficientFunds ); @@ -393,14 +401,19 @@ pub mod pallet { /// the provided account. This function must be called after /// `check_claiming_preconditions` as it does not verify all the /// preconditions again. - pub(crate) fn register_name(name: Web3NameOf, owner: Web3NameOwnerOf, deposit_payer: AccountIdOf) { + pub(crate) fn register_name( + name: Web3NameOf, + owner: Web3NameOwnerOf, + deposit_payer: AccountIdOf, + ) -> DispatchResult { let deposit = Deposit { owner: deposit_payer, amount: T::Deposit::get(), }; let block_number = frame_system::Pallet::::block_number(); - CurrencyOf::::reserve(&deposit.owner, deposit.amount).unwrap(); + // Should never fail since we checked in the preconditions + kilt_support::reserve_deposit::, CurrencyOf>(deposit.owner.clone(), deposit.amount)?; Names::::insert(&owner, name.clone()); Owner::::insert( @@ -411,6 +424,7 @@ pub mod pallet { deposit, }, ); + Ok(()) } /// Verify that the releasing preconditions for an owner are verified. @@ -443,13 +457,14 @@ pub mod pallet { /// original payer. This function must be called after /// `check_releasing_preconditions` as it does not verify all the /// preconditions again. - fn unregister_name(name: &Web3NameOf) -> Web3OwnershipOf { + fn unregister_name(name: &Web3NameOf) -> Result, DispatchError> { let name_ownership = Owner::::take(name).unwrap(); Names::::remove(&name_ownership.owner); - kilt_support::free_deposit::, CurrencyOf>(&name_ownership.deposit); + // Should never fail since we checked in the preconditions + kilt_support::free_deposit::, CurrencyOf>(&name_ownership.deposit)?; - name_ownership + Ok(name_ownership) } /// Verify that the banning preconditions are verified. @@ -503,19 +518,19 @@ pub mod pallet { fn deposit( key: &T::Web3Name, - ) -> Result, >>::Balance>, DispatchError> { + ) -> Result, >>::Balance>, DispatchError> { let w3n_entry = Owner::::get(key).ok_or(Error::::NotFound)?; Ok(w3n_entry.deposit) } - fn deposit_amount(_key: &T::Web3Name) -> >>::Balance { + fn deposit_amount(_key: &T::Web3Name) -> >>::Balance { T::Deposit::get() } fn store_deposit( key: &T::Web3Name, - deposit: Deposit, >>::Balance>, + deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { let w3n_entry = Owner::::get(key).ok_or(Error::::NotFound)?; Owner::::insert(key, Web3OwnershipOf:: { deposit, ..w3n_entry }); diff --git a/pallets/pallet-web3-names/src/mock.rs b/pallets/pallet-web3-names/src/mock.rs index e8c9f553f5..a30a79a79e 100644 --- a/pallets/pallet-web3-names/src/mock.rs +++ b/pallets/pallet-web3-names/src/mock.rs @@ -15,10 +15,8 @@ // along with this program. If not, see . // If you feel like getting in touch with us, you can do so at info@botlabs.org - -use frame_support::traits::ReservableCurrency; - -use kilt_support::deposit::Deposit; +use frame_support::traits::fungible::MutateHold; +use kilt_support::deposit::{Deposit, HFIdentifier}; use crate::{AccountIdOf, BalanceOf, Config, CurrencyOf, Names, Owner, Web3NameOf, Web3NameOwnerOf, Web3OwnershipOf}; @@ -31,7 +29,7 @@ pub(crate) fn insert_raw_w3n( block_number: BlockNumberOf, deposit: BalanceOf, ) { - CurrencyOf::::reserve(&payer, deposit).expect("Payer should have enough funds for deposit"); + CurrencyOf::::hold(&HFIdentifier::Deposit, &payer, deposit).expect("Payer should have enough funds for deposit"); Names::::insert(&owner, name.clone()); Owner::::insert( @@ -55,7 +53,10 @@ pub use crate::mock::runtime::*; pub(crate) mod runtime { use frame_support::parameter_types; use frame_system::EnsureRoot; - use kilt_support::mock::{mock_origin, SubjectId}; + use kilt_support::{ + deposit::HFIdentifier, + mock::{mock_origin, SubjectId}, + }; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, @@ -128,8 +129,8 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { - type FreezeIdentifier = (); - type HoldIdentifier = (); + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; type MaxFreezes = (); type MaxHolds = (); type Balance = Balance; @@ -228,7 +229,8 @@ pub(crate) mod runtime { ext.execute_with(|| { for (owner, web3_name, payer) in self.claimed_web3_names { - pallet_web3_names::Pallet::::register_name(web3_name, owner, payer); + pallet_web3_names::Pallet::::register_name(web3_name, owner, payer) + .expect("Could not register name"); } for web3_name in self.banned_web3_names { diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index d484220435..58bb9c9d5b 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -53,7 +53,10 @@ pub mod pallet { use frame_support::{ pallet_prelude::*, - traits::{Currency, IsType, ReservableCurrency, StorageVersion}, + traits::{ + fungible::{Inspect, MutateHold}, + IsType, ReservableCurrency, StorageVersion, + }, Parameter, }; use frame_system::pallet_prelude::*; @@ -62,7 +65,7 @@ pub mod pallet { pub use ctype::CtypeHashOf; use kilt_support::{ - deposit::Deposit, + deposit::{Deposit, HFIdentifier}, traits::{CallSources, StorageDepositCollector}, }; @@ -95,7 +98,7 @@ pub mod pallet { /// Type of an attester identifier. pub type AttesterOf = ::AttesterId; /// The type of account's balances. - pub type BalanceOf = as Currency>>::Balance; + pub type BalanceOf = as Inspect>>::Balance; pub(crate) type AuthorizationIdOf = ::AuthorizationId; pub type CredentialIdOf = <::CredentialHash as sp_runtime::traits::Hash>::Output; @@ -128,7 +131,7 @@ pub mod pallet { /// The type of a credential identifier. type CredentialId: Parameter + MaxEncodedLen; /// The currency that is used to reserve funds for each credential. - type Currency: ReservableCurrency>; + type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; /// The type of the origin when successfully converted from the outer /// origin. type OriginSuccess: CallSources>; @@ -284,7 +287,7 @@ pub mod pallet { Error::::AlreadyAttested ); - let deposit = kilt_support::reserve_deposit::>(payer, deposit_amount) + let deposit = kilt_support::reserve_deposit::, CurrencyOf>(payer, deposit_amount) .map_err(|_| Error::::UnableToPayFees)?; let block_number = frame_system::Pallet::::block_number(); @@ -443,7 +446,7 @@ pub mod pallet { // Removes the credential from storage and generates a `CredentialRemoved` // event. - Self::remove_credential_entry(credential_subject, credential_id, credential_entry); + Self::remove_credential_entry(credential_subject, credential_id, credential_entry)?; Ok(Some(::WeightInfo::remove().saturating_add(ac_weight_used)).into()) } @@ -477,7 +480,7 @@ pub mod pallet { // Removes the credential from storage and generates a `CredentialRemoved` // event. - Self::remove_credential_entry(credential_subject, credential_id, credential_entry); + Self::remove_credential_entry(credential_subject, credential_id, credential_entry)?; Ok(()) } @@ -528,8 +531,8 @@ pub mod pallet { credential_subject: T::SubjectId, credential_id: CredentialIdOf, credential: CredentialEntryOf, - ) { - kilt_support::free_deposit::>(&credential.deposit); + ) -> DispatchResult { + kilt_support::free_deposit::>(&credential.deposit)?; Credentials::::remove(&credential_subject, &credential_id); CredentialSubjects::::remove(&credential_id); @@ -537,6 +540,7 @@ pub mod pallet { subject_id: credential_subject, credential_id, }); + Ok(()) } fn retrieve_credential_entry( @@ -592,18 +596,18 @@ pub mod pallet { fn deposit( credential_id: &CredentialIdOf, - ) -> Result, >>::Balance>, DispatchError> { + ) -> Result, >>::Balance>, DispatchError> { let (_, credential_entry) = Pallet::::retrieve_credential_entry(credential_id)?; Ok(credential_entry.deposit) } - fn deposit_amount(_credential_id: &CredentialIdOf) -> >>::Balance { + fn deposit_amount(_credential_id: &CredentialIdOf) -> >>::Balance { T::Deposit::get() } fn store_deposit( credential_id: &CredentialIdOf, - deposit: Deposit, >>::Balance>, + deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { let credential_subject = CredentialSubjects::::get(credential_id).ok_or(Error::::NotFound)?; Credentials::::try_mutate(&credential_subject, credential_id, |credential_entry| { diff --git a/pallets/public-credentials/src/mock.rs b/pallets/public-credentials/src/mock.rs index 160364adad..a0bdecab69 100644 --- a/pallets/public-credentials/src/mock.rs +++ b/pallets/public-credentials/src/mock.rs @@ -23,8 +23,8 @@ use sp_runtime::traits::Hash; use kilt_support::deposit::Deposit; use crate::{ - AttesterOf, BalanceOf, Config, CredentialEntryOf, CredentialIdOf, CredentialSubjects, Credentials, CtypeHashOf, - CurrencyOf, InputClaimsContentOf, InputCredentialOf, InputSubjectIdOf, + AccountIdOf, AttesterOf, BalanceOf, Config, CredentialEntryOf, CredentialIdOf, CredentialSubjects, Credentials, + CtypeHashOf, CurrencyOf, InputClaimsContentOf, InputCredentialOf, InputSubjectIdOf, }; // Generate a public credential using a many Default::default() as possible. @@ -76,7 +76,7 @@ pub(crate) fn insert_public_credentials( credential_id: CredentialIdOf, credential_entry: CredentialEntryOf, ) { - kilt_support::reserve_deposit::>( + kilt_support::reserve_deposit::, CurrencyOf>( credential_entry.deposit.owner.clone(), credential_entry.deposit.amount, ) @@ -109,7 +109,10 @@ pub(crate) mod runtime { DispatchError, MultiSignature, MultiSigner, }; - use kilt_support::mock::{mock_origin, SubjectId}; + use kilt_support::{ + deposit::HFIdentifier, + mock::{mock_origin, SubjectId}, + }; use ctype::{CtypeCreatorOf, CtypeEntryOf, CtypeHashOf}; @@ -319,8 +322,8 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { - type FreezeIdentifier = (); - type HoldIdentifier = (); + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; type MaxFreezes = (); type MaxHolds = (); type Balance = Balance; diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 10e35fe96c..e1cbb8ddcc 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -50,7 +50,7 @@ use sp_version::RuntimeVersion; use xcm_executor::XcmExecutor; use delegation::DelegationAc; -use kilt_support::traits::ItemFilter; +use kilt_support::{deposit::HFIdentifier, traits::ItemFilter}; use pallet_did_lookup::linkable_account::LinkableAccountId; pub use parachain_staking::InflationInfo; pub use public_credentials; @@ -197,8 +197,8 @@ impl pallet_indices::Config for Runtime { impl pallet_balances::Config for Runtime { /// The type for recording an account's balance. type Balance = Balance; - type FreezeIdentifier = (); - type HoldIdentifier = (); + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; type MaxFreezes = (); type MaxHolds = (); diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index c8a4ee3697..5eb6bc6bb0 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -50,7 +50,7 @@ use sp_version::RuntimeVersion; use xcm_executor::XcmExecutor; use delegation::DelegationAc; -use kilt_support::traits::ItemFilter; +use kilt_support::{deposit::HFIdentifier, traits::ItemFilter}; use pallet_did_lookup::linkable_account::LinkableAccountId; pub use parachain_staking::InflationInfo; pub use public_credentials; @@ -195,8 +195,8 @@ impl pallet_indices::Config for Runtime { } impl pallet_balances::Config for Runtime { - type FreezeIdentifier = (); - type HoldIdentifier = (); + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; type MaxFreezes = (); type MaxHolds = (); /// The type for recording an account's balance. diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index 08abe7c3e3..fb228a842f 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -54,7 +54,7 @@ use sp_std::prelude::*; use sp_version::RuntimeVersion; use delegation::DelegationAc; -use kilt_support::traits::ItemFilter; +use kilt_support::{deposit::HFIdentifier, traits::ItemFilter}; use pallet_did_lookup::linkable_account::LinkableAccountId; use runtime_common::{ assets::{AssetDid, PublicCredentialsFilter}, @@ -250,8 +250,8 @@ parameter_types! { } impl pallet_balances::Config for Runtime { - type FreezeIdentifier = (); - type HoldIdentifier = (); + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; type MaxFreezes = (); type MaxHolds = (); type MaxLocks = MaxLocks; diff --git a/support/src/deposit.rs b/support/src/deposit.rs index 00ad18f04e..d6d48eab7d 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -16,11 +16,20 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::traits::ReservableCurrency; +use frame_support::{pallet_prelude::DispatchResult, traits::fungible::hold::Mutate}; + +use frame_support::traits::tokens::Precision; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::{traits::Zero, DispatchError}; +#[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen, Copy)] +pub enum HFIdentifier { + Deposit, + Staking, + Misc, +} + /// An amount of balance reserved by the specified address. #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen)] @@ -29,18 +38,21 @@ pub struct Deposit { pub amount: Balance, } -pub fn reserve_deposit>( +pub fn reserve_deposit>( account: Account, deposit_amount: Currency::Balance, ) -> Result, DispatchError> { - Currency::reserve(&account, deposit_amount)?; + Currency::hold(&HFIdentifier::Deposit, &account, deposit_amount)?; Ok(Deposit { owner: account, amount: deposit_amount, }) } -pub fn free_deposit>(deposit: &Deposit) { - let err_amount = Currency::unreserve(&deposit.owner, deposit.amount); +pub fn free_deposit>( + deposit: &Deposit, +) -> DispatchResult { + let err_amount = Currency::release(&HFIdentifier::Deposit, &deposit.owner, deposit.amount, Precision::Exact)?; debug_assert!(err_amount.is_zero()); + Ok(()) } diff --git a/support/src/migration.rs b/support/src/migration.rs index 79e74681a2..06c1d2dbc1 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -15,3 +15,48 @@ // along with this program. If not, see . // If you feel like getting in touch with us, you can do so at info@botlabs.org + +use frame_support::{ + pallet_prelude::DispatchResult, + traits::{ + fungible::{ + freeze::{Inspect as InspectFreeze, Mutate as MutateFreeze}, + hold::{Inspect as InspectHold, Mutate as MutateHold}, + }, + ReservableCurrency, + }, +}; +use sp_runtime::SaturatedConversion; + +use crate::deposit::HFIdentifier; + +pub fn has_user_holds_and_no_reserves< + AccountId, + Currency: ReservableCurrency + MutateHold + InspectHold, +>( + owner: &AccountId, +) -> bool { + Currency::balance_on_hold(&HFIdentifier::Deposit, owner).saturated_into::() > 0 + && Currency::reserved_balance(owner).saturated_into::() == 0 +} + +pub fn has_user_freezes< + AccountId, + Currency: ReservableCurrency + MutateFreeze + InspectFreeze, +>( + owner: &AccountId, + reason: &HFIdentifier, +) -> bool { + Currency::balance_frozen(reason, owner).saturated_into::() > 0 +} + +pub fn switch_reserved_to_hold< + AccountId, + Currency: ReservableCurrency + MutateHold + InspectHold, +>( + owner: AccountId, + amount: u128, +) -> DispatchResult { + Currency::unreserve(&owner, amount.saturated_into()); + Currency::hold(&HFIdentifier::Deposit, &owner, amount.saturated_into()) +} diff --git a/support/src/traits.rs b/support/src/traits.rs index 0d4050163e..2b7d65645c 100644 --- a/support/src/traits.rs +++ b/support/src/traits.rs @@ -16,10 +16,16 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::traits::{Currency, ReservableCurrency}; +use frame_support::traits::{ + fungible::hold::{Inspect as InspectHold, Mutate}, + tokens::fungible::Inspect, +}; use sp_runtime::DispatchError; -use crate::{deposit::Deposit, free_deposit}; +use crate::{ + deposit::{Deposit, HFIdentifier}, + free_deposit, +}; /// The sources of a call struct. /// @@ -87,24 +93,23 @@ pub trait ItemFilter { } pub trait StorageDepositCollector { - type Currency: ReservableCurrency; + type Currency: Mutate + InspectHold; /// Returns the deposit of the storage entry that is stored behind the key. - fn deposit( - key: &Key, - ) -> Result>::Balance>, DispatchError>; + fn deposit(key: &Key) + -> Result>::Balance>, DispatchError>; /// Returns the deposit amount that should be reserved for the storage entry /// behind the key. /// /// This value can differ from the actual deposit that is reserved at the /// time, since the deposit can be changed. - fn deposit_amount(key: &Key) -> >::Balance; + fn deposit_amount(key: &Key) -> >::Balance; /// Store the new deposit information in the storage entry behind the key. fn store_deposit( key: &Key, - deposit: Deposit>::Balance>, + deposit: Deposit>::Balance>, ) -> Result<(), DispatchError>; /// Change the deposit owner. @@ -115,13 +120,13 @@ pub trait StorageDepositCollector { fn change_deposit_owner(key: &Key, new_owner: AccountId) -> Result<(), DispatchError> { let deposit = Self::deposit(key)?; - free_deposit::(&deposit); + free_deposit::(&deposit)?; let deposit = Deposit { owner: new_owner, ..deposit }; - Self::Currency::reserve(&deposit.owner, deposit.amount)?; + Self::Currency::hold(&HFIdentifier::Deposit, &deposit.owner, deposit.amount)?; Self::store_deposit(key, deposit)?; @@ -137,13 +142,13 @@ pub trait StorageDepositCollector { fn update_deposit(key: &Key) -> Result<(), DispatchError> { let deposit = Self::deposit(key)?; - free_deposit::(&deposit); + free_deposit::(&deposit)?; let deposit = Deposit { amount: Self::deposit_amount(key), ..deposit }; - Self::Currency::reserve(&deposit.owner, deposit.amount)?; + Self::Currency::hold(&HFIdentifier::Deposit, &deposit.owner, deposit.amount)?; Self::store_deposit(key, deposit)?; From b9e23a2b99d4e3b62faa8126ec766c9176d33683 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 26 May 2023 16:34:06 +0200 Subject: [PATCH 15/99] with working tests --- Cargo.lock | 8 +- pallets/attestation/src/mock.rs | 6 +- pallets/attestation/src/tests.rs | 65 ++-- pallets/delegation/src/mock.rs | 6 +- pallets/delegation/src/tests.rs | 208 ++++++++----- pallets/did/src/lib.rs | 10 +- pallets/did/src/mock.rs | 10 +- pallets/did/src/tests.rs | 291 +++++++++++------- pallets/pallet-configuration/Cargo.toml | 3 + pallets/pallet-configuration/src/mock.rs | 7 + pallets/pallet-did-lookup/Cargo.toml | 1 + pallets/pallet-did-lookup/src/lib.rs | 47 ++- pallets/pallet-did-lookup/src/mock.rs | 26 +- pallets/pallet-did-lookup/src/tests.rs | 4 +- pallets/pallet-inflation/src/mock.rs | 6 +- pallets/pallet-web3-names/src/mock.rs | 6 +- pallets/pallet-web3-names/src/tests.rs | 4 +- pallets/public-credentials/src/mock.rs | 4 +- runtimes/common/Cargo.toml | 30 +- .../spiritnet/src/weights/pallet_balances.rs | 7 +- support/src/deposit.rs | 8 +- 21 files changed, 480 insertions(+), 277 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 054c65ac23..1e713374a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6013,6 +6013,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "kilt-support", "pallet-balances", "parity-scale-codec", "scale-info", @@ -6075,6 +6076,7 @@ dependencies = [ "log", "pallet-balances", "parity-scale-codec", + "runtime-common", "scale-info", "serde", "sha3", @@ -9270,10 +9272,7 @@ name = "runtime-common" version = "1.11.0-dev" dependencies = [ "attestation", - "ctype", "cumulus-primitives-core", - "delegation", - "did", "frame-support", "frame-system", "kilt-asset-dids", @@ -9281,11 +9280,8 @@ dependencies = [ "log", "pallet-authorship", "pallet-balances", - "pallet-did-lookup", - "pallet-inflation", "pallet-membership", "pallet-transaction-payment", - "pallet-web3-names", "parachain-staking", "parity-scale-codec", "polkadot-parachain", diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index 35ffdb52af..8402d74256 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -249,13 +249,15 @@ pub(crate) mod runtime { pub const ExistentialDeposit: Balance = MILLI_UNIT; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; + pub const MaxFreezes: u32 = 50; + pub const MaxHolds : u32 = 50; } impl pallet_balances::Config for Test { type FreezeIdentifier = HFIdentifier; type HoldIdentifier = HFIdentifier; - type MaxFreezes = (); - type MaxHolds = (); + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; type Balance = Balance; type DustRemoval = (); type RuntimeEvent = (); diff --git a/pallets/attestation/src/tests.rs b/pallets/attestation/src/tests.rs index 4c1ad729bb..e01631f9b6 100644 --- a/pallets/attestation/src/tests.rs +++ b/pallets/attestation/src/tests.rs @@ -17,10 +17,13 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use ctype::mock::get_ctype_hash; -use frame_support::{assert_noop, assert_ok}; -use sp_runtime::{traits::Zero, DispatchError}; +use frame_support::{assert_noop, assert_ok, traits::fungible::InspectHold}; +use sp_runtime::{traits::Zero, DispatchError, TokenError}; -use kilt_support::{deposit::Deposit, mock::mock_origin::DoubleOrigin}; +use kilt_support::{ + deposit::{Deposit, HFIdentifier}, + mock::mock_origin::DoubleOrigin, +}; use crate::{ self as attestation, @@ -183,7 +186,10 @@ fn test_revoke_remove() { Attestation::attestations(claim_hash).expect("Attestation should be present on chain."); assert!(stored_attestation.revoked); - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); assert_ok!(Attestation::remove( DoubleOrigin(ACCOUNT_00, revoker.clone()).into(), @@ -191,7 +197,7 @@ fn test_revoke_remove() { None )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); }); } @@ -219,7 +225,10 @@ fn test_authorized_revoke() { assert!(Attestation::external_attestations(revoker.clone(), claim_hash)); assert!(stored_attestation.revoked); - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); }); } @@ -376,7 +385,7 @@ fn test_remove_not_found() { .with_balances(vec![(ACCOUNT_00, ::Deposit::get() * 100)]) .with_ctypes(vec![(attestation.ctype_hash, attester.clone())]) .build_and_execute_with_sanity_tests(|| { - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); assert_noop!( Attestation::remove(DoubleOrigin(ACCOUNT_00, attester.clone()).into(), claim_hash, None), attestation::Error::::NotFound @@ -400,7 +409,10 @@ fn test_reclaim_deposit() { .with_ctypes(vec![(attestation.ctype_hash, attester)]) .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); assert_ok!(Attestation::reclaim_deposit( RuntimeOrigin::signed(ACCOUNT_00), claim_hash @@ -410,7 +422,7 @@ fn test_reclaim_deposit() { claim_hash )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); }); } @@ -425,13 +437,16 @@ fn test_reclaim_deposit_authorization() { .with_ctypes(vec![(attestation.ctype_hash, attester)]) .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); assert_ok!(Attestation::reclaim_deposit( RuntimeOrigin::signed(ACCOUNT_00), claim_hash )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); }); } @@ -489,7 +504,10 @@ fn test_change_deposit_owner() { .with_ctypes(vec![(attestation.ctype_hash, attester.clone())]) .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); assert_ok!(Attestation::change_deposit_owner( DoubleOrigin(ACCOUNT_01, attester).into(), claim_hash @@ -503,8 +521,11 @@ fn test_change_deposit_owner() { amount: ::Deposit::get() } ); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + ::Deposit::get() + ); }); } @@ -521,10 +542,13 @@ fn test_change_deposit_owner_insufficient_balance() { .with_ctypes(vec![(attestation.ctype_hash, attester.clone())]) .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); assert_noop!( Attestation::change_deposit_owner(DoubleOrigin(ACCOUNT_01, attester).into(), claim_hash), - pallet_balances::Error::::InsufficientBalance + TokenError::CannotCreateHold ); }); } @@ -582,7 +606,7 @@ fn test_update_deposit() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::Deposit::get() * 2 ); assert_ok!(Attestation::update_deposit( @@ -600,7 +624,10 @@ fn test_update_deposit() { ); // old deposit was 2x Deposit::get(), new deposit should be the the default // deposit value. - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); }); } @@ -621,7 +648,7 @@ fn test_update_deposit_unauthorized() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::Deposit::get() * 2 ); assert_noop!( diff --git a/pallets/delegation/src/mock.rs b/pallets/delegation/src/mock.rs index 3af5e77b86..08c0431fce 100644 --- a/pallets/delegation/src/mock.rs +++ b/pallets/delegation/src/mock.rs @@ -261,13 +261,15 @@ pub(crate) mod runtime { pub const ExistentialDeposit: Balance = 1; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; + pub const MaxHolds: u32 = 50; + pub const MaxFreezes: u32 = 50; } impl pallet_balances::Config for Test { type FreezeIdentifier = HFIdentifier; type HoldIdentifier = HFIdentifier; - type MaxFreezes = (); - type MaxHolds = (); + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; type Balance = Balance; type DustRemoval = (); type RuntimeEvent = (); diff --git a/pallets/delegation/src/tests.rs b/pallets/delegation/src/tests.rs index f09927ed1b..85199a542f 100644 --- a/pallets/delegation/src/tests.rs +++ b/pallets/delegation/src/tests.rs @@ -16,15 +16,18 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{assert_err, assert_noop, assert_ok, traits::Currency}; -use kilt_support::mock::mock_origin::DoubleOrigin; +use frame_support::{ + assert_err, assert_noop, assert_ok, + traits::fungible::{Inspect, InspectHold}, +}; +use kilt_support::{deposit::HFIdentifier, mock::mock_origin::DoubleOrigin}; use crate::{ self as delegation, mock::{runtime::*, *}, Config, Error, }; -use sp_runtime::traits::Zero; +use sp_runtime::{traits::Zero, TokenError}; // submit_delegation_root_creation_operation() @@ -40,7 +43,7 @@ fn create_root_delegation_successful() { .with_balances(vec![( ACCOUNT_00, ::Deposit::get() - + <::Currency as Currency>>::minimum_balance(), + + <::Currency as Inspect>>::minimum_balance(), )]) .build_and_execute_with_sanity_tests(|| { // Create root hierarchy @@ -51,7 +54,10 @@ fn create_root_delegation_successful() { )); // Check reserved balance - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); // Get stored hierarchy let stored_hierarchy_details = Delegation::delegation_hierarchies(hierarchy_root_id) @@ -143,12 +149,12 @@ fn create_delegation_direct_root_successful() { ( ACCOUNT_00, ::Deposit::get() - + <::Currency as Currency>>::minimum_balance(), + + <::Currency as Inspect>>::minimum_balance(), ), ( ACCOUNT_01, ::Deposit::get() - + <::Currency as Currency>>::minimum_balance(), + + <::Currency as Inspect>>::minimum_balance(), ), ]) .build_and_execute_with_sanity_tests(|| { @@ -167,7 +173,10 @@ fn create_delegation_direct_root_successful() { generate_base_delegation_creation_operation(delegation_id, delegate_signature, delegation_node); // 1 Deposit should be reserved for hierarchy - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); // Add delegation to root assert_ok!(Delegation::add_delegation( @@ -181,7 +190,7 @@ fn create_delegation_direct_root_successful() { // 2 Deposits should be reserved for hierarchy and delegation to root assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), 2 * ::Deposit::get() ); @@ -226,12 +235,12 @@ fn create_delegation_with_parent_successful() { ( ACCOUNT_00, ::Deposit::get() - + <::Currency as Currency>>::minimum_balance(), + + <::Currency as Inspect>>::minimum_balance(), ), ( ACCOUNT_01, ::Deposit::get() - + <::Currency as Currency>>::minimum_balance(), + + <::Currency as Inspect>>::minimum_balance(), ), ]) .build_and_execute_with_sanity_tests(|| { @@ -251,7 +260,7 @@ fn create_delegation_with_parent_successful() { // Should have deposited for hierarchy and parent delegation assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), 2 * ::Deposit::get() ); @@ -267,10 +276,10 @@ fn create_delegation_with_parent_successful() { // Should have deposited for hierarchy, parent delegation and sub-delegation assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), 3 * ::Deposit::get() ); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); // Data in stored delegation and operation should match let stored_delegation = @@ -708,10 +717,13 @@ fn list_hierarchy_revoke_and_remove_root_successful() { .build_and_execute_with_sanity_tests(|| { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_some()); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), 2 * ::Deposit::get() ); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + ::Deposit::get() + ); // Revoke root assert_ok!(Delegation::revoke_delegation( @@ -752,8 +764,8 @@ fn list_hierarchy_revoke_and_remove_root_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); }); } @@ -821,10 +833,13 @@ fn tree_hierarchy_revoke_and_remove_root_successful() { ); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), 2 * ::Deposit::get() ); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + ::Deposit::get() + ); // Removing root should also remove children and hierarchy assert_ok!(Delegation::remove_delegation( @@ -837,8 +852,8 @@ fn tree_hierarchy_revoke_and_remove_root_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation2_id).is_none()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); }); } @@ -902,10 +917,13 @@ fn max_max_revocations_revoke_and_remove_successful() { ); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), 2 * ::Deposit::get() ); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + ::Deposit::get() + ); // Removing root should also remove children and hierarchy assert_ok!(Delegation::remove_delegation( @@ -918,8 +936,8 @@ fn max_max_revocations_revoke_and_remove_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); }); } @@ -1079,7 +1097,10 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { (delegation3_id, delegation3_node), ]) .build_and_execute_with_sanity_tests(|| { - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); // Should not revoke root because tree traversal steps are insufficient // assert_err and not assert_noop because the storage is indeed changed, but @@ -1121,9 +1142,12 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { ); // Should not remove root because tree traversal steps are insufficient - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); assert_eq!( - Balances::reserved_balance(ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), 3 * ::Deposit::get() ); // assert_err and not assert_noop because the storage is indeed changed, but @@ -1141,9 +1165,12 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { assert!(Delegation::delegation_nodes(delegation1_id).is_some()); assert!(Delegation::delegation_nodes(delegation2_id).is_some()); assert!(Delegation::delegation_nodes(delegation3_id).is_some()); - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); assert_eq!( - Balances::reserved_balance(ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), 3 * ::Deposit::get() ); @@ -1156,8 +1183,8 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { assert!(Delegation::delegation_nodes(operation.id).is_none()); assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation3_id).is_none()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); }); } @@ -1226,10 +1253,13 @@ fn direct_owner_revoke_and_remove_delegation_successful() { ); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), 2 * ::Deposit::get() ); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + ::Deposit::get() + ); // Removing root delegation should also remove its child but not hierarchy root assert_ok!(Delegation::remove_delegation( @@ -1242,8 +1272,11 @@ fn direct_owner_revoke_and_remove_delegation_successful() { assert!(Delegation::delegation_nodes(operation.delegation_id).is_none()); assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); }); } @@ -1283,10 +1316,13 @@ fn parent_owner_revoke_delegation_successful() { .build_and_execute_with_sanity_tests(|| { // Parent should not be able to remove the child delegation directly assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), 2 * ::Deposit::get() ); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + ::Deposit::get() + ); assert_noop!( Delegation::remove_delegation( DoubleOrigin(ACCOUNT_00, revoker.clone()).into(), @@ -1328,10 +1364,10 @@ fn parent_owner_revoke_delegation_successful() { assert!(Delegation::delegation_nodes(parent_id).is_some()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), 2 * ::Deposit::get() ); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); }); } @@ -1461,9 +1497,18 @@ fn parent_too_far_revoke_and_remove_delegation_error() { ); // removal - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); - assert_eq!(Balances::reserved_balance(ACCOUNT_02), ::Deposit::get()); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_02), + ::Deposit::get() + ); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + ::Deposit::get() + ); assert_noop!( Delegation::remove_delegation( @@ -1570,8 +1615,8 @@ fn direct_owner_reclaim_deposit_delegation_successful() { assert!(Delegation::delegation_nodes(delegation_id).is_none()); // We have released all the deposits by deleting the root node. - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); }); } @@ -1604,10 +1649,13 @@ fn parent_owner_reclaim_deposit_error() { // Parent should not be able to claim the deposit for the child delegation // directly assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), 2 * ::Deposit::get() ); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + ::Deposit::get() + ); assert_noop!( Delegation::reclaim_deposit( RuntimeOrigin::signed(ACCOUNT_00), @@ -1977,7 +2025,7 @@ fn is_delegating_delegation_not_found() { let mut ext = ExtBuilder::default() .with_balances(vec![( ACCOUNT_00, - <::Currency as Currency>>::minimum_balance(), + <::Currency as Inspect>>::minimum_balance(), )]) .with_delegation_hierarchies(vec![(hierarchy_root_id, hierarchy_details, user_1.clone(), ACCOUNT_00)]) .build(); @@ -2046,7 +2094,10 @@ fn remove_single_hierarchy() { .build_and_execute_with_sanity_tests(|| { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_some()); assert!(Delegation::delegation_nodes(hierarchy_root_id).is_some()); - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); // Remove assert_noop!( @@ -2064,7 +2115,7 @@ fn remove_single_hierarchy() { )); assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(hierarchy_root_id).is_none()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); }); } @@ -2114,12 +2165,18 @@ fn remove_children_gas_runs_out() { (delegation4_id, delegation4_node), ]) .build_and_execute_with_sanity_tests(|| { - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); assert_eq!( - Balances::reserved_balance(ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), 3 * ::Deposit::get() ); - assert_eq!(Balances::reserved_balance(ACCOUNT_02), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_02), + ::Deposit::get() + ); // Should not be able to remove root because tree traversal steps are // insufficient @@ -2139,12 +2196,18 @@ fn remove_children_gas_runs_out() { assert!(Delegation::delegation_nodes(delegation2_id).is_some()); assert!(Delegation::delegation_nodes(delegation3_id).is_some()); assert!(Delegation::delegation_nodes(delegation4_id).is_some()); - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); assert_eq!( - Balances::reserved_balance(ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + ::Deposit::get() + ); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), 3 * ::Deposit::get() ); - assert_eq!(Balances::reserved_balance(ACCOUNT_02), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_02), + ::Deposit::get() + ); // Should be able to remove root only with depth = #_of_children + 1 assert_ok!(Delegation::remove_delegation( @@ -2156,9 +2219,9 @@ fn remove_children_gas_runs_out() { assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation2_id).is_none()); assert!(Delegation::delegation_nodes(delegation3_id).is_none()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); - assert!(Balances::reserved_balance(ACCOUNT_02).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_02).is_zero()); }); } @@ -2189,7 +2252,7 @@ fn test_change_deposit_owner() { ( ACCOUNT_01, ::Deposit::get() - + <::Currency as Currency>>::minimum_balance(), + + <::Currency as Inspect>>::minimum_balance(), ), ]) .with_ctypes(vec![(hierarchy_details.ctype_hash, root_owner.clone())]) @@ -2197,10 +2260,10 @@ fn test_change_deposit_owner() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::Deposit::get() * 3 ); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); assert_ok!(Delegation::change_deposit_owner( DoubleOrigin(ACCOUNT_01, delegate).into(), delegation_id @@ -2208,10 +2271,13 @@ fn test_change_deposit_owner() { // ACCOUNT_00 has still one deposit (there are two nodes) assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::Deposit::get() * 2 ); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + ::Deposit::get() + ); }); } @@ -2240,13 +2306,13 @@ fn test_change_deposit_owner_insufficient_balance() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::Deposit::get() * 3 ); - assert!(Balances::reserved_balance(ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); assert_noop!( Delegation::change_deposit_owner(DoubleOrigin(ACCOUNT_01, delegate).into(), delegation_id), - pallet_balances::Error::::InsufficientBalance + TokenError::CannotCreateHold ); }); } @@ -2341,7 +2407,7 @@ fn test_update_deposit() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::Deposit::get() * 3 ); assert_ok!(Delegation::update_deposit( @@ -2351,7 +2417,7 @@ fn test_update_deposit() { // ACCOUNT_00 has still one deposit (there are two nodes) assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::Deposit::get() * 2 ); }); @@ -2382,7 +2448,7 @@ fn test_update_deposit_unauthorized() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::Deposit::get() * 3 ); assert_noop!( diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index f4b138dbd8..a193012de1 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -119,10 +119,7 @@ use frame_support::{ dispatch::{DispatchError, DispatchResult, Dispatchable, GetDispatchInfo, PostDispatchInfo}, ensure, storage::types::StorageMap, - traits::{ - fungible::{Inspect, InspectHold, MutateHold}, - Get, OnUnbalanced, WithdrawReasons, - }, + traits::{Get, OnUnbalanced, WithdrawReasons}, Parameter, }; use frame_system::ensure_signed; @@ -142,7 +139,10 @@ pub mod pallet { use crate::service_endpoints::utils as service_endpoints_utils; use frame_support::{ pallet_prelude::*, - traits::{Currency, ExistenceRequirement, Imbalance, ReservableCurrency, StorageVersion}, + traits::{ + fungible::{Inspect, InspectHold, MutateHold}, + Currency, ExistenceRequirement, Imbalance, ReservableCurrency, StorageVersion, + }, }; use frame_system::pallet_prelude::*; use kilt_support::{ diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index 3fdada7dc2..95a0587ed6 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -18,7 +18,7 @@ use frame_support::{ parameter_types, - traits::{Currency, OnUnbalanced, ReservableCurrency}, + traits::{fungible::MutateHold, Currency, OnUnbalanced}, weights::constants::RocksDbWeight, }; use frame_system::EnsureSigned; @@ -171,13 +171,15 @@ parameter_types! { pub const ExistentialDeposit: Balance = 500; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; + pub const MaxHolds: u32 = 50; + pub const MaxFreezes: u32 = 50; } impl pallet_balances::Config for Test { type FreezeIdentifier = HFIdentifier; type HoldIdentifier = HFIdentifier; - type MaxFreezes = (); - type MaxHolds = (); + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; type Balance = Balance; type DustRemoval = (); type RuntimeEvent = (); @@ -495,7 +497,7 @@ impl ExtBuilder { for did in self.dids_stored.iter() { did::Did::::insert(&did.0, did.1.clone()); - CurrencyOf::::reserve(&did.1.deposit.owner, did.1.deposit.amount) + CurrencyOf::::hold(&HFIdentifier::Deposit, &did.1.deposit.owner, did.1.deposit.amount) .expect("Deposit owner should have enough balance"); } for did in self.deleted_dids.iter() { diff --git a/pallets/did/src/tests.rs b/pallets/did/src/tests.rs index 1db4e33278..8c12bfee4f 100644 --- a/pallets/did/src/tests.rs +++ b/pallets/did/src/tests.rs @@ -16,12 +16,16 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{assert_err, assert_noop, assert_ok, traits::Currency}; +use frame_support::{ + assert_err, assert_noop, assert_ok, + traits::fungible::{Inspect, InspectHold}, +}; +use kilt_support::deposit::HFIdentifier; use parity_scale_codec::Encode; use sp_core::{ed25519, Pair}; use sp_runtime::{ traits::{BadOrigin, Hash, Zero}, - SaturatedConversion, + SaturatedConversion, TokenError, }; use sp_std::{ collections::btree_set::BTreeSet, @@ -50,7 +54,7 @@ fn check_successful_simple_ed25519_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -74,11 +78,11 @@ fn check_successful_simple_ed25519_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::BaseDeposit::get() ); - assert_eq!(Balances::free_balance(ACCOUNT_FEE), ::Fee::get()); + assert_eq!(Balances::balance(&ACCOUNT_FEE), ::Fee::get()); }); } @@ -93,7 +97,7 @@ fn check_successful_simple_sr25519_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -117,10 +121,10 @@ fn check_successful_simple_sr25519_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::BaseDeposit::get() ); - assert_eq!(Balances::free_balance(ACCOUNT_FEE), ::Fee::get()); + assert_eq!(Balances::balance(&ACCOUNT_FEE), ::Fee::get()); }); } @@ -135,7 +139,7 @@ fn check_successful_simple_ecdsa_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -159,10 +163,10 @@ fn check_successful_simple_ecdsa_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::BaseDeposit::get() ); - assert_eq!(Balances::free_balance(ACCOUNT_FEE), ::Fee::get()); + assert_eq!(Balances::balance(&ACCOUNT_FEE), ::Fee::get()); }); } @@ -206,7 +210,7 @@ fn check_successful_complete_creation() { + required_balance_for_key_agreement + ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) @@ -275,13 +279,13 @@ fn check_successful_complete_creation() { ); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::BaseDeposit::get() + required_balance_for_endpoint + required_balance_for_key_agreement + required_balance_for_keys ); - assert_eq!(Balances::free_balance(ACCOUNT_FEE), ::Fee::get()); + assert_eq!(Balances::balance(&ACCOUNT_FEE), ::Fee::get()); }); } @@ -297,7 +301,9 @@ fn check_deposit_change_by_adding_service_endpoint() { let new_service_endpoint2: DidEndpoint = DidEndpoint::new(b"id2".to_vec(), vec![b"type2".to_vec()], vec![b"url2".to_vec()]); - let balance = ::BaseDeposit::get() + ::ServiceEndpointDeposit::get(); + let balance = ::BaseDeposit::get() + + ::ServiceEndpointDeposit::get() + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(alice_did.clone(), balance)]) @@ -310,15 +316,18 @@ fn check_deposit_change_by_adding_service_endpoint() { )); assert_eq!( - Balances::reserved_balance(alice_did.clone()), + Balances::balance_on_hold(&HFIdentifier::Deposit, &alice_did), ::ServiceEndpointDeposit::get() + ::BaseDeposit::get() ); - assert_eq!(Balances::free_balance(alice_did.clone()), Zero::zero()); + assert_eq!( + Balances::balance(&alice_did), + <::Currency as Inspect>>::minimum_balance() + ); assert_noop!( Did::add_service_endpoint(RuntimeOrigin::signed(alice_did.clone()), new_service_endpoint2.clone()), - pallet_balances::Error::::InsufficientBalance + TokenError::FundsUnavailable ); assert!(did::ServiceEndpoints::::get(alice_did.clone(), new_service_endpoint.id).is_some()); @@ -332,14 +341,14 @@ fn check_duplicate_did_creation() { let auth_key = get_sr25519_authentication_key(true); let alice_did = get_did_identifier_from_sr25519_key(auth_key.public()); let auth_did_key = DidVerificationKey::from(auth_key.public()); - let mock_did = generate_base_did_details::(auth_did_key, None); + let mock_did = generate_base_did_details::(auth_did_key, Some(ACCOUNT_00)); let details = generate_base_did_creation_details::(alice_did.clone(), ACCOUNT_00); let signature = auth_key.sign(details.encode().as_ref()); let balance = ::BaseDeposit::get() * 20 + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .with_dids(vec![(alice_did, mock_did)]) @@ -360,15 +369,15 @@ fn check_unauthorised_submitter_did_creation_error() { let auth_key = get_sr25519_authentication_key(true); let alice_did = get_did_identifier_from_sr25519_key(auth_key.public()); let auth_did_key = DidVerificationKey::from(auth_key.public()); - let mock_did = generate_base_did_details::(auth_did_key, None); + let mock_did = generate_base_did_details::(auth_did_key, Some(ACCOUNT_00)); // Use ACCOUNT_01 to generate the DID creation operation let details = generate_base_did_creation_details::(alice_did.clone(), ACCOUNT_01); let signature = auth_key.sign(details.encode().as_ref()); - let balance = ::BaseDeposit::get() + let balance = ::BaseDeposit::get() * 2 + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .with_dids(vec![(alice_did, mock_did)]) @@ -415,7 +424,7 @@ fn check_did_already_deleted_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .with_deleted_dids(vec![alice_did]) @@ -444,7 +453,7 @@ fn check_invalid_signature_format_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -470,7 +479,7 @@ fn check_invalid_signature_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -496,7 +505,7 @@ fn check_swapped_did_subject_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -525,7 +534,7 @@ fn check_max_limit_key_agreement_keys_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build(None) @@ -561,7 +570,7 @@ fn check_max_limit_service_endpoints_count_did_creation() { let balance = required_balance_for_service_endpoints + ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -589,7 +598,7 @@ fn check_max_limit_service_id_length_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build(None) @@ -624,7 +633,7 @@ fn check_max_limit_service_type_count_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build(None) @@ -653,7 +662,7 @@ fn check_max_limit_service_type_length_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build(None) @@ -688,7 +697,7 @@ fn check_max_limit_service_url_count_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build(None) @@ -717,7 +726,7 @@ fn check_max_limit_service_url_length_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build(None) @@ -746,7 +755,7 @@ fn check_invalid_service_id_character_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() + ::ServiceEndpointDeposit::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -774,7 +783,7 @@ fn check_invalid_service_type_character_did_creation() { let balance = ::BaseDeposit::get() + ::Fee::get() + ::ServiceEndpointDeposit::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -802,7 +811,7 @@ fn check_invalid_service_url_character_did_creation() { let balance = ::BaseDeposit::get() + ::ServiceEndpointDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -1128,7 +1137,8 @@ fn check_max_public_keys_delegation_key_addition_error() { let new_del_key = get_sr25519_delegation_key(false); let key_agreement_keys = get_key_agreement_keys::(MaxTotalKeyAgreementKeys::get()); - let mut did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); assert_ok!(did_details.add_key_agreement_keys(key_agreement_keys, 0u64,)); // Fill public key map to its max by adding @@ -1139,6 +1149,7 @@ fn check_max_public_keys_delegation_key_addition_error() { // Update delegation key. The old one should be removed. ExtBuilder::default() + .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { System::set_block_number(new_block_number); @@ -1160,7 +1171,8 @@ fn check_max_public_keys_reused_key_delegation_key_update_error() { let new_del_key = get_sr25519_delegation_key(true); let key_agreement_keys = get_key_agreement_keys::(MaxTotalKeyAgreementKeys::get()); - let mut did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); assert_ok!(did_details.add_key_agreement_keys(key_agreement_keys, 0u64,)); // Same key for auth and delegation assert_ok!(did_details.update_delegation_key(DidVerificationKey::from(old_del_key.public()), 0u64)); @@ -1175,6 +1187,7 @@ fn check_max_public_keys_reused_key_delegation_key_update_error() { // as authentication key. ExtBuilder::default() .with_dids(vec![(alice_did.clone(), did_details)]) + .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .build_and_execute_with_sanity_tests(None, || { System::set_block_number(new_block_number); assert_noop!( @@ -1279,9 +1292,11 @@ fn check_key_not_present_delegation_key_deletion_error() { let auth_key = get_ed25519_authentication_key(true); let alice_did = get_did_identifier_from_ed25519_key(auth_key.public()); - let old_did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let old_did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); ExtBuilder::default() + .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(alice_did.clone(), old_did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -1417,7 +1432,8 @@ fn check_max_public_keys_attestation_key_addition_error() { let new_att_key = get_sr25519_attestation_key(false); let key_agreement_keys = get_key_agreement_keys::(MaxTotalKeyAgreementKeys::get()); - let mut did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); assert_ok!(did_details.add_key_agreement_keys(key_agreement_keys, 0u64,)); // Fill public key map to its max by adding @@ -1428,6 +1444,7 @@ fn check_max_public_keys_attestation_key_addition_error() { // Update attestation key. The old one should be removed. ExtBuilder::default() + .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { System::set_block_number(new_block_number); @@ -1449,7 +1466,8 @@ fn check_max_public_keys_reused_key_attestation_key_update_error() { let new_att_key = get_sr25519_delegation_key(true); let key_agreement_keys = get_key_agreement_keys::(MaxTotalKeyAgreementKeys::get()); - let mut did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); assert_ok!(did_details.add_key_agreement_keys(key_agreement_keys, 0u64,)); // Same key for auth and attestation assert_ok!(did_details.update_attestation_key(DidVerificationKey::from(old_att_key.public()), 0u64)); @@ -1463,6 +1481,7 @@ fn check_max_public_keys_reused_key_attestation_key_update_error() { // Update attestation key. The old one should not be removed as it is still used // as authentication key. ExtBuilder::default() + .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { System::set_block_number(new_block_number); @@ -1567,9 +1586,11 @@ fn check_key_not_present_attestation_key_deletion_error() { let auth_key = get_ed25519_authentication_key(true); let alice_did = get_did_identifier_from_ed25519_key(auth_key.public()); - let old_did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let old_did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); ExtBuilder::default() + .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(alice_did.clone(), old_did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -1621,7 +1642,8 @@ fn check_max_public_keys_key_agreement_key_addition_error() { let key_agreement_keys = get_key_agreement_keys::(MaxTotalKeyAgreementKeys::get()); let new_key_agreement_key = get_x25519_encryption_key(true); - let mut did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); assert_ok!(did_details.add_key_agreement_keys(key_agreement_keys, 0u64,)); // Fill public key map to its max by adding @@ -1631,6 +1653,7 @@ fn check_max_public_keys_key_agreement_key_addition_error() { let new_block_number: BlockNumber = 1; ExtBuilder::default() + .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { System::set_block_number(new_block_number); @@ -1711,9 +1734,11 @@ fn check_key_not_found_key_agreement_key_deletion_error() { let test_enc_key = get_x25519_encryption_key(true); // No enc key added - let old_did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let old_did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); ExtBuilder::default() + .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(alice_did.clone(), old_did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -1849,7 +1874,8 @@ fn check_max_services_count_addition_error() { ); let new_service_endpoint = DidEndpoint::new(b"id".to_vec(), vec![b"type".to_vec()], vec![b"url".to_vec()]); - let old_did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let old_did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); ExtBuilder::default() .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) @@ -2029,7 +2055,8 @@ fn check_invalid_service_type_character_addition_error() { let alice_did = get_did_identifier_from_ed25519_key(auth_key.public()); let new_service_details = DidEndpoint::new(b"id".to_vec(), vec!["å".bytes().collect()], vec![b"url".to_vec()]); - let old_did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let old_did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); ExtBuilder::default() .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) @@ -2048,9 +2075,11 @@ fn check_invalid_service_url_character_addition_error() { let alice_did = get_did_identifier_from_ed25519_key(auth_key.public()); let new_service_details = DidEndpoint::new(b"id".to_vec(), vec![b"type".to_vec()], vec!["å".bytes().collect()]); - let old_did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let old_did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); ExtBuilder::default() + .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(alice_did.clone(), old_did_details)]) .build_and_execute_with_sanity_tests(None, || { @@ -2097,10 +2126,12 @@ fn check_service_not_present_deletion_error() { let alice_did = get_did_identifier_from_ed25519_key(auth_key.public()); let service_id = b"id".to_vec(); - let old_did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let old_did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); ExtBuilder::default() .with_dids(vec![(alice_did.clone(), old_did_details)]) + .with_balances(vec![(alice_did.clone(), DEFAULT_BALANCE)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( Did::remove_service_endpoint( @@ -2125,7 +2156,7 @@ fn check_successful_deletion_no_endpoints() { let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) @@ -2133,13 +2164,13 @@ fn check_successful_deletion_no_endpoints() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::delete(RuntimeOrigin::signed(alice_did.clone()), 0)); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); @@ -2171,7 +2202,7 @@ fn check_successful_deletion_with_endpoints() { let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) @@ -2180,13 +2211,13 @@ fn check_successful_deletion_with_endpoints() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 1); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::delete(RuntimeOrigin::signed(alice_did.clone()), 1)); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); @@ -2213,7 +2244,7 @@ fn check_did_not_present_deletion() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .build_and_execute_with_sanity_tests(None, || { @@ -2236,7 +2267,7 @@ fn check_service_count_too_small_deletion_error() { let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) @@ -2263,7 +2294,7 @@ fn check_successful_reclaiming() { let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) @@ -2272,7 +2303,7 @@ fn check_successful_reclaiming() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 1); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::reclaim_deposit( @@ -2282,7 +2313,7 @@ fn check_successful_reclaiming() { )); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); // Re-adding the same DID identifier should fail. @@ -2311,14 +2342,14 @@ fn unauthorized_reclaiming() { let balance = ::BaseDeposit::get() + ::Fee::get() - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::BaseDeposit::get() ); assert_noop!( @@ -2340,7 +2371,7 @@ fn check_service_count_too_small_reclaim_error() { let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) @@ -2383,7 +2414,8 @@ fn check_too_small_tx_counter_after_wrap_call_error() { let auth_key = get_sr25519_authentication_key(true); let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; - let mut mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut mock_did = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); // After wrapping tx_counter becomes 0 again. mock_did.last_tx_counter = 0u64; @@ -2396,6 +2428,7 @@ fn check_too_small_tx_counter_after_wrap_call_error() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -2414,7 +2447,8 @@ fn check_too_small_tx_counter_call_error() { let auth_key = get_sr25519_authentication_key(true); let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; - let mut mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut mock_did = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); mock_did.last_tx_counter = 1u64; let mut call_operation = generate_test_did_call( @@ -2426,6 +2460,7 @@ fn check_too_small_tx_counter_call_error() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -2444,7 +2479,7 @@ fn check_equal_tx_counter_call_error() { let auth_key = get_sr25519_authentication_key(true); let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let mut call_operation = generate_test_did_call( DidVerificationKeyRelationship::Authentication, @@ -2455,6 +2490,7 @@ fn check_equal_tx_counter_call_error() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -2473,7 +2509,7 @@ fn check_too_large_tx_counter_call_error() { let auth_key = get_sr25519_authentication_key(true); let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let mut call_operation = generate_test_did_call( DidVerificationKeyRelationship::Authentication, @@ -2484,6 +2520,7 @@ fn check_too_large_tx_counter_call_error() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -2503,7 +2540,7 @@ fn check_tx_block_number_too_low_error() { let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let call_operation = generate_test_did_call( DidVerificationKeyRelationship::Authentication, @@ -2513,6 +2550,7 @@ fn check_tx_block_number_too_low_error() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { // System block number 1 past the max block the operation was allowed for. @@ -2542,7 +2580,7 @@ fn check_tx_block_number_too_high_error() { let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let mut call_operation = generate_test_did_call( DidVerificationKeyRelationship::Authentication, @@ -2554,6 +2592,7 @@ fn check_tx_block_number_too_high_error() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { // System block number is still too low, meaning that the block number used in @@ -2575,7 +2614,7 @@ fn check_verification_key_not_present_call_error() { let auth_key = get_sr25519_authentication_key(true); let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); // The operation requires the delegation key that is currently not stored for // the given DID. @@ -2587,7 +2626,8 @@ fn check_verification_key_not_present_call_error() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() - .with_dids(vec![(did, mock_did)]) + .with_dids(vec![(did.clone(), mock_did)]) + .with_balances(vec![(did, DEFAULT_BALANCE)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( Did::submit_did_call( @@ -2606,7 +2646,7 @@ fn check_invalid_signature_format_call_error() { let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; let alternative_auth_key = get_ed25519_authentication_key(true); - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let call_operation = generate_test_did_call( DidVerificationKeyRelationship::Authentication, @@ -2616,6 +2656,7 @@ fn check_invalid_signature_format_call_error() { let signature = alternative_auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -2635,7 +2676,7 @@ fn check_bad_submitter_error() { let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; let alternative_auth_key = get_sr25519_authentication_key(false); - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let submitter = ACCOUNT_01; @@ -2643,7 +2684,8 @@ fn check_bad_submitter_error() { let signature = alternative_auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() - .with_dids(vec![(did, mock_did)]) + .with_dids(vec![(did.clone(), mock_did)]) + .with_balances(vec![(did, DEFAULT_BALANCE)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( Did::submit_did_call( @@ -2662,7 +2704,7 @@ fn check_invalid_signature_call_error() { let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; let alternative_auth_key = get_sr25519_authentication_key(false); - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let call_operation = generate_test_did_call( DidVerificationKeyRelationship::Authentication, @@ -2672,6 +2714,7 @@ fn check_invalid_signature_call_error() { let signature = alternative_auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -2692,7 +2735,8 @@ fn check_call_attestation_key_successful() { let caller = ACCOUNT_00; let attestation_key = get_ed25519_attestation_key(true); - let mut mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut mock_did = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); assert_ok!(mock_did.update_attestation_key(DidVerificationKey::from(attestation_key.public()), 0)); let call_operation = generate_test_did_call( @@ -2703,6 +2747,7 @@ fn check_call_attestation_key_successful() { let signature = attestation_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_ok!(Did::submit_did_call( @@ -2720,7 +2765,8 @@ fn check_call_attestation_key_error() { let caller = ACCOUNT_00; let attestation_key = get_ed25519_attestation_key(true); - let mut mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut mock_did = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); assert_ok!(mock_did.update_attestation_key(DidVerificationKey::from(attestation_key.public()), 0)); let call_operation = generate_test_did_call( @@ -2731,6 +2777,7 @@ fn check_call_attestation_key_error() { let signature = attestation_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did.clone(), mock_did)]) .with_ctypes(vec![( ::Hashing::hash(&get_attestation_key_test_input()[..]), @@ -2755,7 +2802,8 @@ fn check_call_delegation_key_successful() { let caller = ACCOUNT_00; let delegation_key = get_ed25519_delegation_key(true); - let mut mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut mock_did = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(caller.clone())); assert_ok!(mock_did.update_delegation_key(DidVerificationKey::from(delegation_key.public()), 0)); let call_operation = generate_test_did_call( @@ -2767,6 +2815,7 @@ fn check_call_delegation_key_successful() { ExtBuilder::default() .with_dids(vec![(did, mock_did)]) + .with_balances(vec![(caller.clone(), DEFAULT_BALANCE)]) .build_and_execute_with_sanity_tests(None, || { assert_ok!(Did::submit_did_call( RuntimeOrigin::signed(caller), @@ -2783,7 +2832,8 @@ fn check_call_delegation_key_error() { let caller = ACCOUNT_00; let delegation_key = get_ed25519_delegation_key(true); - let mut mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut mock_did = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); assert_ok!(mock_did.update_delegation_key(DidVerificationKey::from(delegation_key.public()), 0)); let call_operation = generate_test_did_call( @@ -2794,6 +2844,7 @@ fn check_call_delegation_key_error() { let signature = delegation_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did.clone(), mock_did)]) .with_ctypes(vec![( ::Hashing::hash(&get_delegation_key_test_input()[..]), @@ -2817,7 +2868,7 @@ fn check_call_authentication_key_successful() { let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let call_operation = generate_test_did_call( DidVerificationKeyRelationship::Authentication, @@ -2827,6 +2878,7 @@ fn check_call_authentication_key_successful() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_ok!(Did::submit_did_call( @@ -2843,7 +2895,7 @@ fn check_call_authentication_key_error() { let did = get_did_identifier_from_sr25519_key(auth_key.public()); let caller = ACCOUNT_00; - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let call_operation = generate_test_did_call( DidVerificationKeyRelationship::Authentication, @@ -2854,6 +2906,7 @@ fn check_call_authentication_key_error() { ExtBuilder::default() .with_dids(vec![(did.clone(), mock_did)]) + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_ctypes(vec![( ::Hashing::hash(&get_authentication_key_test_input()[..]), did, @@ -2904,14 +2957,15 @@ fn check_authentication_successful_operation_verification() { let auth_key = get_sr25519_authentication_key(true); let did = get_did_identifier_from_sr25519_key(auth_key.public()); - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let call_operation = generate_test_did_call(DidVerificationKeyRelationship::Authentication, did.clone(), ACCOUNT_00); let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() - .with_dids(vec![(did, mock_did.clone())]) + .with_dids(vec![(did.clone(), mock_did.clone())]) + .with_balances(vec![(did, DEFAULT_BALANCE)]) .build_and_execute_with_sanity_tests(None, || { assert_ok!(Did::verify_did_operation_signature_and_increase_nonce( &call_operation, @@ -2929,7 +2983,8 @@ fn check_attestation_successful_operation_verification() { let did = get_did_identifier_from_sr25519_key(auth_key.public()); let attestation_key = get_ed25519_attestation_key(true); - let mut mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut mock_did = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); assert_ok!(mock_did.update_attestation_key(DidVerificationKey::from(attestation_key.public()), 0)); let call_operation = @@ -2937,7 +2992,8 @@ fn check_attestation_successful_operation_verification() { let signature = attestation_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() - .with_dids(vec![(did, mock_did.clone())]) + .with_dids(vec![(did.clone(), mock_did.clone())]) + .with_balances(vec![(did, DEFAULT_BALANCE)]) .build_and_execute_with_sanity_tests(None, || { assert_ok!(Did::verify_did_operation_signature_and_increase_nonce( &call_operation, @@ -2955,7 +3011,8 @@ fn check_delegation_successful_operation_verification() { let did = get_did_identifier_from_sr25519_key(auth_key.public()); let delegation_key = get_ecdsa_delegation_key(true); - let mut mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut mock_did = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); assert_ok!(mock_did.update_delegation_key(DidVerificationKey::from(delegation_key.public()), 0)); let call_operation = generate_test_did_call( @@ -2966,6 +3023,7 @@ fn check_delegation_successful_operation_verification() { let signature = delegation_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did.clone())]) .build_and_execute_with_sanity_tests(None, || { assert_ok!(Did::verify_did_operation_signature_and_increase_nonce( @@ -3002,7 +3060,8 @@ fn check_tx_counter_wrap_operation_verification() { let auth_key = get_sr25519_authentication_key(true); let did = get_did_identifier_from_sr25519_key(auth_key.public()); - let mut mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut mock_did = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); mock_did.last_tx_counter = u64::MAX; let mut call_operation = @@ -3012,7 +3071,8 @@ fn check_tx_counter_wrap_operation_verification() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() - .with_dids(vec![(did, mock_did)]) + .with_dids(vec![(did.clone(), mock_did)]) + .with_balances(vec![(did, DEFAULT_BALANCE)]) .build_and_execute_with_sanity_tests(None, || { assert_ok!(Did::verify_did_operation_signature_and_increase_nonce( &call_operation, @@ -3029,7 +3089,8 @@ fn check_smaller_counter_operation_verification() { let auth_key = get_ed25519_authentication_key(true); let did = get_did_identifier_from_ed25519_key(auth_key.public()); - let mut mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut mock_did = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); mock_did.last_tx_counter = 1; let mut call_operation = generate_test_did_call( @@ -3041,7 +3102,8 @@ fn check_smaller_counter_operation_verification() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() - .with_dids(vec![(did, mock_did)]) + .with_dids(vec![(did.clone(), mock_did)]) + .with_balances(vec![(did, DEFAULT_BALANCE)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( Did::verify_did_operation_signature_and_increase_nonce( @@ -3058,7 +3120,7 @@ fn check_equal_counter_operation_verification() { let auth_key = get_ed25519_authentication_key(true); let did = get_did_identifier_from_ed25519_key(auth_key.public()); - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let mut call_operation = generate_test_did_call( DidVerificationKeyRelationship::CapabilityDelegation, @@ -3069,6 +3131,7 @@ fn check_equal_counter_operation_verification() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -3086,7 +3149,7 @@ fn check_too_large_counter_operation_verification() { let auth_key = get_ed25519_authentication_key(true); let did = get_did_identifier_from_ed25519_key(auth_key.public()); - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let mut call_operation = generate_test_did_call( DidVerificationKeyRelationship::CapabilityDelegation, @@ -3097,7 +3160,8 @@ fn check_too_large_counter_operation_verification() { let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() - .with_dids(vec![(did, mock_did)]) + .with_dids(vec![(did.clone(), mock_did)]) + .with_balances(vec![(did, DEFAULT_BALANCE)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( Did::verify_did_operation_signature_and_increase_nonce( @@ -3114,13 +3178,14 @@ fn check_verification_key_not_present_operation_verification() { let auth_key = get_ed25519_authentication_key(true); let did = get_did_identifier_from_ed25519_key(auth_key.public()); - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let call_operation = generate_test_did_call(DidVerificationKeyRelationship::AssertionMethod, did.clone(), ACCOUNT_00); let signature = auth_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -3142,13 +3207,14 @@ fn check_invalid_signature_format_operation_verification() { // Expected an Sr25519, given an Ed25519 let invalid_key = get_ed25519_authentication_key(true); - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let call_operation = generate_test_did_call(DidVerificationKeyRelationship::Authentication, did.clone(), ACCOUNT_00); let signature = invalid_key.sign(call_operation.encode().as_ref()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -3168,13 +3234,14 @@ fn check_invalid_signature_operation_verification() { // Using same key type but different seed (default = false) let alternative_key = get_sr25519_authentication_key(false); - let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mock_did = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(did.clone())); let call_operation = generate_test_did_call(DidVerificationKeyRelationship::Authentication, did.clone(), ACCOUNT_00); let signature = alternative_key.sign(&call_operation.encode()); ExtBuilder::default() + .with_balances(vec![(did.clone(), DEFAULT_BALANCE)]) .with_dids(vec![(did, mock_did)]) .build_and_execute_with_sanity_tests(None, || { assert_noop!( @@ -3194,26 +3261,27 @@ fn check_invalid_signature_operation_verification() { fn test_change_deposit_owner() { let auth_key = get_ed25519_authentication_key(true); let alice_did = get_did_identifier_from_ed25519_key(auth_key.public()); - let mut did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(alice_did.clone())); did_details.deposit.owner = ACCOUNT_00; did_details.deposit.amount = ::BaseDeposit::get(); let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance), (alice_did.clone(), balance)]) .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::change_deposit_owner(RuntimeOrigin::signed(alice_did.clone()))); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); assert_eq!( - Balances::reserved_balance(alice_did), + Balances::balance_on_hold(&HFIdentifier::Deposit, &alice_did), ::BaseDeposit::get() ); }); @@ -3223,13 +3291,14 @@ fn test_change_deposit_owner() { fn test_change_deposit_owner_insufficient_balance() { let auth_key = get_ed25519_authentication_key(true); let alice_did = get_did_identifier_from_ed25519_key(auth_key.public()); - let mut did_details = generate_base_did_details::(DidVerificationKey::from(auth_key.public()), None); + let mut did_details = + generate_base_did_details::(DidVerificationKey::from(auth_key.public()), Some(ACCOUNT_00)); did_details.deposit.owner = ACCOUNT_00; did_details.deposit.amount = ::BaseDeposit::get(); let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(ACCOUNT_00, balance)]) @@ -3237,7 +3306,7 @@ fn test_change_deposit_owner_insufficient_balance() { .build_and_execute_with_sanity_tests(None, || { assert_noop!( Did::change_deposit_owner(RuntimeOrigin::signed(alice_did.clone())), - pallet_balances::Error::::InsufficientBalance + TokenError::CannotCreateHold ); }); } @@ -3249,7 +3318,7 @@ fn test_change_deposit_owner_not_found() { let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(alice_did.clone(), balance)]) @@ -3270,7 +3339,7 @@ fn test_change_deposit_owner_not_authorized() { let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(alice_did, balance), (bob_did.clone(), balance)]) @@ -3293,14 +3362,14 @@ fn test_update_deposit() { let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(alice_did.clone(), balance)]) .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::reserved_balance(alice_did.clone()), + Balances::balance_on_hold(&HFIdentifier::Deposit, &alice_did), ::BaseDeposit::get() * 2 ); @@ -3310,7 +3379,7 @@ fn test_update_deposit() { )); assert_eq!( - Balances::reserved_balance(alice_did.clone()), + Balances::balance_on_hold(&HFIdentifier::Deposit, &alice_did), ::BaseDeposit::get() ); @@ -3340,14 +3409,14 @@ fn test_update_deposit_unauthorized() { let balance = ::BaseDeposit::get() * 2 + ::Fee::get() * 2 - + <::Currency as Currency>>::minimum_balance(); + + <::Currency as Inspect>>::minimum_balance(); ExtBuilder::default() .with_balances(vec![(alice_did.clone(), balance)]) .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::reserved_balance(alice_did.clone()), + Balances::balance_on_hold(&HFIdentifier::Deposit, &alice_did), ::BaseDeposit::get() * 2 ); assert_noop!( diff --git a/pallets/pallet-configuration/Cargo.toml b/pallets/pallet-configuration/Cargo.toml index bcff252f66..d83e842bb2 100644 --- a/pallets/pallet-configuration/Cargo.toml +++ b/pallets/pallet-configuration/Cargo.toml @@ -22,6 +22,9 @@ pallet-balances = {workspace = true} [dependencies] +# Internal dependencies +kilt-support.workspace = true + # Substrate dependencies parity-scale-codec = {workspace = true, features = ["derive"]} scale-info = {workspace = true, features = ["derive"]} diff --git a/pallets/pallet-configuration/src/mock.rs b/pallets/pallet-configuration/src/mock.rs index e070be6da0..f361e3220e 100644 --- a/pallets/pallet-configuration/src/mock.rs +++ b/pallets/pallet-configuration/src/mock.rs @@ -22,6 +22,7 @@ pub mod runtime { ord_parameter_types, parameter_types, traits::AsEnsureOriginWithArg, weights::constants::RocksDbWeight, }; use frame_system::EnsureSignedBy; + use kilt_support::deposit::HFIdentifier; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, @@ -90,9 +91,15 @@ pub mod runtime { pub const ExistentialDeposit: Balance = 500; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; + pub const MaxHolds: u32 = 50; + pub const MaxFreezes: u32 = 50; } impl pallet_balances::Config for Test { + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; type Balance = Balance; type DustRemoval = (); type RuntimeEvent = (); diff --git a/pallets/pallet-did-lookup/Cargo.toml b/pallets/pallet-did-lookup/Cargo.toml index 323b369d1b..6485c5daff 100644 --- a/pallets/pallet-did-lookup/Cargo.toml +++ b/pallets/pallet-did-lookup/Cargo.toml @@ -36,6 +36,7 @@ sha3.workspace = true # Internal dependencies kilt-support.workspace = true +runtime-common.workspace = true # Substrate dependencies frame-support.workspace = true diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index 1c664a5b47..784be73afc 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -60,7 +60,7 @@ pub mod pallet { traits::{ fungible::{InspectHold, MutateHold}, tokens::fungible::Inspect, - Currency, ReservableCurrency, StorageVersion, + ReservableCurrency, StorageVersion, }, }; use frame_system::pallet_prelude::*; @@ -68,8 +68,10 @@ pub mod pallet { deposit::{Deposit, HFIdentifier}, traits::{CallSources, StorageDepositCollector}, }; + use runtime_common::Balance; + use sp_runtime::SaturatedConversion; - use sp_runtime::traits::BlockNumberProvider; + use sp_runtime::traits::{BlockNumberProvider, MaybeSerializeDeserialize}; pub use crate::connection_record::ConnectionRecord; @@ -79,14 +81,11 @@ pub mod pallet { /// The identifier to which the accounts can be associated. pub(crate) type DidIdentifierOf = ::DidIdentifier; - /// The type used to describe a balance. - pub(crate) type BalanceOf = <::Currency as Inspect>>::Balance; - /// The currency module that keeps track of balances. pub(crate) type CurrencyOf = ::Currency; /// The connection record type. - pub(crate) type ConnectionRecordOf = ConnectionRecord, AccountIdOf, BalanceOf>; + pub(crate) type ConnectionRecordOf = ConnectionRecord, AccountIdOf, Balance>; pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(4); @@ -110,7 +109,7 @@ pub mod pallet { /// to incentivise fair use of the on chain storage. The deposit can be /// reclaimed when the DID is deleted. #[pallet::constant] - type Deposit: Get>; + type Deposit: Get; /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; @@ -253,7 +252,7 @@ pub mod pallet { >>::can_hold( &HFIdentifier::Deposit, &sender, - ::Deposit::get() + ::Deposit::get().saturated_into() ), Error::::InsufficientFunds ); @@ -288,7 +287,7 @@ pub mod pallet { >>::can_hold( &HFIdentifier::Deposit, &source.sender(), - ::Deposit::get() + ::Deposit::get().saturated_into() ), Error::::InsufficientFunds ); @@ -413,14 +412,17 @@ pub mod pallet { kilt_support::deposit::reserve_deposit::, CurrencyOf>( record.deposit.owner.clone(), - record.deposit.amount, + record.deposit.amount.saturated_into(), )?; ConnectedDids::::mutate(&account, |did_entry| -> DispatchResult { if let Some(old_connection) = did_entry.replace(record) { ConnectedAccounts::::remove(&old_connection.did, &account); Self::deposit_event(Event::::AssociationRemoved(account.clone(), old_connection.did)); - kilt_support::free_deposit::, CurrencyOf>(&old_connection.deposit)?; + kilt_support::free_deposit::, CurrencyOf>(&Deposit { + owner: old_connection.deposit.owner, + amount: old_connection.deposit.amount.saturated_into(), + })?; } Ok(()) })?; @@ -433,7 +435,10 @@ pub mod pallet { pub(crate) fn remove_association(account: LinkableAccountId) -> DispatchResult { if let Some(connection) = ConnectedDids::::take(&account) { ConnectedAccounts::::remove(&connection.did, &account); - kilt_support::free_deposit::, CurrencyOf>(&connection.deposit)?; + kilt_support::free_deposit::, CurrencyOf>(&Deposit { + owner: connection.deposit.owner, + amount: connection.deposit.amount.saturated_into(), + })?; Self::deposit_event(Event::AssociationRemoved(account, connection.did)); Ok(()) @@ -451,11 +456,14 @@ pub mod pallet { key: &LinkableAccountId, ) -> Result, >>::Balance>, DispatchError> { let record = ConnectedDids::::get(key).ok_or(Error::::NotFound)?; - Ok(record.deposit) + Ok(Deposit { + owner: record.deposit.owner, + amount: record.deposit.amount.saturated_into(), + }) } fn deposit_amount(_key: &LinkableAccountId) -> >>::Balance { - T::Deposit::get() + T::Deposit::get().saturated_into() } fn store_deposit( @@ -463,7 +471,16 @@ pub mod pallet { deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { let record = ConnectedDids::::get(key).ok_or(Error::::NotFound)?; - ConnectedDids::::insert(key, ConnectionRecord { deposit, ..record }); + ConnectedDids::::insert( + key, + ConnectionRecord { + deposit: Deposit { + owner: deposit.owner, + amount: deposit.amount.saturated_into(), + }, + ..record + }, + ); Ok(()) } diff --git a/pallets/pallet-did-lookup/src/mock.rs b/pallets/pallet-did-lookup/src/mock.rs index 22f3b83c9a..a9ca1589a4 100644 --- a/pallets/pallet-did-lookup/src/mock.rs +++ b/pallets/pallet-did-lookup/src/mock.rs @@ -24,11 +24,11 @@ use kilt_support::{ use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, - MultiSignature, + MultiSignature, SaturatedConversion, }; use crate::{ - self as pallet_did_lookup, linkable_account::LinkableAccountId, AccountIdOf, BalanceOf, Config, ConnectedAccounts, + self as pallet_did_lookup, linkable_account::LinkableAccountId, AccountIdOf, Config, ConnectedAccounts, ConnectedDids, ConnectionRecord, CurrencyOf, DidIdentifierOf, }; @@ -91,13 +91,15 @@ parameter_types! { pub const ExistentialDeposit: Balance = 10; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; + pub const MaxHolds: u32 = 50; + pub const MaxFreezes: u32 = 50; } impl pallet_balances::Config for Test { type FreezeIdentifier = HFIdentifier; type HoldIdentifier = HFIdentifier; - type MaxFreezes = (); - type MaxHolds = (); + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; type Balance = Balance; type DustRemoval = (); type RuntimeEvent = RuntimeEvent; @@ -142,7 +144,7 @@ pub(crate) fn insert_raw_connection( sender: AccountIdOf, did_identifier: DidIdentifierOf, account: LinkableAccountId, - deposit: BalanceOf, + deposit: Balance, ) { let deposit = Deposit { owner: sender, @@ -153,13 +155,21 @@ pub(crate) fn insert_raw_connection( did: did_identifier.clone(), }; - CurrencyOf::::hold(&HFIdentifier::Deposit, &record.deposit.owner, record.deposit.amount) - .expect("Account should have enough balance"); + CurrencyOf::::hold( + &HFIdentifier::Deposit, + &record.deposit.owner, + record.deposit.amount.saturated_into(), + ) + .expect("Account should have enough balance"); ConnectedDids::::mutate(&account, |did_entry| { if let Some(old_connection) = did_entry.replace(record) { ConnectedAccounts::::remove(&old_connection.did, &account); - kilt_support::free_deposit::, CurrencyOf>(&old_connection.deposit); + kilt_support::free_deposit::, CurrencyOf>(&Deposit { + owner: old_connection.deposit.owner, + amount: old_connection.deposit.amount.saturated_into(), + }) + .expect("Could not release deposit of account"); } }); ConnectedAccounts::::insert(&did_identifier, &account, ()); diff --git a/pallets/pallet-did-lookup/src/tests.rs b/pallets/pallet-did-lookup/src/tests.rs index bd97aa2dfc..47a1f0997d 100644 --- a/pallets/pallet-did-lookup/src/tests.rs +++ b/pallets/pallet-did-lookup/src/tests.rs @@ -23,7 +23,7 @@ use sha3::{Digest, Keccak256}; use sp_runtime::{ app_crypto::{ecdsa, sr25519, Pair}, traits::{IdentifyAccount, Zero}, - MultiSignature, MultiSigner, + MultiSignature, MultiSigner, TokenError, }; use crate::{ @@ -448,7 +448,7 @@ fn test_change_deposit_owner_insufficient_balance() { mock_origin::DoubleOrigin(ACCOUNT_01, DID_00).into(), ACCOUNT_00.into() ), - pallet_balances::Error::::InsufficientBalance + TokenError::CannotCreateHold ); }) } diff --git a/pallets/pallet-inflation/src/mock.rs b/pallets/pallet-inflation/src/mock.rs index 2a3faa010f..8a6fc77061 100644 --- a/pallets/pallet-inflation/src/mock.rs +++ b/pallets/pallet-inflation/src/mock.rs @@ -95,13 +95,15 @@ parameter_types! { pub const ExistentialDeposit: Balance = 500; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; + pub const MaxHolds: u32 = 50; + pub const MaxFreezes: u32 = 50; } impl pallet_balances::Config for Test { type FreezeIdentifier = (); type HoldIdentifier = (); - type MaxFreezes = (); - type MaxHolds = (); + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; diff --git a/pallets/pallet-web3-names/src/mock.rs b/pallets/pallet-web3-names/src/mock.rs index 5fd2f46b75..b84bde379b 100644 --- a/pallets/pallet-web3-names/src/mock.rs +++ b/pallets/pallet-web3-names/src/mock.rs @@ -126,13 +126,15 @@ pub(crate) mod runtime { pub const ExistentialDeposit: Balance = 10; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; + pub const MaxHolds: u32 = 50; + pub const MaxFreezes: u32 = 50; } impl pallet_balances::Config for Test { type FreezeIdentifier = HFIdentifier; type HoldIdentifier = HFIdentifier; - type MaxFreezes = (); - type MaxHolds = (); + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; type Balance = Balance; type DustRemoval = (); type RuntimeEvent = RuntimeEvent; diff --git a/pallets/pallet-web3-names/src/tests.rs b/pallets/pallet-web3-names/src/tests.rs index a69f2c0871..4c23dbe2bd 100644 --- a/pallets/pallet-web3-names/src/tests.rs +++ b/pallets/pallet-web3-names/src/tests.rs @@ -20,7 +20,7 @@ use frame_support::{assert_noop, assert_ok, BoundedVec}; use frame_system::RawOrigin; use kilt_support::{deposit::Deposit, mock::mock_origin}; -use sp_runtime::{traits::Zero, DispatchError}; +use sp_runtime::{traits::Zero, DispatchError, TokenError}; use crate::{mock::*, Banned, Config, Error, Names, Owner, Pallet, Web3OwnershipOf}; @@ -400,7 +400,7 @@ fn test_change_deposit_owner_insufficient_balance() { .build_and_execute_with_sanity_tests(|| { assert_noop!( Pallet::::change_deposit_owner(mock_origin::DoubleOrigin(ACCOUNT_01, DID_00).into()), - pallet_balances::Error::::InsufficientBalance + TokenError::CannotCreateHold ); }) } diff --git a/pallets/public-credentials/src/mock.rs b/pallets/public-credentials/src/mock.rs index 13c6612541..6cdac80acb 100644 --- a/pallets/public-credentials/src/mock.rs +++ b/pallets/public-credentials/src/mock.rs @@ -324,8 +324,8 @@ pub(crate) mod runtime { impl pallet_balances::Config for Test { type FreezeIdentifier = HFIdentifier; type HoldIdentifier = HFIdentifier; - type MaxFreezes = (); - type MaxHolds = (); + type MaxFreezes = ConstU32<10>; + type MaxHolds = ConstU32<10>; type Balance = Balance; type DustRemoval = (); type RuntimeEvent = (); diff --git a/runtimes/common/Cargo.toml b/runtimes/common/Cargo.toml index 8ae80c73f0..104e908114 100644 --- a/runtimes/common/Cargo.toml +++ b/runtimes/common/Cargo.toml @@ -21,17 +21,17 @@ kilt-asset-dids.workspace = true scale-info = {workspace = true, features = ["derive"]} smallvec.workspace = true -# Internal dependencies -attestation.workspace = true -ctype.workspace = true -delegation = {workspace = true, optional = true} -did = {workspace = true, optional = true} -pallet-did-lookup = {workspace = true, optional = true} -pallet-inflation = {workspace = true, optional = true} +# # Internal dependencies + attestation.workspace = true +# ctype.workspace = true +# delegation = {workspace = true, optional = true} +# did = {workspace = true, optional = true} +# pallet-did-lookup = {workspace = true, optional = true} +# pallet-inflation = {workspace = true, optional = true} kilt-support.workspace = true parachain-staking.workspace = true public-credentials.workspace = true -pallet-web3-names.workspace = true +# pallet-web3-names.workspace = true # Substrate dependencies frame-support.workspace = true @@ -60,13 +60,13 @@ default = ["std"] fast-gov = [] runtime-benchmarks = [ "attestation/runtime-benchmarks", - "ctype/runtime-benchmarks", + # "ctype/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "kilt-support/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-membership/runtime-benchmarks", - "parachain-staking/runtime-benchmarks", + # "parachain-staking/runtime-benchmarks", "polkadot-parachain/runtime-benchmarks", "public-credentials/runtime-benchmarks", "sp-runtime/runtime-benchmarks", @@ -76,7 +76,7 @@ runtime-benchmarks = [ std = [ "attestation/std", "parity-scale-codec/std", - "ctype/std", + # "ctype/std", "cumulus-primitives-core/std", "frame-support/std", "frame-system/std", @@ -102,15 +102,15 @@ std = [ ] try-runtime = [ "attestation/try-runtime", - "delegation", - "did", + # "delegation", + # "did", "frame-support/try-runtime", "frame-system/try-runtime", "kilt-support/try-runtime", "pallet-authorship/try-runtime", "pallet-balances/try-runtime", - "pallet-did-lookup", - "pallet-inflation", + # "pallet-did-lookup", + # "pallet-inflation", "pallet-membership/try-runtime", "pallet-transaction-payment/try-runtime", "parachain-staking/try-runtime", diff --git a/runtimes/spiritnet/src/weights/pallet_balances.rs b/runtimes/spiritnet/src/weights/pallet_balances.rs index 27e956ff6d..26775224f4 100644 --- a/runtimes/spiritnet/src/weights/pallet_balances.rs +++ b/runtimes/spiritnet/src/weights/pallet_balances.rs @@ -52,6 +52,7 @@ impl pallet_balances::WeightInfo for WeightInfo { fn transfer_allow_death() -> sp_weights::Weight { todo!() } fn force_set_balance_creating() -> sp_weights::Weight { todo!() } fn force_set_balance_killing() -> sp_weights::Weight { todo!() } + fn force_transfer() -> sp_weights::Weight { todo!() } fn upgrade_accounts(_: u32) -> sp_weights::Weight { todo!() } // Storage: System Account (r:2 w:2) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) @@ -69,11 +70,7 @@ impl pallet_balances::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - - fn set_balance_creating() -> Weight { - Weight::from_parts(49_562_000 as u64, 0) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } + // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) diff --git a/support/src/deposit.rs b/support/src/deposit.rs index d6d48eab7d..08b443c4ac 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -21,7 +21,7 @@ use frame_support::{pallet_prelude::DispatchResult, traits::fungible::hold::Muta use frame_support::traits::tokens::Precision; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; -use sp_runtime::{traits::Zero, DispatchError}; +use sp_runtime::DispatchError; #[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen, Copy)] pub enum HFIdentifier { @@ -42,7 +42,8 @@ pub fn reserve_deposit account: Account, deposit_amount: Currency::Balance, ) -> Result, DispatchError> { - Currency::hold(&HFIdentifier::Deposit, &account, deposit_amount)?; + let q = Currency::hold(&HFIdentifier::Deposit, &account, deposit_amount); + q?; Ok(Deposit { owner: account, amount: deposit_amount, @@ -52,7 +53,6 @@ pub fn reserve_deposit pub fn free_deposit>( deposit: &Deposit, ) -> DispatchResult { - let err_amount = Currency::release(&HFIdentifier::Deposit, &deposit.owner, deposit.amount, Precision::Exact)?; - debug_assert!(err_amount.is_zero()); + Currency::release(&HFIdentifier::Deposit, &deposit.owner, deposit.amount, Precision::Exact)?; Ok(()) } From b47d04a80a42e3db5721549afc223a085b60cc2c Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 30 May 2023 14:00:19 +0200 Subject: [PATCH 16/99] working and finished --- Cargo.lock | 2 + pallets/attestation/src/migration.rs | 8 +- pallets/delegation/src/lib.rs | 2 +- pallets/delegation/src/migration.rs | 108 ++++++++++++++++++++ pallets/did/src/lib.rs | 20 ++-- pallets/pallet-web3-names/Cargo.toml | 2 + pallets/pallet-web3-names/src/lib.rs | 1 + pallets/pallet-web3-names/src/migration.rs | 103 +++++++++++++++++++ pallets/public-credentials/Cargo.toml | 2 + pallets/public-credentials/src/lib.rs | 1 + pallets/public-credentials/src/migration.rs | 107 +++++++++++++++++++ 11 files changed, 342 insertions(+), 14 deletions(-) create mode 100644 pallets/delegation/src/migration.rs create mode 100644 pallets/pallet-web3-names/src/migration.rs create mode 100644 pallets/public-credentials/src/migration.rs diff --git a/Cargo.lock b/Cargo.lock index 1e713374a0..f78af575ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6779,6 +6779,7 @@ dependencies = [ "frame-support", "frame-system", "kilt-support", + "log", "pallet-balances", "parity-scale-codec", "scale-info", @@ -8730,6 +8731,7 @@ dependencies = [ "frame-support", "frame-system", "kilt-support", + "log", "pallet-balances", "parity-scale-codec", "scale-info", diff --git a/pallets/attestation/src/migration.rs b/pallets/attestation/src/migration.rs index c202879cbf..b9cd918343 100644 --- a/pallets/attestation/src/migration.rs +++ b/pallets/attestation/src/migration.rs @@ -34,9 +34,9 @@ impl OnRuntimeUpgrade for BalanceMigration { log::info!("Attestation: Initiating migration"); if ensure_upgraded::() { return do_migration::(); - } else { - log::info!("Attestation: No migration needed. This file should be deleted."); } + + log::info!("Attestation: No migration needed. This file should be deleted."); ::DbWeight::get().reads_writes(0, 0) } @@ -59,6 +59,8 @@ impl OnRuntimeUpgrade for BalanceMigration { #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { + use frame_support::ensure; + let has_all_user_holds = Attestations::::iter_values() .map(|details: AttestationDetails| { has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) @@ -68,7 +70,7 @@ impl OnRuntimeUpgrade for BalanceMigration { // before the upgrade, there should be no account with holds ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); - Ok(vec![]) + Ok(()) } } diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index 3cd567cf24..85dcd24226 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -66,7 +66,7 @@ mod access_control; pub mod default_weights; pub mod delegation_hierarchy; - +pub mod migration; #[cfg(any(feature = "mock", test))] pub mod mock; diff --git a/pallets/delegation/src/migration.rs b/pallets/delegation/src/migration.rs new file mode 100644 index 0000000000..7cb403b61e --- /dev/null +++ b/pallets/delegation/src/migration.rs @@ -0,0 +1,108 @@ +// KILT Blockchain – https://botlabs.org +// Copyright (C) 2019-2023 BOTLabs GmbH + +// The KILT Blockchain is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The KILT Blockchain is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@botlabs.org + +use frame_support::{ + traits::{Get, OnRuntimeUpgrade}, + weights::Weight, +}; +use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use log; +use sp_runtime::SaturatedConversion; +use sp_std::marker::PhantomData; + +use crate::{AccountIdOf, Config, CurrencyOf, DelegationNode, DelegationNodes}; + +pub struct BalanceMigration(PhantomData); + +impl OnRuntimeUpgrade for BalanceMigration { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + log::info!("Delegation: Initiating migration"); + if ensure_upgraded::() { + return do_migration::(); + } + + log::info!("Delegation: No migration needed. This file should be deleted."); + ::DbWeight::get().reads_writes(0, 0) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + use frame_support::ensure; + use sp_std::vec; + + let has_one_user_holds = DelegationNodes::::iter_values() + .map(|details: DelegationNode| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| !user); + + // before the upgrade, there should be no account with holds + ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + + Ok(vec![]) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { + use frame_support::ensure; + + let has_all_user_holds = DelegationNodes::::iter_values() + .map(|details: DelegationNode| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| user); + + // before the upgrade, there should be no account with holds + ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); + + Ok(()) + } +} + +/// Checks if there is an user, who has still reserved balance and no holds. If +/// yes, the migration is not executed yet. +fn ensure_upgraded() -> bool { + DelegationNodes::::iter_values() + .map(|details: DelegationNode| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .any(|user| !user) +} + +fn do_migration() -> Weight { + DelegationNodes::::iter() + .map(|(key, delegation_detail)| -> Weight { + let deposit = delegation_detail.deposit; + let error = switch_reserved_to_hold::, CurrencyOf>( + deposit.owner, + deposit.amount.saturated_into(), + ); + + if error.is_ok() { + return ::DbWeight::get().reads_writes(1, 1); + } + + log::error!( + " Delegation: Could not convert reserves to hold from delegation: {:?} ", + key + ); + + ::DbWeight::get().reads_writes(0, 0) + }) + .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) +} diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index a193012de1..379510ca58 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -140,7 +140,7 @@ pub mod pallet { use frame_support::{ pallet_prelude::*, traits::{ - fungible::{Inspect, InspectHold, MutateHold}, + fungible::{Inspect, MutateHold}, Currency, ExistenceRequirement, Imbalance, ReservableCurrency, StorageVersion, }, }; @@ -586,15 +586,15 @@ pub mod pallet { // Withdraw the fee. We made sure that enough balance is available. But if this // fails, we don't withdraw anything. - // let imbalance = >>::withdraw( - // /// !TODO! - // &did_entry.deposit.owner, - // T::Fee::get(), - // WithdrawReasons::FEE, - // ExistenceRequirement::AllowDeath, - // ) - // .unwrap_or_else(|_| NegativeImbalanceOf::::zero()); - // T::FeeCollector::on_unbalanced(imbalance); + + let imbalance = >>::withdraw( + &did_entry.deposit.owner, + T::Fee::get().saturated_into::().saturated_into(), + WithdrawReasons::FEE, + ExistenceRequirement::AllowDeath, + ) + .unwrap_or_else(|_| NegativeImbalanceOf::::zero()); + T::FeeCollector::on_unbalanced(imbalance); Self::deposit_event(Event::DidCreated(sender, did_identifier)); diff --git a/pallets/pallet-web3-names/Cargo.toml b/pallets/pallet-web3-names/Cargo.toml index 844bd1fc29..b2693d372a 100644 --- a/pallets/pallet-web3-names/Cargo.toml +++ b/pallets/pallet-web3-names/Cargo.toml @@ -25,6 +25,7 @@ sp-keystore = {workspace = true, features = ["std"]} # External dependencies parity-scale-codec = {workspace = true, features = ["derive"]} scale-info = {workspace = true, features = ["derive"]} +log.workspace = true # Internal dependencies kilt-support.workspace = true @@ -57,6 +58,7 @@ std = [ "scale-info/std", "sp-runtime/std", "sp-std/std", + "log/std" ] try-runtime = [ "frame-support/try-runtime", diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index 3a04404eea..1d2502556c 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -28,6 +28,7 @@ mod default_weights; #[cfg(any(test, feature = "runtime-benchmarks"))] mod mock; +mod migration; #[cfg(any(test, feature = "try-runtime"))] mod try_state; diff --git a/pallets/pallet-web3-names/src/migration.rs b/pallets/pallet-web3-names/src/migration.rs new file mode 100644 index 0000000000..b1719e25dc --- /dev/null +++ b/pallets/pallet-web3-names/src/migration.rs @@ -0,0 +1,103 @@ +// KILT Blockchain – https://botlabs.org +// Copyright (C) 2019-2023 BOTLabs GmbH + +// The KILT Blockchain is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The KILT Blockchain is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@botlabs.org + +use frame_support::{ + traits::{Get, OnRuntimeUpgrade}, + weights::Weight, +}; +use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use sp_runtime::SaturatedConversion; +use sp_std::marker::PhantomData; + +use crate::{AccountIdOf, Config, CurrencyOf, Owner, Web3OwnershipOf}; + +pub struct BalanceMigration(PhantomData); + +impl OnRuntimeUpgrade for BalanceMigration { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + log::info!("W3n: Initiating migration"); + if ensure_upgraded::() { + return do_migration::(); + } + log::info!("W3n: No migration needed. This file should be deleted."); + ::DbWeight::get().reads_writes(0, 0) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + use frame_support::ensure; + use sp_std::vec; + + let has_one_user_holds = Owner::::iter_values() + .map(|details: Web3OwnershipOf| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| !user); + + // before the upgrade, there should be no account with holds + ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + + Ok(vec![]) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { + use frame_support::ensure; + + let has_all_user_holds = Owner::::iter_values() + .map(|details: Web3OwnershipOf| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| user); + + // before the upgrade, there should be no account with holds + ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); + + Ok(()) + } +} + +/// Checks if there is an user, who has still reserved balance and no holds. If +/// yes, the migration is not executed yet. +fn ensure_upgraded() -> bool { + Owner::::iter_values() + .map(|details: Web3OwnershipOf| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .any(|user| !user) +} + +fn do_migration() -> Weight { + Owner::::iter() + .map(|(key, w3n_details)| -> Weight { + let deposit = w3n_details.deposit; + let error = switch_reserved_to_hold::, CurrencyOf>( + deposit.owner, + deposit.amount.saturated_into(), + ); + + if error.is_ok() { + return ::DbWeight::get().reads_writes(1, 1); + } + + log::error!(" W3n: Could not convert reserves to hold from w3n: {:?} ", key); + + ::DbWeight::get().reads_writes(0, 0) + }) + .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) +} diff --git a/pallets/public-credentials/Cargo.toml b/pallets/public-credentials/Cargo.toml index 506c5589e6..7db115c3d5 100644 --- a/pallets/public-credentials/Cargo.toml +++ b/pallets/public-credentials/Cargo.toml @@ -22,6 +22,7 @@ sp-keystore = {workspace = true, features = ["std"]} # External dependencies parity-scale-codec = {workspace = true, features = ["derive"]} scale-info = {workspace = true, features = ["derive"]} +log.workspace = true # Internal dependencies ctype.workspace = true @@ -58,6 +59,7 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-std/std", + "log/std" ] try-runtime = [ "frame-support/try-runtime", diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index 16f4bed80c..75e3e72527 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -33,6 +33,7 @@ mod access_control; pub mod credentials; pub mod default_weights; +pub mod migration; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; diff --git a/pallets/public-credentials/src/migration.rs b/pallets/public-credentials/src/migration.rs new file mode 100644 index 0000000000..9fdbfdff5d --- /dev/null +++ b/pallets/public-credentials/src/migration.rs @@ -0,0 +1,107 @@ +// KILT Blockchain – https://botlabs.org +// Copyright (C) 2019-2023 BOTLabs GmbH + +// The KILT Blockchain is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The KILT Blockchain is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@botlabs.org + +use frame_support::{ + traits::{Get, OnRuntimeUpgrade}, + weights::Weight, +}; +use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use sp_runtime::SaturatedConversion; +use sp_std::marker::PhantomData; + +use crate::{AccountIdOf, Config, CredentialEntryOf, Credentials, CurrencyOf}; + +pub struct BalanceMigration(PhantomData); + +impl OnRuntimeUpgrade for BalanceMigration { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + log::info!("Public Credentials: Initiating migration"); + if ensure_upgraded::() { + return do_migration::(); + } + log::info!("Public Credentials: No migration needed. This file should be deleted."); + ::DbWeight::get().reads_writes(0, 0) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + use frame_support::ensure; + use sp_std::vec; + + let has_one_user_holds = Credentials::::iter_values() + .map(|details: CredentialEntryOf| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| !user); + + // before the upgrade, there should be no account with holds + ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + + Ok(vec![]) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { + use frame_support::ensure; + + let has_all_user_holds = Credentials::::iter_values() + .map(|details: CredentialEntryOf| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| user); + + // before the upgrade, there should be no account with holds + ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); + + Ok(()) + } +} + +/// Checks if there is an user, who has still reserved balance and no holds. If +/// yes, the migration is not executed yet. +fn ensure_upgraded() -> bool { + Credentials::::iter_values() + .map(|details: CredentialEntryOf| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .any(|user| !user) +} + +fn do_migration() -> Weight { + Credentials::::iter() + .map(|(key, key2, pc_details)| -> Weight { + let deposit = pc_details.deposit; + let error = switch_reserved_to_hold::, CurrencyOf>( + deposit.owner, + deposit.amount.saturated_into(), + ); + + if error.is_ok() { + return ::DbWeight::get().reads_writes(1, 1); + } + + log::error!( + " Public Credential: Could not convert reserves to hold from credential: {:?} {:?} ", + key, + key2 + ); + + ::DbWeight::get().reads_writes(0, 0) + }) + .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) +} From cfb846cdb4d751646be823ca9272a290e4eb95de Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 31 May 2023 09:57:35 +0200 Subject: [PATCH 17/99] tests --- pallets/attestation/src/benchmarking.rs | 16 +-- pallets/attestation/src/lib.rs | 10 +- pallets/attestation/src/mock.rs | 2 +- pallets/ctype/src/mock.rs | 4 +- pallets/delegation/src/benchmarking.rs | 31 +++--- pallets/delegation/src/mock.rs | 2 +- pallets/did/src/benchmarking.rs | 16 +-- pallets/did/src/lib.rs | 16 +-- pallets/did/src/migration.rs | 105 ++++++++++++++++++ pallets/did/src/mock.rs | 2 +- pallets/pallet-configuration/src/mock.rs | 4 +- pallets/pallet-did-lookup/src/benchmarking.rs | 10 +- pallets/pallet-did-lookup/src/lib.rs | 6 +- pallets/pallet-did-lookup/src/mock.rs | 2 +- pallets/pallet-web3-names/src/benchmarking.rs | 9 +- pallets/pallet-web3-names/src/lib.rs | 6 +- pallets/pallet-web3-names/src/mock.rs | 2 +- .../public-credentials/src/benchmarking.rs | 9 +- pallets/public-credentials/src/lib.rs | 6 +- pallets/public-credentials/src/mock.rs | 2 +- runtimes/peregrine/src/lib.rs | 3 + 21 files changed, 197 insertions(+), 66 deletions(-) create mode 100644 pallets/did/src/migration.rs diff --git a/pallets/attestation/src/benchmarking.rs b/pallets/attestation/src/benchmarking.rs index 4447d89923..baa6c8fed8 100644 --- a/pallets/attestation/src/benchmarking.rs +++ b/pallets/attestation/src/benchmarking.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite}; -use frame_support::traits::{Currency, Get}; +use frame_support::traits::{fungible::Mutate, Get}; use frame_system::RawOrigin; use sp_runtime::traits::Hash; @@ -47,7 +47,7 @@ benchmarks! { creator: attester.clone(), created_at: 0u64.into() }); - ::Currency::make_free_balance_be(&sender, ::Deposit::get() + ::Deposit::get()); + ::Currency::set_balance(&sender, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(sender.clone(), attester.clone()); }: _(origin, claim_hash, ctype_hash, None) @@ -75,7 +75,7 @@ benchmarks! { creator: attester.clone(), created_at: 0u64.into() }); - ::Currency::make_free_balance_be(&sender, ::Deposit::get() + ::Deposit::get()); + ::Currency::set_balance(&sender, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(sender.clone(), attester.clone()); Pallet::::add(origin.clone(), claim_hash, ctype_hash, None)?; @@ -104,7 +104,7 @@ benchmarks! { creator: attester.clone(), created_at: 0u64.into() }); - ::Currency::make_free_balance_be(&sender, ::Deposit::get() + ::Deposit::get()); + ::Currency::set_balance(&sender, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(sender.clone(), attester.clone()); Pallet::::add(origin, claim_hash, ctype_hash, None)?; @@ -124,7 +124,7 @@ benchmarks! { creator: attester.clone(), created_at: 0u64.into() }); - ::Currency::make_free_balance_be(&sender, ::Deposit::get() + ::Deposit::get()); + ::Currency::set_balance(&sender, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(sender.clone(), attester); Pallet::::add(origin, claim_hash, ctype_hash, None)?; @@ -145,8 +145,8 @@ benchmarks! { creator: attester.clone(), created_at: 0u64.into() }); - ::Currency::make_free_balance_be(&deposit_owner_old, ::Deposit::get() + ::Deposit::get()); - ::Currency::make_free_balance_be(&deposit_owner_new, ::Deposit::get() + ::Deposit::get()); + ::Currency::set_balance(&deposit_owner_old, ::Deposit::get() + ::Deposit::get()); + ::Currency::set_balance(&deposit_owner_new, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(deposit_owner_old, attester.clone()); Pallet::::add(origin, claim_hash, ctype_hash, None)?; @@ -175,7 +175,7 @@ benchmarks! { creator: attester.clone(), created_at: 0u64.into() }); - ::Currency::make_free_balance_be(&deposit_owner, ::Deposit::get() + ::Deposit::get()); + ::Currency::set_balance(&deposit_owner, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(deposit_owner.clone(), attester.clone()); Pallet::::add(origin, claim_hash, ctype_hash, None).expect("claim should be added"); diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 694e361e87..d6d8b7359b 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -88,7 +88,11 @@ pub mod pallet { use frame_support::{ dispatch::{DispatchResult, DispatchResultWithPostInfo}, pallet_prelude::*, - traits::{fungible::MutateHold, tokens::fungible::Inspect, Get, ReservableCurrency, StorageVersion}, + traits::{ + fungible::{Mutate, MutateHold}, + tokens::fungible::Inspect, + Get, ReservableCurrency, StorageVersion, + }, }; use frame_system::pallet_prelude::*; @@ -127,7 +131,9 @@ pub mod pallet { type WeightInfo: WeightInfo; /// The currency that is used to hold funds for each attestation. - type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; + type Currency: ReservableCurrency> + + MutateHold, Reason = HFIdentifier> + + Mutate>; /// The deposit that is required for storing an attestation. #[pallet::constant] diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index 8402d74256..129af7b1c6 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -405,7 +405,7 @@ pub(crate) mod runtime { pub fn build_with_keystore(self) -> sp_io::TestExternalities { let mut ext = self.build(); - let keystore = sp_keystore::testing::KeyStore::new(); + let keystore = sp_keystore::testing::MemoryKeystore::new(); ext.register_extension(sp_keystore::KeystoreExt(std::sync::Arc::new(keystore))); ext diff --git a/pallets/ctype/src/mock.rs b/pallets/ctype/src/mock.rs index 380c0d8475..3b941b522d 100644 --- a/pallets/ctype/src/mock.rs +++ b/pallets/ctype/src/mock.rs @@ -202,12 +202,12 @@ pub mod runtime { #[cfg(feature = "runtime-benchmarks")] pub(crate) fn build_with_keystore(self) -> sp_io::TestExternalities { - use sp_keystore::{testing::KeyStore, KeystoreExt}; + use sp_keystore::{testing::MemoryKeystore, KeystoreExt}; use sp_std::sync::Arc; let mut ext = self.build(); - let keystore = KeyStore::new(); + let keystore = MemoryKeystore::new(); ext.register_extension(KeystoreExt(Arc::new(keystore))); ext diff --git a/pallets/delegation/src/benchmarking.rs b/pallets/delegation/src/benchmarking.rs index 527c8946b0..c2127a2bad 100644 --- a/pallets/delegation/src/benchmarking.rs +++ b/pallets/delegation/src/benchmarking.rs @@ -22,7 +22,10 @@ use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite}; use frame_support::{ dispatch::DispatchErrorWithPostInfo, storage::bounded_btree_set::BoundedBTreeSet, - traits::{Currency, Get}, + traits::{ + fungible::{Inspect, InspectHold, Mutate}, + Get, + }, }; use frame_system::RawOrigin; use parity_scale_codec::Encode; @@ -71,7 +74,7 @@ where let hierarchy_root_id = generate_delegation_id::(number); let sender: T::AccountId = account("sender", 0, SEED); - ::Currency::make_free_balance_be( + ::Currency::set_balance( &sender, ::Currency::minimum_balance() + ::Deposit::get() + ::Deposit::get(), ); @@ -142,7 +145,7 @@ where let sig = (delegation_acc_id.clone(), hash.clone()); // add delegation from delegate to parent - ::Currency::make_free_balance_be( + ::Currency::set_balance( &sender, ::Currency::minimum_balance() + ::Deposit::get() + ::Deposit::get(), ); @@ -248,7 +251,7 @@ benchmarks! { creator: T::CtypeCreatorId::from(creator.clone()), created_at: 0u64.into(), }); - ::Currency::make_free_balance_be( + ::Currency::set_balance( &sender, ::Currency::minimum_balance() + ::Deposit::get(), ); @@ -289,7 +292,7 @@ benchmarks! { let sig = (delegate_acc_id.clone(), AsRef::<[u8]>::as_ref(&hash_root).to_vec()).into(); let leaf_acc_id: T::DelegationEntityId = root_public.into(); - ::Currency::make_free_balance_be( + ::Currency::set_balance( &sender, ::Currency::minimum_balance() + ::Deposit::get(), ); @@ -313,7 +316,7 @@ benchmarks! { let children: BoundedBTreeSet = root_node.children; let child_id: T::DelegationNodeId = *children.iter().next().ok_or("Root should have children")?; let child_delegation = DelegationNodes::::get(child_id).ok_or("Child of root should have delegation id")?; - ::Currency::make_free_balance_be( + ::Currency::set_balance( &child_delegation.deposit.owner, ::Currency::minimum_balance() + ::Deposit::get(), ); @@ -361,14 +364,14 @@ benchmarks! { let children: BoundedBTreeSet = root_node.children; let child_id: T::DelegationNodeId = *children.iter().next().ok_or("Root should have children")?; let child_delegation = DelegationNodes::::get(child_id).ok_or("Child of root should have delegation id")?; - assert!(!::Currency::reserved_balance(&sender).is_zero()); + assert!(!::Currency::total_balance_on_hold(&sender).is_zero()); let origin = ::EnsureOrigin::generate_origin(sender.clone(), root_acc.into()); }: _(origin, hierarchy_id, r) verify { assert!(!DelegationNodes::::contains_key(hierarchy_id)); assert!(!DelegationNodes::::contains_key(child_id)); assert!(!DelegationNodes::::contains_key(leaf_id)); - assert!(::Currency::reserved_balance(&sender).is_zero()); + assert!(::Currency::total_balance_on_hold(&sender).is_zero()); } // worst case is achieved by removing the root node, since `is_delegating` is not called in remove extrinsic @@ -381,7 +384,7 @@ benchmarks! { let children: BoundedBTreeSet = root_node.children; let child_id: T::DelegationNodeId = *children.iter().next().ok_or("Root should have children")?; let child_delegation = DelegationNodes::::get(child_id).ok_or("Child of root should have delegation id")?; - assert!(!::Currency::reserved_balance(&sender).is_zero()); + assert!(!::Currency::total_balance_on_hold(&sender).is_zero()); let origin = RawOrigin::Signed(sender.clone()); }: _(origin, hierarchy_id, r) @@ -389,7 +392,7 @@ benchmarks! { assert!(!DelegationNodes::::contains_key(hierarchy_id)); assert!(!DelegationNodes::::contains_key(child_id)); assert!(!DelegationNodes::::contains_key(leaf_id)); - assert!(::Currency::reserved_balance(&sender).is_zero()); + assert!(::Currency::total_balance_on_hold(&sender).is_zero()); } can_attest { @@ -459,16 +462,16 @@ benchmarks! { let child_id: T::DelegationNodeId = *children.iter().next().ok_or("Root should have children")?; let child_delegation = DelegationNodes::::get(child_id).ok_or("Child of root should have delegation id")?; - ::Currency::make_free_balance_be( + ::Currency::set_balance( &deposit_owner_new, ::Currency::minimum_balance() + ::Deposit::get(), ); - assert!(!::Currency::reserved_balance(&deposit_owner_old).is_zero()); + assert!(!::Currency::total_balance_on_hold(&deposit_owner_old).is_zero()); let origin = ::EnsureOrigin::generate_origin(deposit_owner_new.clone(), root_acc.into()); }: _(origin, hierarchy_id) verify { - assert_eq!(::Currency::reserved_balance(&deposit_owner_new), ::Deposit::get()); + assert_eq!(::Currency::total_balance_on_hold(&deposit_owner_new), ::Deposit::get()); } update_deposit { @@ -479,7 +482,7 @@ benchmarks! { let child_id: T::DelegationNodeId = *children.iter().next().ok_or("Root should have children")?; let child_delegation = DelegationNodes::::get(child_id).ok_or("Child of root should have delegation id")?; - ::Currency::make_free_balance_be( + ::Currency::set_balance( &deposit_owner, ::Currency::minimum_balance() + ::Deposit::get(), ); diff --git a/pallets/delegation/src/mock.rs b/pallets/delegation/src/mock.rs index 08c0431fce..a5b2a7652d 100644 --- a/pallets/delegation/src/mock.rs +++ b/pallets/delegation/src/mock.rs @@ -535,7 +535,7 @@ pub(crate) mod runtime { pub fn build_with_keystore(self) -> sp_io::TestExternalities { let mut ext = self.build(); - let keystore = sp_keystore::testing::KeyStore::new(); + let keystore = sp_keystore::testing::MemoryKeystore::new(); ext.register_extension(sp_keystore::KeystoreExt(sp_std::sync::Arc::new(keystore))); ext diff --git a/pallets/did/src/benchmarking.rs b/pallets/did/src/benchmarking.rs index e1ae8ab0c6..b06bb2081e 100644 --- a/pallets/did/src/benchmarking.rs +++ b/pallets/did/src/benchmarking.rs @@ -17,11 +17,10 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use super::*; - use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, Zero}; use frame_support::{ assert_ok, - traits::{Currency, ReservableCurrency}, + traits::fungible::{Inspect, Mutate, MutateHold}, }; use frame_system::RawOrigin; use parity_scale_codec::Encode; @@ -30,7 +29,10 @@ use sp_io::crypto::{ecdsa_generate, ecdsa_sign, ed25519_generate, ed25519_sign, use sp_runtime::{traits::IdentifyAccount, AccountId32, MultiSigner}; use sp_std::{convert::TryInto, vec::Vec}; -use kilt_support::{deposit::Deposit, signature::VerifySignature}; +use kilt_support::{ + deposit::{Deposit, HFIdentifier}, + signature::VerifySignature, +}; use crate::{ did_details::{ @@ -89,12 +91,12 @@ fn get_ecdsa_public_delegation_key() -> ecdsa::Public { } fn make_free_for_did(account: &AccountIdOf) { - let balance = as Currency>>::minimum_balance() + let balance = as Inspect>>::minimum_balance() + ::BaseDeposit::get() + ::BaseDeposit::get() + ::BaseDeposit::get() + ::Fee::get(); - as Currency>>::make_free_balance_be(account, balance); + as Mutate>>::set_balance(account, balance); } // Must always be dispatched with the DID authentication key @@ -1144,7 +1146,7 @@ benchmarks! { did_details.deposit.owner = did_account.clone(); make_free_for_did::(&did_account); - CurrencyOf::::reserve(&did_account, did_details.deposit.amount).expect("should reserve currency"); + CurrencyOf::::hold(&HFIdentifier::Deposit ,&did_account, did_details.deposit.amount).expect("should reserve currency"); Did::::insert(&did_subject, did_details); let origin = RawOrigin::Signed(did_subject.clone()); @@ -1170,7 +1172,7 @@ benchmarks! { Did::::insert(&did_subject, did_details.clone()); make_free_for_did::(&did_account); - CurrencyOf::::reserve(&did_account, did_details.deposit.amount).expect("should reserve currency"); + CurrencyOf::::hold(&HFIdentifier::Deposit, &did_account, did_details.deposit.amount).expect("should reserve currency"); let origin = RawOrigin::Signed(did_subject.clone()); let did_to_update = did_subject.clone(); diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index 379510ca58..f187d51002 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -80,18 +80,18 @@ #![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::unused_unit)] +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarking; pub mod default_weights; pub mod did_details; pub mod errors; -pub mod origin; -pub mod service_endpoints; - -#[cfg(feature = "runtime-benchmarks")] -pub mod benchmarking; +pub mod migration; #[cfg(test)] mod mock; #[cfg(any(feature = "runtime-benchmarks", test))] mod mock_utils; +pub mod origin; +pub mod service_endpoints; #[cfg(test)] mod tests; @@ -140,7 +140,7 @@ pub mod pallet { use frame_support::{ pallet_prelude::*, traits::{ - fungible::{Inspect, MutateHold}, + fungible::{Inspect, Mutate, MutateHold}, Currency, ExistenceRequirement, Imbalance, ReservableCurrency, StorageVersion, }, }; @@ -220,7 +220,9 @@ pub mod pallet { type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The currency that is used to reserve funds for each did. - type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; + type Currency: ReservableCurrency> + + MutateHold, Reason = HFIdentifier> + + Mutate>; /// The amount of balance that will be taken for each DID as a deposit /// to incentivise fair use of the on chain storage. The deposits diff --git a/pallets/did/src/migration.rs b/pallets/did/src/migration.rs new file mode 100644 index 0000000000..370ee2080a --- /dev/null +++ b/pallets/did/src/migration.rs @@ -0,0 +1,105 @@ +// KILT Blockchain – https://botlabs.org +// Copyright (C) 2019-2023 BOTLabs GmbH + +// The KILT Blockchain is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The KILT Blockchain is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@botlabs.org + +use frame_support::{ + traits::{Get, OnRuntimeUpgrade}, + weights::Weight, +}; +use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use log; +use sp_runtime::SaturatedConversion; +use sp_std::marker::PhantomData; + +use crate::{did_details::DidDetails, AccountIdOf, Config, CurrencyOf, Did}; + +pub struct BalanceMigration(PhantomData); + +impl OnRuntimeUpgrade for BalanceMigration { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + log::info!("Did: Initiating migration"); + if ensure_upgraded::() { + return do_migration::(); + } + + log::info!("Did: No migration needed. This file should be deleted."); + ::DbWeight::get().reads_writes(0, 0) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + use frame_support::ensure; + use sp_std::vec; + + let has_one_user_holds = Did::::iter_values() + .map(|details: DidDetails| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| !user); + + // before the upgrade, there should be no account with holds + ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + + Ok(vec![]) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { + use frame_support::ensure; + + let has_all_user_holds = Did::::iter_values() + .map(|details: DidDetails| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| user); + + // before the upgrade, there should be no account with holds + ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); + + Ok(()) + } +} + +/// Checks if there is an user, who has still reserved balance and no holds. If +/// yes, the migration is not executed yet. +fn ensure_upgraded() -> bool { + Did::::iter_values() + .map(|details: DidDetails| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .any(|user| !user) +} + +fn do_migration() -> Weight { + Did::::iter() + .map(|(key, did_details)| -> Weight { + let deposit = did_details.deposit; + let error = switch_reserved_to_hold::, CurrencyOf>( + deposit.owner, + deposit.amount.saturated_into(), + ); + + if error.is_ok() { + return ::DbWeight::get().reads_writes(1, 1); + } + + log::error!(" Did: Could not convert reserves to hold from did: {:?} ", key); + + ::DbWeight::get().reads_writes(0, 0) + }) + .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) +} diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index 95a0587ed6..1e17751772 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -525,7 +525,7 @@ impl ExtBuilder { pub fn build_with_keystore(self) -> sp_io::TestExternalities { let mut ext = self.build(None); - let keystore = sp_keystore::testing::KeyStore::new(); + let keystore = sp_keystore::testing::MemoryKeystore::new(); ext.register_extension(sp_keystore::KeystoreExt(sp_std::sync::Arc::new(keystore))); ext diff --git a/pallets/pallet-configuration/src/mock.rs b/pallets/pallet-configuration/src/mock.rs index f361e3220e..5196487496 100644 --- a/pallets/pallet-configuration/src/mock.rs +++ b/pallets/pallet-configuration/src/mock.rs @@ -139,12 +139,12 @@ pub mod runtime { #[cfg(feature = "runtime-benchmarks")] pub(crate) fn build_with_keystore(self) -> sp_io::TestExternalities { - use sp_keystore::{testing::KeyStore, KeystoreExt}; + use sp_keystore::{testing::MemoryKeystore, KeystoreExt}; use sp_std::sync::Arc; let mut ext = self.build(); - let keystore = KeyStore::new(); + let keystore = MemoryKeystore::new(); ext.register_extension(KeystoreExt(Arc::new(keystore))); ext diff --git a/pallets/pallet-did-lookup/src/benchmarking.rs b/pallets/pallet-did-lookup/src/benchmarking.rs index 2f46e34923..3bcdaa775a 100644 --- a/pallets/pallet-did-lookup/src/benchmarking.rs +++ b/pallets/pallet-did-lookup/src/benchmarking.rs @@ -22,7 +22,7 @@ use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite}; use frame_support::{ crypto::ecdsa::ECDSAExt, - traits::{Currency, Get}, + traits::{fungible::Mutate, Get}, }; use frame_system::RawOrigin; use sha3::{Digest, Keccak256}; @@ -30,7 +30,7 @@ use sp_io::crypto::{ecdsa_generate, ed25519_generate, sr25519_generate}; use sp_runtime::{ app_crypto::{ed25519, sr25519}, traits::IdentifyAccount, - AccountId32, KeyTypeId, + AccountId32, KeyTypeId, SaturatedConversion, }; use kilt_support::{deposit::Deposit, traits::GenerateBenchmarkOrigin}; @@ -48,10 +48,8 @@ const SEED: u32 = 0; // Free 2x deposit amount + existential deposit so that we can use this function // to link an account two times to two different DIDs. fn make_free_for_did(account: &AccountIdOf) { - let balance = as Currency>>::minimum_balance() - + ::Deposit::get() - + ::Deposit::get(); - as Currency>>::make_free_balance_be(account, balance); + let balance = ::Deposit::get() + ::Deposit::get() + ::Deposit::get(); + CurrencyOf::::set_balance(account, balance.saturated_into()); } benchmarks! { diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index 784be73afc..9344484819 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -58,7 +58,7 @@ pub mod pallet { ensure, pallet_prelude::*, traits::{ - fungible::{InspectHold, MutateHold}, + fungible::{InspectHold, Mutate, MutateHold}, tokens::fungible::Inspect, ReservableCurrency, StorageVersion, }, @@ -103,7 +103,9 @@ pub mod pallet { type DidIdentifier: Parameter + AsRef<[u8]> + MaxEncodedLen + MaybeSerializeDeserialize; /// The currency that is used to reserve funds for each did. - type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; + type Currency: ReservableCurrency> + + MutateHold, Reason = HFIdentifier> + + Mutate>; /// The amount of balance that will be taken for each DID as a deposit /// to incentivise fair use of the on chain storage. The deposit can be diff --git a/pallets/pallet-did-lookup/src/mock.rs b/pallets/pallet-did-lookup/src/mock.rs index a9ca1589a4..0822c71056 100644 --- a/pallets/pallet-did-lookup/src/mock.rs +++ b/pallets/pallet-did-lookup/src/mock.rs @@ -225,7 +225,7 @@ impl ExtBuilder { pub fn build_with_keystore(self) -> sp_io::TestExternalities { let mut ext = self.build(); - let keystore = sp_keystore::testing::KeyStore::new(); + let keystore = sp_keystore::testing::MemoryKeystore::new(); ext.register_extension(sp_keystore::KeystoreExt(std::sync::Arc::new(keystore))); ext diff --git a/pallets/pallet-web3-names/src/benchmarking.rs b/pallets/pallet-web3-names/src/benchmarking.rs index ba031d08ed..dd1b5e1119 100644 --- a/pallets/pallet-web3-names/src/benchmarking.rs +++ b/pallets/pallet-web3-names/src/benchmarking.rs @@ -21,7 +21,10 @@ use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, vec, Ve use frame_support::{ pallet_prelude::EnsureOrigin, sp_runtime::SaturatedConversion, - traits::{Currency, Get}, + traits::{ + fungible::{Inspect, Mutate}, + Get, + }, BoundedVec, }; use frame_system::RawOrigin; @@ -38,10 +41,10 @@ const CALLER_SEED: u32 = 0; const OWNER_SEED: u32 = 1; fn make_free_for_did(account: &AccountIdOf) { - let balance = as Currency>>::minimum_balance() + let balance = as Inspect>>::minimum_balance() + ::Deposit::get() + ::Deposit::get(); - as Currency>>::make_free_balance_be(account, balance); + CurrencyOf::::set_balance(account, balance); } fn generate_web3_name_input(length: usize) -> Vec { diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index 1d2502556c..cc685999c1 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -46,7 +46,7 @@ pub mod pallet { pallet_prelude::*, sp_runtime::SaturatedConversion, traits::{ - fungible::{Inspect, InspectHold, MutateHold}, + fungible::{Inspect, InspectHold, Mutate, MutateHold}, ReservableCurrency, StorageVersion, }, Blake2_128Concat, @@ -107,7 +107,9 @@ pub mod pallet { /// The type of origin after a successful origin check. type OriginSuccess: CallSources, Web3NameOwnerOf>; /// The currency type to reserve and release deposits. - type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; + type Currency: ReservableCurrency> + + MutateHold, Reason = HFIdentifier> + + Mutate>; /// The amount of KILT to deposit to claim a name. #[pallet::constant] type Deposit: Get>; diff --git a/pallets/pallet-web3-names/src/mock.rs b/pallets/pallet-web3-names/src/mock.rs index b84bde379b..14275b0602 100644 --- a/pallets/pallet-web3-names/src/mock.rs +++ b/pallets/pallet-web3-names/src/mock.rs @@ -254,7 +254,7 @@ pub(crate) mod runtime { pub fn build_with_keystore(self) -> sp_io::TestExternalities { let mut ext = self.build(); - let keystore = sp_keystore::testing::KeyStore::new(); + let keystore = sp_keystore::testing::MemoryKeystore::new(); ext.register_extension(sp_keystore::KeystoreExt(std::sync::Arc::new(keystore))); ext diff --git a/pallets/public-credentials/src/benchmarking.rs b/pallets/public-credentials/src/benchmarking.rs index fbb928efd5..1bd31061da 100644 --- a/pallets/public-credentials/src/benchmarking.rs +++ b/pallets/public-credentials/src/benchmarking.rs @@ -19,7 +19,7 @@ use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, Zero}; use frame_support::{ dispatch::RawOrigin, - traits::{Currency, Get}, + traits::{fungible::Mutate, Get}, BoundedVec, }; use sp_std::{boxed::Box, vec, vec::Vec}; @@ -41,8 +41,11 @@ use crate::{ const SEED: u32 = 0; fn reserve_balance(acc: &T::AccountId) { - // Has to be more than the deposit, we do 2x just to be safe - CurrencyOf::::make_free_balance_be(acc, ::Deposit::get() + ::Deposit::get()); + // Has to be more than the deposit, we do 3x just to be safe + CurrencyOf::::set_balance( + acc, + ::Deposit::get() + ::Deposit::get() + ::Deposit::get(), + ); } benchmarks! { diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index 75e3e72527..b2b271f9f5 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -58,7 +58,7 @@ pub mod pallet { use frame_support::{ pallet_prelude::*, traits::{ - fungible::{Inspect, MutateHold}, + fungible::{Inspect, Mutate, MutateHold}, IsType, ReservableCurrency, StorageVersion, }, Parameter, @@ -135,7 +135,9 @@ pub mod pallet { /// The type of a credential identifier. type CredentialId: Parameter + MaxEncodedLen; /// The currency that is used to reserve funds for each credential. - type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; + type Currency: ReservableCurrency> + + MutateHold, Reason = HFIdentifier> + + Mutate>; /// The type of the origin when successfully converted from the outer /// origin. type OriginSuccess: CallSources>; diff --git a/pallets/public-credentials/src/mock.rs b/pallets/public-credentials/src/mock.rs index 6cdac80acb..4545666513 100644 --- a/pallets/public-credentials/src/mock.rs +++ b/pallets/public-credentials/src/mock.rs @@ -463,7 +463,7 @@ pub(crate) mod runtime { pub(crate) fn build_with_keystore(self) -> sp_io::TestExternalities { let mut ext = self.build(); - let keystore = sp_keystore::testing::KeyStore::new(); + let keystore = sp_keystore::testing::MemoryKeystore::new(); ext.register_extension(sp_keystore::KeystoreExt(std::sync::Arc::new(keystore))); ext diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 06841c4ca2..1ece443286 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -1088,6 +1088,9 @@ pub type Executive = frame_executive::Executive< ( pallet_did_lookup::migrations::CleanupMigration, runtime_common::migrations::RemoveInsecureRandomnessPallet, + did::migration::BalanceMigration, + delegation::migration::BalanceMigration, + attestation::migration::BalanceMigration, ), >; From 737f6752044d6c5e2b611fb24275c835bfceb722 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 31 May 2023 10:29:20 +0200 Subject: [PATCH 18/99] refactor --- pallets/pallet-did-lookup/src/benchmarking.rs | 8 ++-- pallets/pallet-did-lookup/src/lib.rs | 42 ++++++------------- pallets/pallet-did-lookup/src/mock.rs | 21 ++++------ 3 files changed, 24 insertions(+), 47 deletions(-) diff --git a/pallets/pallet-did-lookup/src/benchmarking.rs b/pallets/pallet-did-lookup/src/benchmarking.rs index 3bcdaa775a..fc7bd817f1 100644 --- a/pallets/pallet-did-lookup/src/benchmarking.rs +++ b/pallets/pallet-did-lookup/src/benchmarking.rs @@ -30,7 +30,7 @@ use sp_io::crypto::{ecdsa_generate, ed25519_generate, sr25519_generate}; use sp_runtime::{ app_crypto::{ed25519, sr25519}, traits::IdentifyAccount, - AccountId32, KeyTypeId, SaturatedConversion, + AccountId32, KeyTypeId, }; use kilt_support::{deposit::Deposit, traits::GenerateBenchmarkOrigin}; @@ -48,8 +48,10 @@ const SEED: u32 = 0; // Free 2x deposit amount + existential deposit so that we can use this function // to link an account two times to two different DIDs. fn make_free_for_did(account: &AccountIdOf) { - let balance = ::Deposit::get() + ::Deposit::get() + ::Deposit::get(); - CurrencyOf::::set_balance(account, balance.saturated_into()); + let balance = as Currency>>::minimum_balance() + + ::Deposit::get() + + ::Deposit::get(); + CurrencyOf::::set_balance(account, balance); } benchmarks! { diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index 9344484819..c0b3bb8d3a 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -58,8 +58,7 @@ pub mod pallet { ensure, pallet_prelude::*, traits::{ - fungible::{InspectHold, Mutate, MutateHold}, - tokens::fungible::Inspect, + fungible::{Inspect, InspectHold, Mutate, MutateHold}, ReservableCurrency, StorageVersion, }, }; @@ -71,7 +70,7 @@ pub mod pallet { use runtime_common::Balance; use sp_runtime::SaturatedConversion; - use sp_runtime::traits::{BlockNumberProvider, MaybeSerializeDeserialize}; + use sp_runtime::traits::BlockNumberProvider; pub use crate::connection_record::ConnectionRecord; @@ -84,8 +83,9 @@ pub mod pallet { /// The currency module that keeps track of balances. pub(crate) type CurrencyOf = ::Currency; + pub type BalanceOf = as Inspect>>::Balance; /// The connection record type. - pub(crate) type ConnectionRecordOf = ConnectionRecord, AccountIdOf, Balance>; + pub(crate) type ConnectionRecordOf = ConnectionRecord, AccountIdOf, BalanceOf>; pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(4); @@ -104,14 +104,14 @@ pub mod pallet { /// The currency that is used to reserve funds for each did. type Currency: ReservableCurrency> - + MutateHold, Reason = HFIdentifier> + + MutateHold, Reason = HFIdentifier, Balance = Balance> + Mutate>; /// The amount of balance that will be taken for each DID as a deposit /// to incentivise fair use of the on chain storage. The deposit can be /// reclaimed when the DID is deleted. #[pallet::constant] - type Deposit: Get; + type Deposit: Get>; /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; @@ -254,7 +254,7 @@ pub mod pallet { >>::can_hold( &HFIdentifier::Deposit, &sender, - ::Deposit::get().saturated_into() + ::Deposit::get() ), Error::::InsufficientFunds ); @@ -421,10 +421,7 @@ pub mod pallet { if let Some(old_connection) = did_entry.replace(record) { ConnectedAccounts::::remove(&old_connection.did, &account); Self::deposit_event(Event::::AssociationRemoved(account.clone(), old_connection.did)); - kilt_support::free_deposit::, CurrencyOf>(&Deposit { - owner: old_connection.deposit.owner, - amount: old_connection.deposit.amount.saturated_into(), - })?; + kilt_support::free_deposit::, CurrencyOf>(&old_connection.deposit)?; } Ok(()) })?; @@ -437,10 +434,7 @@ pub mod pallet { pub(crate) fn remove_association(account: LinkableAccountId) -> DispatchResult { if let Some(connection) = ConnectedDids::::take(&account) { ConnectedAccounts::::remove(&connection.did, &account); - kilt_support::free_deposit::, CurrencyOf>(&Deposit { - owner: connection.deposit.owner, - amount: connection.deposit.amount.saturated_into(), - })?; + kilt_support::free_deposit::, CurrencyOf>(&connection.deposit)?; Self::deposit_event(Event::AssociationRemoved(account, connection.did)); Ok(()) @@ -458,14 +452,11 @@ pub mod pallet { key: &LinkableAccountId, ) -> Result, >>::Balance>, DispatchError> { let record = ConnectedDids::::get(key).ok_or(Error::::NotFound)?; - Ok(Deposit { - owner: record.deposit.owner, - amount: record.deposit.amount.saturated_into(), - }) + Ok(record.deposit) } fn deposit_amount(_key: &LinkableAccountId) -> >>::Balance { - T::Deposit::get().saturated_into() + T::Deposit::get() } fn store_deposit( @@ -473,16 +464,7 @@ pub mod pallet { deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { let record = ConnectedDids::::get(key).ok_or(Error::::NotFound)?; - ConnectedDids::::insert( - key, - ConnectionRecord { - deposit: Deposit { - owner: deposit.owner, - amount: deposit.amount.saturated_into(), - }, - ..record - }, - ); + ConnectedDids::::insert(key, ConnectionRecord { deposit, ..record }); Ok(()) } diff --git a/pallets/pallet-did-lookup/src/mock.rs b/pallets/pallet-did-lookup/src/mock.rs index 0822c71056..45881ac53d 100644 --- a/pallets/pallet-did-lookup/src/mock.rs +++ b/pallets/pallet-did-lookup/src/mock.rs @@ -24,11 +24,11 @@ use kilt_support::{ use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, - MultiSignature, SaturatedConversion, + MultiSignature, }; use crate::{ - self as pallet_did_lookup, linkable_account::LinkableAccountId, AccountIdOf, Config, ConnectedAccounts, + self as pallet_did_lookup, linkable_account::LinkableAccountId, AccountIdOf, BalanceOf, Config, ConnectedAccounts, ConnectedDids, ConnectionRecord, CurrencyOf, DidIdentifierOf, }; @@ -144,7 +144,7 @@ pub(crate) fn insert_raw_connection( sender: AccountIdOf, did_identifier: DidIdentifierOf, account: LinkableAccountId, - deposit: Balance, + deposit: BalanceOf, ) { let deposit = Deposit { owner: sender, @@ -155,21 +155,14 @@ pub(crate) fn insert_raw_connection( did: did_identifier.clone(), }; - CurrencyOf::::hold( - &HFIdentifier::Deposit, - &record.deposit.owner, - record.deposit.amount.saturated_into(), - ) - .expect("Account should have enough balance"); + kilt_support::reserve_deposit::, CurrencyOf>(record.deposit.owner.clone(), record.deposit.amount) + .expect("Account should have enough balance"); ConnectedDids::::mutate(&account, |did_entry| { if let Some(old_connection) = did_entry.replace(record) { ConnectedAccounts::::remove(&old_connection.did, &account); - kilt_support::free_deposit::, CurrencyOf>(&Deposit { - owner: old_connection.deposit.owner, - amount: old_connection.deposit.amount.saturated_into(), - }) - .expect("Could not release deposit of account"); + kilt_support::free_deposit::, CurrencyOf>(&old_connection.deposit) + .expect("Could not release deposit of account"); } }); ConnectedAccounts::::insert(&did_identifier, &account, ()); From 9a565ed6cbda6e35295847b41e7fd4e979a8fc2a Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 31 May 2023 10:35:44 +0200 Subject: [PATCH 19/99] refactor --- pallets/pallet-did-lookup/src/benchmarking.rs | 7 +++++-- pallets/pallet-did-lookup/src/mock.rs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pallets/pallet-did-lookup/src/benchmarking.rs b/pallets/pallet-did-lookup/src/benchmarking.rs index fc7bd817f1..82bf0e29b6 100644 --- a/pallets/pallet-did-lookup/src/benchmarking.rs +++ b/pallets/pallet-did-lookup/src/benchmarking.rs @@ -22,7 +22,10 @@ use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite}; use frame_support::{ crypto::ecdsa::ECDSAExt, - traits::{fungible::Mutate, Get}, + traits::{ + fungible::{Inspect, Mutate}, + Get, + }, }; use frame_system::RawOrigin; use sha3::{Digest, Keccak256}; @@ -48,7 +51,7 @@ const SEED: u32 = 0; // Free 2x deposit amount + existential deposit so that we can use this function // to link an account two times to two different DIDs. fn make_free_for_did(account: &AccountIdOf) { - let balance = as Currency>>::minimum_balance() + let balance = as Inspect>>::minimum_balance() + ::Deposit::get() + ::Deposit::get(); CurrencyOf::::set_balance(account, balance); diff --git a/pallets/pallet-did-lookup/src/mock.rs b/pallets/pallet-did-lookup/src/mock.rs index 45881ac53d..5e5268cfb8 100644 --- a/pallets/pallet-did-lookup/src/mock.rs +++ b/pallets/pallet-did-lookup/src/mock.rs @@ -16,7 +16,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{parameter_types, traits::fungible::MutateHold}; +use frame_support::parameter_types; use kilt_support::{ deposit::{Deposit, HFIdentifier}, mock::{mock_origin, SubjectId}, From 206a8da3b9bc3bfee49172065e378dd3f7ca8006 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 31 May 2023 10:38:11 +0200 Subject: [PATCH 20/99] refactor pallet-did-lookup --- pallets/pallet-did-lookup/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index c0b3bb8d3a..1dadb5d839 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -68,7 +68,6 @@ pub mod pallet { traits::{CallSources, StorageDepositCollector}, }; use runtime_common::Balance; - use sp_runtime::SaturatedConversion; use sp_runtime::traits::BlockNumberProvider; @@ -289,7 +288,7 @@ pub mod pallet { >>::can_hold( &HFIdentifier::Deposit, &source.sender(), - ::Deposit::get().saturated_into() + ::Deposit::get() ), Error::::InsufficientFunds ); @@ -414,7 +413,7 @@ pub mod pallet { kilt_support::deposit::reserve_deposit::, CurrencyOf>( record.deposit.owner.clone(), - record.deposit.amount.saturated_into(), + record.deposit.amount, )?; ConnectedDids::::mutate(&account, |did_entry| -> DispatchResult { From 4786f955ce9202207b07db6462bd77669a709fa1 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 31 May 2023 13:45:57 +0200 Subject: [PATCH 21/99] remove reservableCurrency --- pallets/attestation/src/benchmarking.rs | 3 +- pallets/attestation/src/lib.rs | 10 +- pallets/attestation/src/migration.rs | 17 +++- pallets/delegation/src/benchmarking.rs | 6 +- pallets/delegation/src/lib.rs | 13 +-- pallets/delegation/src/migration.rs | 17 +++- pallets/delegation/src/mock.rs | 1 + pallets/did/src/benchmarking.rs | 6 +- pallets/did/src/lib.rs | 6 +- pallets/pallet-did-lookup/src/benchmarking.rs | 6 +- pallets/pallet-did-lookup/src/lib.rs | 10 +- pallets/pallet-did-lookup/src/migrations.rs | 93 ++++++++++++++++++- pallets/pallet-inflation/src/mock.rs | 6 +- pallets/pallet-web3-names/src/benchmarking.rs | 6 +- pallets/pallet-web3-names/src/lib.rs | 8 +- pallets/pallet-web3-names/src/migration.rs | 17 +++- .../public-credentials/src/benchmarking.rs | 8 +- pallets/public-credentials/src/lib.rs | 8 +- pallets/public-credentials/src/migration.rs | 17 +++- runtimes/peregrine/src/lib.rs | 9 +- runtimes/spiritnet/src/lib.rs | 6 ++ 21 files changed, 204 insertions(+), 69 deletions(-) diff --git a/pallets/attestation/src/benchmarking.rs b/pallets/attestation/src/benchmarking.rs index baa6c8fed8..89e4a0a117 100644 --- a/pallets/attestation/src/benchmarking.rs +++ b/pallets/attestation/src/benchmarking.rs @@ -34,7 +34,8 @@ benchmarks! { T: core::fmt::Debug, ::EnsureOrigin: GenerateBenchmarkOrigin, T: ctype::Config, - T::BlockNumber: From + T::BlockNumber: From, + ::Currency: Mutate } add { diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index d6d8b7359b..02bb3e1366 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -88,11 +88,7 @@ pub mod pallet { use frame_support::{ dispatch::{DispatchResult, DispatchResultWithPostInfo}, pallet_prelude::*, - traits::{ - fungible::{Mutate, MutateHold}, - tokens::fungible::Inspect, - Get, ReservableCurrency, StorageVersion, - }, + traits::{fungible::MutateHold, tokens::fungible::Inspect, Get, StorageVersion}, }; use frame_system::pallet_prelude::*; @@ -131,9 +127,7 @@ pub mod pallet { type WeightInfo: WeightInfo; /// The currency that is used to hold funds for each attestation. - type Currency: ReservableCurrency> - + MutateHold, Reason = HFIdentifier> - + Mutate>; + type Currency: MutateHold, Reason = HFIdentifier>; /// The deposit that is required for storing an attestation. #[pallet::constant] diff --git a/pallets/attestation/src/migration.rs b/pallets/attestation/src/migration.rs index b9cd918343..7eeef4b826 100644 --- a/pallets/attestation/src/migration.rs +++ b/pallets/attestation/src/migration.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade}, + traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; @@ -29,7 +29,10 @@ use crate::{AccountIdOf, AttestationDetails, Attestations, Config, CurrencyOf}; pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration { +impl OnRuntimeUpgrade for BalanceMigration +where + ::Currency: ReservableCurrency, +{ fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Attestation: Initiating migration"); if ensure_upgraded::() { @@ -76,7 +79,10 @@ impl OnRuntimeUpgrade for BalanceMigration { /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn ensure_upgraded() -> bool { +fn ensure_upgraded() -> bool +where + ::Currency: ReservableCurrency, +{ Attestations::::iter_values() .map(|details: AttestationDetails| { has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) @@ -84,7 +90,10 @@ fn ensure_upgraded() -> bool { .any(|user| !user) } -fn do_migration() -> Weight { +fn do_migration() -> Weight +where + ::Currency: ReservableCurrency, +{ Attestations::::iter() .map(|(key, attestations_detail)| -> Weight { let deposit = attestations_detail.deposit; diff --git a/pallets/delegation/src/benchmarking.rs b/pallets/delegation/src/benchmarking.rs index c2127a2bad..dc9ff4cdd1 100644 --- a/pallets/delegation/src/benchmarking.rs +++ b/pallets/delegation/src/benchmarking.rs @@ -66,6 +66,7 @@ where T::CtypeCreatorId: From, ::EnsureOrigin: GenerateBenchmarkOrigin, T::BlockNumber: From, + ::Currency: Mutate, { log::info!("create delegation root"); let root_public = sr25519_generate(KeyTypeId(*b"aura"), None); @@ -123,6 +124,7 @@ where <::DelegationSignatureVerification as VerifySignature>::Payload, )>, ::EnsureOrigin: GenerateBenchmarkOrigin, + ::Currency: Mutate, { if level == 0 { return Ok((parent_acc_public, parent_acc_id, parent_id)); @@ -204,6 +206,7 @@ where )>, ::EnsureOrigin: GenerateBenchmarkOrigin, T::BlockNumber: From, + ::Currency: Mutate, { let ( DelegationTriplet:: { @@ -239,7 +242,8 @@ benchmarks! { <::DelegationSignatureVerification as VerifySignature>::Payload, )>, ::EnsureOrigin: GenerateBenchmarkOrigin, - T::BlockNumber: From + T::BlockNumber: From, + ::Currency: Mutate } create_hierarchy { diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index 85dcd24226..543a7fe3ed 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -81,12 +81,7 @@ mod try_state; pub use crate::{access_control::DelegationAc, default_weights::WeightInfo, delegation_hierarchy::*, pallet::*}; -use frame_support::{ - dispatch::DispatchResult, - ensure, - pallet_prelude::Weight, - traits::{Get, ReservableCurrency}, -}; +use frame_support::{dispatch::DispatchResult, ensure, pallet_prelude::Weight, traits::Get}; use kilt_support::traits::StorageDepositCollector; use parity_scale_codec::Encode; use sp_runtime::{traits::Hash, DispatchError}; @@ -99,7 +94,7 @@ pub mod pallet { use frame_support::{ pallet_prelude::*, traits::{ - fungible::{Inspect, Mutate, MutateHold}, + fungible::{Inspect, MutateHold}, StorageVersion, }, }; @@ -155,9 +150,7 @@ pub mod pallet { type WeightInfo: WeightInfo; /// The currency that is used to reserve funds for each delegation. - type Currency: ReservableCurrency> - + Mutate> - + MutateHold, Reason = HFIdentifier>; + type Currency: MutateHold, Reason = HFIdentifier>; /// The deposit that is required for storing a delegation. #[pallet::constant] diff --git a/pallets/delegation/src/migration.rs b/pallets/delegation/src/migration.rs index 7cb403b61e..b67ae167fe 100644 --- a/pallets/delegation/src/migration.rs +++ b/pallets/delegation/src/migration.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade}, + traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; @@ -29,7 +29,10 @@ use crate::{AccountIdOf, Config, CurrencyOf, DelegationNode, DelegationNodes}; pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration { +impl OnRuntimeUpgrade for BalanceMigration +where + ::Currency: ReservableCurrency, +{ fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Delegation: Initiating migration"); if ensure_upgraded::() { @@ -76,7 +79,10 @@ impl OnRuntimeUpgrade for BalanceMigration { /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn ensure_upgraded() -> bool { +fn ensure_upgraded() -> bool +where + ::Currency: ReservableCurrency, +{ DelegationNodes::::iter_values() .map(|details: DelegationNode| { has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) @@ -84,7 +90,10 @@ fn ensure_upgraded() -> bool { .any(|user| !user) } -fn do_migration() -> Weight { +fn do_migration() -> Weight +where + ::Currency: ReservableCurrency, +{ DelegationNodes::::iter() .map(|(key, delegation_detail)| -> Weight { let deposit = delegation_detail.deposit; diff --git a/pallets/delegation/src/mock.rs b/pallets/delegation/src/mock.rs index a5b2a7652d..b93c2f8710 100644 --- a/pallets/delegation/src/mock.rs +++ b/pallets/delegation/src/mock.rs @@ -76,6 +76,7 @@ pub fn initialize_pallet( delegation_hierarchies: DelegationHierarchyInitialization, ) where T: Config, + ::Currency: Mutate>, { for (root_id, details, hierarchy_owner, deposit_owner) in delegation_hierarchies { // manually mint to enable deposit reserving diff --git a/pallets/did/src/benchmarking.rs b/pallets/did/src/benchmarking.rs index b06bb2081e..eac6e954cd 100644 --- a/pallets/did/src/benchmarking.rs +++ b/pallets/did/src/benchmarking.rs @@ -90,7 +90,10 @@ fn get_ecdsa_public_delegation_key() -> ecdsa::Public { ecdsa_generate(DELEGATION_KEY_ID, None) } -fn make_free_for_did(account: &AccountIdOf) { +fn make_free_for_did(account: &AccountIdOf) +where + ::Currency: Mutate, +{ let balance = as Inspect>>::minimum_balance() + ::BaseDeposit::get() + ::BaseDeposit::get() @@ -128,6 +131,7 @@ benchmarks! { T::DidIdentifier: From, ::RuntimeOrigin: From>, ::AccountId: From, + ::Currency: Mutate } /* create extrinsic */ diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index f187d51002..b3beb43d04 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -140,7 +140,7 @@ pub mod pallet { use frame_support::{ pallet_prelude::*, traits::{ - fungible::{Inspect, Mutate, MutateHold}, + fungible::{Inspect, MutateHold}, Currency, ExistenceRequirement, Imbalance, ReservableCurrency, StorageVersion, }, }; @@ -220,9 +220,7 @@ pub mod pallet { type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The currency that is used to reserve funds for each did. - type Currency: ReservableCurrency> - + MutateHold, Reason = HFIdentifier> - + Mutate>; + type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; /// The amount of balance that will be taken for each DID as a deposit /// to incentivise fair use of the on chain storage. The deposits diff --git a/pallets/pallet-did-lookup/src/benchmarking.rs b/pallets/pallet-did-lookup/src/benchmarking.rs index 82bf0e29b6..25fb58e018 100644 --- a/pallets/pallet-did-lookup/src/benchmarking.rs +++ b/pallets/pallet-did-lookup/src/benchmarking.rs @@ -50,7 +50,10 @@ const SEED: u32 = 0; // Free 2x deposit amount + existential deposit so that we can use this function // to link an account two times to two different DIDs. -fn make_free_for_did(account: &AccountIdOf) { +fn make_free_for_did(account: &AccountIdOf) +where + ::Currency: Mutate, +{ let balance = as Inspect>>::minimum_balance() + ::Deposit::get() + ::Deposit::get(); @@ -63,6 +66,7 @@ benchmarks! { T::AccountId: From + From + Into + Into + From, T::DidIdentifier: From, T::EnsureOrigin: GenerateBenchmarkOrigin, + ::Currency: Mutate, } associate_account_multisig_sr25519 { diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index 1dadb5d839..d4c0fbb325 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -58,8 +58,8 @@ pub mod pallet { ensure, pallet_prelude::*, traits::{ - fungible::{Inspect, InspectHold, Mutate, MutateHold}, - ReservableCurrency, StorageVersion, + fungible::{Inspect, InspectHold, MutateHold}, + StorageVersion, }, }; use frame_system::pallet_prelude::*; @@ -102,9 +102,7 @@ pub mod pallet { type DidIdentifier: Parameter + AsRef<[u8]> + MaxEncodedLen + MaybeSerializeDeserialize; /// The currency that is used to reserve funds for each did. - type Currency: ReservableCurrency> - + MutateHold, Reason = HFIdentifier, Balance = Balance> - + Mutate>; + type Currency: MutateHold, Reason = HFIdentifier, Balance = Balance>; /// The amount of balance that will be taken for each DID as a deposit /// to incentivise fair use of the on chain storage. The deposit can be @@ -411,7 +409,7 @@ pub mod pallet { did: did_identifier.clone(), }; - kilt_support::deposit::reserve_deposit::, CurrencyOf>( + kilt_support::reserve_deposit::, CurrencyOf>( record.deposit.owner.clone(), record.deposit.amount, )?; diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index e68d8a1a6e..9ddcc3d994 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -19,14 +19,18 @@ use frame_support::{ pallet_prelude::ValueQuery, storage_alias, - traits::{Get, GetStorageVersion, OnRuntimeUpgrade, StorageVersion}, + traits::{Get, GetStorageVersion, OnRuntimeUpgrade, ReservableCurrency, StorageVersion}, + weights::Weight, }; +use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::AccountId32; use sp_std::marker::PhantomData; -use crate::{linkable_account::LinkableAccountId, Config, Pallet}; +use crate::{ + linkable_account::LinkableAccountId, AccountIdOf, Config, ConnectedDids, ConnectionRecordOf, CurrencyOf, Pallet, +}; /// A unified log target for did-lookup-migration operations. pub const LOG_TARGET: &str = "runtime::pallet-did-lookup::migrations"; @@ -114,3 +118,88 @@ impl OnRuntimeUpgrade for CleanupMigration { Ok(()) } } + +pub struct BalanceMigration(PhantomData); + +impl OnRuntimeUpgrade for BalanceMigration +where + ::Currency: ReservableCurrency, +{ + fn on_runtime_upgrade() -> frame_support::weights::Weight { + log::info!("Did lookup: Initiating migration"); + if ensure_upgraded::() { + return do_migration::(); + } + log::info!("Did lookup: No migration needed. This file should be deleted."); + ::DbWeight::get().reads_writes(0, 0) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + use frame_support::ensure; + use sp_std::vec; + + let has_one_user_holds = ConnectedDids::::iter_values() + .map(|details: ConnectionRecordOf| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| !user); + + // before the upgrade, there should be no account with holds + ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + + Ok(vec![]) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { + use frame_support::ensure; + + let has_all_user_holds = ConnectedDids::::iter_values() + .map(|details: ConnectionRecordOf| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .all(|user| user); + + // before the upgrade, there should be no account with holds + ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); + + Ok(()) + } +} + +/// Checks if there is an user, who has still reserved balance and no holds. If +/// yes, the migration is not executed yet. +fn ensure_upgraded() -> bool +where + ::Currency: ReservableCurrency, +{ + ConnectedDids::::iter_values() + .map(|details: ConnectionRecordOf| { + has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + }) + .any(|user| !user) +} + +fn do_migration() -> Weight +where + ::Currency: ReservableCurrency, +{ + ConnectedDids::::iter() + .map(|(key, did_details)| -> Weight { + let deposit = did_details.deposit; + let error = switch_reserved_to_hold::, CurrencyOf>(deposit.owner, deposit.amount); + + if error.is_ok() { + return ::DbWeight::get().reads_writes(1, 1); + } + + log::error!( + "Did lookup: Could not convert reserves to hold from connected did: {:?} ", + key, + ); + + ::DbWeight::get().reads_writes(0, 0) + }) + .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) +} diff --git a/pallets/pallet-inflation/src/mock.rs b/pallets/pallet-inflation/src/mock.rs index 8a6fc77061..2a3faa010f 100644 --- a/pallets/pallet-inflation/src/mock.rs +++ b/pallets/pallet-inflation/src/mock.rs @@ -95,15 +95,13 @@ parameter_types! { pub const ExistentialDeposit: Balance = 500; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; - pub const MaxHolds: u32 = 50; - pub const MaxFreezes: u32 = 50; } impl pallet_balances::Config for Test { type FreezeIdentifier = (); type HoldIdentifier = (); - type MaxFreezes = MaxFreezes; - type MaxHolds = MaxHolds; + type MaxFreezes = (); + type MaxHolds = (); type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; diff --git a/pallets/pallet-web3-names/src/benchmarking.rs b/pallets/pallet-web3-names/src/benchmarking.rs index dd1b5e1119..2b2a25894a 100644 --- a/pallets/pallet-web3-names/src/benchmarking.rs +++ b/pallets/pallet-web3-names/src/benchmarking.rs @@ -40,7 +40,10 @@ use crate::{ const CALLER_SEED: u32 = 0; const OWNER_SEED: u32 = 1; -fn make_free_for_did(account: &AccountIdOf) { +fn make_free_for_did(account: &AccountIdOf) +where + ::Currency: Mutate, +{ let balance = as Inspect>>::minimum_balance() + ::Deposit::get() + ::Deposit::get(); @@ -58,6 +61,7 @@ benchmarks! { T::Web3NameOwner: From, T::OwnerOrigin: GenerateBenchmarkOrigin, T::BanOrigin: EnsureOrigin, + ::Currency: Mutate, } claim { diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index cc685999c1..aad2421a6e 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -46,8 +46,8 @@ pub mod pallet { pallet_prelude::*, sp_runtime::SaturatedConversion, traits::{ - fungible::{Inspect, InspectHold, Mutate, MutateHold}, - ReservableCurrency, StorageVersion, + fungible::{Inspect, InspectHold, MutateHold}, + StorageVersion, }, Blake2_128Concat, }; @@ -107,9 +107,7 @@ pub mod pallet { /// The type of origin after a successful origin check. type OriginSuccess: CallSources, Web3NameOwnerOf>; /// The currency type to reserve and release deposits. - type Currency: ReservableCurrency> - + MutateHold, Reason = HFIdentifier> - + Mutate>; + type Currency: MutateHold, Reason = HFIdentifier>; /// The amount of KILT to deposit to claim a name. #[pallet::constant] type Deposit: Get>; diff --git a/pallets/pallet-web3-names/src/migration.rs b/pallets/pallet-web3-names/src/migration.rs index b1719e25dc..c4cda4cbbf 100644 --- a/pallets/pallet-web3-names/src/migration.rs +++ b/pallets/pallet-web3-names/src/migration.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade}, + traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; @@ -28,7 +28,10 @@ use crate::{AccountIdOf, Config, CurrencyOf, Owner, Web3OwnershipOf}; pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration { +impl OnRuntimeUpgrade for BalanceMigration +where + ::Currency: ReservableCurrency, +{ fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("W3n: Initiating migration"); if ensure_upgraded::() { @@ -74,7 +77,10 @@ impl OnRuntimeUpgrade for BalanceMigration { /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn ensure_upgraded() -> bool { +fn ensure_upgraded() -> bool +where + ::Currency: ReservableCurrency, +{ Owner::::iter_values() .map(|details: Web3OwnershipOf| { has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) @@ -82,7 +88,10 @@ fn ensure_upgraded() -> bool { .any(|user| !user) } -fn do_migration() -> Weight { +fn do_migration() -> Weight +where + ::Currency: ReservableCurrency, +{ Owner::::iter() .map(|(key, w3n_details)| -> Weight { let deposit = w3n_details.deposit; diff --git a/pallets/public-credentials/src/benchmarking.rs b/pallets/public-credentials/src/benchmarking.rs index 1bd31061da..888bfe3a7c 100644 --- a/pallets/public-credentials/src/benchmarking.rs +++ b/pallets/public-credentials/src/benchmarking.rs @@ -40,7 +40,10 @@ use crate::{ const SEED: u32 = 0; -fn reserve_balance(acc: &T::AccountId) { +fn reserve_balance(acc: &T::AccountId) +where + ::Currency: Mutate, +{ // Has to be more than the deposit, we do 3x just to be safe CurrencyOf::::set_balance( acc, @@ -57,7 +60,8 @@ benchmarks! { ::EnsureOrigin: GenerateBenchmarkOrigin, ::SubjectId: GetWorstCase + Into> + sp_std::fmt::Debug, ::CredentialId: Default, - T::BlockNumber: From + T::BlockNumber: From, + ::Currency: Mutate, } add { diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index b2b271f9f5..e74742fcf6 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -58,8 +58,8 @@ pub mod pallet { use frame_support::{ pallet_prelude::*, traits::{ - fungible::{Inspect, Mutate, MutateHold}, - IsType, ReservableCurrency, StorageVersion, + fungible::{Inspect, MutateHold}, + IsType, StorageVersion, }, Parameter, }; @@ -135,9 +135,7 @@ pub mod pallet { /// The type of a credential identifier. type CredentialId: Parameter + MaxEncodedLen; /// The currency that is used to reserve funds for each credential. - type Currency: ReservableCurrency> - + MutateHold, Reason = HFIdentifier> - + Mutate>; + type Currency: MutateHold, Reason = HFIdentifier>; /// The type of the origin when successfully converted from the outer /// origin. type OriginSuccess: CallSources>; diff --git a/pallets/public-credentials/src/migration.rs b/pallets/public-credentials/src/migration.rs index 9fdbfdff5d..60e5147476 100644 --- a/pallets/public-credentials/src/migration.rs +++ b/pallets/public-credentials/src/migration.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade}, + traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; @@ -28,7 +28,10 @@ use crate::{AccountIdOf, Config, CredentialEntryOf, Credentials, CurrencyOf}; pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration { +impl OnRuntimeUpgrade for BalanceMigration +where + ::Currency: ReservableCurrency, +{ fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Public Credentials: Initiating migration"); if ensure_upgraded::() { @@ -74,7 +77,10 @@ impl OnRuntimeUpgrade for BalanceMigration { /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn ensure_upgraded() -> bool { +fn ensure_upgraded() -> bool +where + ::Currency: ReservableCurrency, +{ Credentials::::iter_values() .map(|details: CredentialEntryOf| { has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) @@ -82,7 +88,10 @@ fn ensure_upgraded() -> bool { .any(|user| !user) } -fn do_migration() -> Weight { +fn do_migration() -> Weight +where + ::Currency: ReservableCurrency, +{ Credentials::::iter() .map(|(key, key2, pc_details)| -> Weight { let deposit = pc_details.deposit; diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 1ece443286..d8c2fe516b 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -1088,9 +1088,14 @@ pub type Executive = frame_executive::Executive< ( pallet_did_lookup::migrations::CleanupMigration, runtime_common::migrations::RemoveInsecureRandomnessPallet, - did::migration::BalanceMigration, - delegation::migration::BalanceMigration, + pallet_did_lookup::migrations::CleanupMigration, + runtime_common::migrations::RemoveInsecureRandomnessPallet, attestation::migration::BalanceMigration, + delegation::migration::BalanceMigration, + did::migration::BalanceMigration, + pallet_did_lookup::migrations::BalanceMigration, + pallet_web3_names::migration::BalanceMigration, + public_credentials::migration::BalanceMigration, ), >; diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 337717bdd4..5b013db18d 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -1075,6 +1075,12 @@ pub type Executive = frame_executive::Executive< ( pallet_did_lookup::migrations::CleanupMigration, runtime_common::migrations::RemoveInsecureRandomnessPallet, + attestation::migration::BalanceMigration, + delegation::migration::BalanceMigration, + did::migration::BalanceMigration, + pallet_did_lookup::migration::BalanceMigration, + pallet_web3_names::migration::BalanceMigration, + public_credentials::migration::BalanceMigration, ), >; From f18bc384e631fd90fa60f9ac0121d1a1a4e87f41 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 31 May 2023 14:10:08 +0200 Subject: [PATCH 22/99] update weights --- pallets/attestation/src/lib.rs | 5 +- .../peregrine/src/weights/pallet_balances.rs | 136 +++-- runtimes/peregrine/src/weights/pallet_xcm.rs | 126 ++--- .../spiritnet/src/weights/pallet_balances.rs | 254 +++++++-- runtimes/spiritnet/src/weights/pallet_xcm.rs | 484 ++++++++++++------ 5 files changed, 698 insertions(+), 307 deletions(-) diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 02bb3e1366..967d4d5715 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -88,7 +88,10 @@ pub mod pallet { use frame_support::{ dispatch::{DispatchResult, DispatchResultWithPostInfo}, pallet_prelude::*, - traits::{fungible::MutateHold, tokens::fungible::Inspect, Get, StorageVersion}, + traits::{ + fungible::{Inspect, MutateHold}, + Get, StorageVersion, + }, }; use frame_system::pallet_prelude::*; diff --git a/runtimes/peregrine/src/weights/pallet_balances.rs b/runtimes/peregrine/src/weights/pallet_balances.rs index 9b2cb09a9a..5142d679c8 100644 --- a/runtimes/peregrine/src/weights/pallet_balances.rs +++ b/runtimes/peregrine/src/weights/pallet_balances.rs @@ -1,5 +1,3 @@ -// TODO: UPDATE BEFORE RELEASE - // KILT Blockchain – https://botlabs.org // Copyright (C) 2019-2023 BOTLabs GmbH @@ -21,7 +19,7 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-04-05, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-31, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `rust-2`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -52,54 +50,75 @@ use sp_std::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { - - - fn transfer_allow_death() -> sp_weights::Weight { todo!() } - fn force_set_balance_creating() -> sp_weights::Weight { todo!() } - fn force_set_balance_killing() -> sp_weights::Weight { todo!() } - fn upgrade_accounts(_: u32) -> sp_weights::Weight { todo!() } - /// Storage: System Account (r:2 w:2) + /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - + fn transfer_allow_death() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `3597` + // Minimum execution time: 46_864_000 picoseconds. + Weight::from_parts(46_864_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `2285` - // Estimated: `2607` - // Minimum execution time: 62_417_000 picoseconds. - Weight::from_parts(62_417_000, 0) - .saturating_add(Weight::from_parts(0, 2607)) + // Measured: `270` + // Estimated: `3597` + // Minimum execution time: 36_091_000 picoseconds. + Weight::from_parts(36_091_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - + fn force_set_balance_creating() -> Weight { + // Proof Size summary in bytes: + // Measured: `481` + // Estimated: `3597` + // Minimum execution time: 14_596_000 picoseconds. + Weight::from_parts(14_596_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - - /// Storage: System Account (r:3 w:3) + fn force_set_balance_killing() -> Weight { + // Proof Size summary in bytes: + // Measured: `481` + // Estimated: `3597` + // Minimum execution time: 20_711_000 picoseconds. + Weight::from_parts(20_711_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: System Account (r:2 w:2) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `2556` - // Estimated: `7821` - // Minimum execution time: 83_010_000 picoseconds. - Weight::from_parts(83_010_000, 0) - .saturating_add(Weight::from_parts(0, 7821)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `580` + // Estimated: `6204` + // Minimum execution time: 47_308_000 picoseconds. + Weight::from_parts(47_308_000, 0) + .saturating_add(Weight::from_parts(0, 6204)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `2285` - // Estimated: `2607` - // Minimum execution time: 64_126_000 picoseconds. - Weight::from_parts(64_126_000, 0) - .saturating_add(Weight::from_parts(0, 2607)) + // Measured: `270` + // Estimated: `3597` + // Minimum execution time: 41_303_000 picoseconds. + Weight::from_parts(41_303_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,20 +126,33 @@ impl pallet_balances::WeightInfo for WeightInfo { /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_unreserve() -> Weight { // Proof Size summary in bytes: - // Measured: `1983` - // Estimated: `2607` - // Minimum execution time: 35_770_000 picoseconds. - Weight::from_parts(35_770_000, 0) - .saturating_add(Weight::from_parts(0, 2607)) + // Measured: `481` + // Estimated: `3597` + // Minimum execution time: 16_789_000 picoseconds. + Weight::from_parts(16_789_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: System Account (r:1000 w:1000) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// The range of component `u` is `[1, 1000]`. + fn upgrade_accounts(_u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `424 + u * (149 ±0)` + // Estimated: `2607990` + // Minimum execution time: 16_053_000 picoseconds. + Weight::from_parts(11_795_725_000, 0) + .saturating_add(Weight::from_parts(0, 2607990)) + .saturating_add(T::DbWeight::get().reads(1000)) + .saturating_add(T::DbWeight::get().writes(1000)) + } } #[cfg(test)] mod tests { #[test] - fn test_transfer() { + fn test_transfer_allow_death() { assert!( ::BlockWeights::get() .per_class @@ -128,7 +160,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 5214 + > 3597 ); } #[test] @@ -140,11 +172,11 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 2607 + > 3597 ); } #[test] - fn test_set_balance_creating() { + fn test_force_set_balance_creating() { assert!( ::BlockWeights::get() .per_class @@ -152,11 +184,11 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 2607 + > 3597 ); } #[test] - fn test_set_balance_killing() { + fn test_force_set_balance_killing() { assert!( ::BlockWeights::get() .per_class @@ -164,7 +196,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 2607 + > 3597 ); } #[test] @@ -176,7 +208,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 7821 + > 6204 ); } #[test] @@ -188,7 +220,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 2607 + > 3597 ); } #[test] @@ -200,7 +232,19 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 2607 + > 3597 + ); + } + #[test] + fn test_upgrade_accounts() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2607990 ); } } diff --git a/runtimes/peregrine/src/weights/pallet_xcm.rs b/runtimes/peregrine/src/weights/pallet_xcm.rs index 171a4e085a..0d86553de1 100644 --- a/runtimes/peregrine/src/weights/pallet_xcm.rs +++ b/runtimes/peregrine/src/weights/pallet_xcm.rs @@ -1,5 +1,3 @@ -// TODO: UPDATE BEFORE RELEASE - // KILT Blockchain – https://botlabs.org // Copyright (C) 2019-2023 BOTLabs GmbH @@ -21,7 +19,7 @@ //! Autogenerated weights for `pallet_xcm` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-04-05, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-31, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `rust-2`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -65,16 +63,13 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn send() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `4830` - // Minimum execution time: 53_691_000 picoseconds. - Weight::from_parts(53_691_000, 0) - .saturating_add(Weight::from_parts(0, 4830)) + // Estimated: `3540` + // Minimum execution time: 27_096_000 picoseconds. + Weight::from_parts(27_096_000, 0) + .saturating_add(Weight::from_parts(0, 3540)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } - - - fn force_suspension() -> sp_weights::Weight { todo!() } // !TODO! /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn teleport_assets() -> Weight { @@ -111,8 +106,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 23_351_000 picoseconds. - Weight::from_parts(23_351_000, 0) + // Minimum execution time: 10_952_000 picoseconds. + Weight::from_parts(10_952_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -122,8 +117,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_492_000 picoseconds. - Weight::from_parts(5_492_000, 0) + // Minimum execution time: 4_154_000 picoseconds. + Weight::from_parts(4_154_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -146,10 +141,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_subscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `8025` - // Minimum execution time: 32_747_000 picoseconds. - Weight::from_parts(32_747_000, 0) - .saturating_add(Weight::from_parts(0, 8025)) + // Estimated: `3540` + // Minimum execution time: 29_654_000 picoseconds. + Weight::from_parts(29_654_000, 0) + .saturating_add(Weight::from_parts(0, 3540)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -170,22 +165,33 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_unsubscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `257` - // Estimated: `8729` - // Minimum execution time: 27_723_000 picoseconds. - Weight::from_parts(27_723_000, 0) - .saturating_add(Weight::from_parts(0, 8729)) + // Estimated: `3722` + // Minimum execution time: 26_946_000 picoseconds. + Weight::from_parts(26_946_000, 0) + .saturating_add(Weight::from_parts(0, 3722)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: PolkadotXcm XcmExecutionSuspended (r:0 w:1) + /// Proof Skipped: PolkadotXcm XcmExecutionSuspended (max_values: Some(1), max_size: None, mode: Measured) + fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_416_000 picoseconds. + Weight::from_parts(4_416_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: PolkadotXcm SupportedVersion (r:4 w:2) /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { // Proof Size summary in bytes: // Measured: `129` - // Estimated: `10029` - // Minimum execution time: 16_511_000 picoseconds. - Weight::from_parts(16_511_000, 0) - .saturating_add(Weight::from_parts(0, 10029)) + // Estimated: `11019` + // Minimum execution time: 16_769_000 picoseconds. + Weight::from_parts(16_769_000, 0) + .saturating_add(Weight::from_parts(0, 11019)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -194,10 +200,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn migrate_version_notifiers() -> Weight { // Proof Size summary in bytes: // Measured: `133` - // Estimated: `10033` - // Minimum execution time: 16_697_000 picoseconds. - Weight::from_parts(16_697_000, 0) - .saturating_add(Weight::from_parts(0, 10033)) + // Estimated: `11023` + // Minimum execution time: 15_907_000 picoseconds. + Weight::from_parts(15_907_000, 0) + .saturating_add(Weight::from_parts(0, 11023)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -206,10 +212,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn already_notified_target() -> Weight { // Proof Size summary in bytes: // Measured: `140` - // Estimated: `12515` - // Minimum execution time: 18_638_000 picoseconds. - Weight::from_parts(18_638_000, 0) - .saturating_add(Weight::from_parts(0, 12515)) + // Estimated: `13505` + // Minimum execution time: 16_655_000 picoseconds. + Weight::from_parts(16_655_000, 0) + .saturating_add(Weight::from_parts(0, 13505)) .saturating_add(T::DbWeight::get().reads(5)) } /// Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) @@ -227,10 +233,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn notify_current_targets() -> Weight { // Proof Size summary in bytes: // Measured: `142` - // Estimated: `10257` - // Minimum execution time: 28_545_000 picoseconds. - Weight::from_parts(28_545_000, 0) - .saturating_add(Weight::from_parts(0, 10257)) + // Estimated: `6082` + // Minimum execution time: 26_604_000 picoseconds. + Weight::from_parts(26_604_000, 0) + .saturating_add(Weight::from_parts(0, 6082)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -239,10 +245,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn notify_target_migration_fail() -> Weight { // Proof Size summary in bytes: // Measured: `172` - // Estimated: `7597` - // Minimum execution time: 8_132_000 picoseconds. - Weight::from_parts(8_132_000, 0) - .saturating_add(Weight::from_parts(0, 7597)) + // Estimated: `8587` + // Minimum execution time: 9_040_000 picoseconds. + Weight::from_parts(9_040_000, 0) + .saturating_add(Weight::from_parts(0, 8587)) .saturating_add(T::DbWeight::get().reads(3)) } /// Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) @@ -250,10 +256,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn migrate_version_notify_targets() -> Weight { // Proof Size summary in bytes: // Measured: `140` - // Estimated: `10040` - // Minimum execution time: 17_297_000 picoseconds. - Weight::from_parts(17_297_000, 0) - .saturating_add(Weight::from_parts(0, 10040)) + // Estimated: `11030` + // Minimum execution time: 16_032_000 picoseconds. + Weight::from_parts(16_032_000, 0) + .saturating_add(Weight::from_parts(0, 11030)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -272,10 +278,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn migrate_and_notify_old_targets() -> Weight { // Proof Size summary in bytes: // Measured: `146` - // Estimated: `15231` - // Minimum execution time: 34_890_000 picoseconds. - Weight::from_parts(34_890_000, 0) - .saturating_add(Weight::from_parts(0, 15231)) + // Estimated: `11036` + // Minimum execution time: 32_342_000 picoseconds. + Weight::from_parts(32_342_000, 0) + .saturating_add(Weight::from_parts(0, 11036)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -292,7 +298,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 4830 + > 3540 ); } #[test] @@ -304,7 +310,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 8025 + > 3540 ); } #[test] @@ -316,7 +322,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 8729 + > 3722 ); } #[test] @@ -328,7 +334,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 10029 + > 11019 ); } #[test] @@ -340,7 +346,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 10033 + > 11023 ); } #[test] @@ -352,7 +358,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 12515 + > 13505 ); } #[test] @@ -364,7 +370,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 10257 + > 6082 ); } #[test] @@ -376,7 +382,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 7597 + > 8587 ); } #[test] @@ -388,7 +394,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 10040 + > 11030 ); } #[test] @@ -400,7 +406,7 @@ mod tests { .max_extrinsic .unwrap_or_else(::max_value) .proof_size() - > 15231 + > 11036 ); } } diff --git a/runtimes/spiritnet/src/weights/pallet_balances.rs b/runtimes/spiritnet/src/weights/pallet_balances.rs index 26775224f4..7888e0e1ad 100644 --- a/runtimes/spiritnet/src/weights/pallet_balances.rs +++ b/runtimes/spiritnet/src/weights/pallet_balances.rs @@ -1,25 +1,10 @@ -// KILT Blockchain – https://botlabs.org -// Copyright (C) 2019-2023 BOTLabs GmbH -// The KILT Blockchain is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The KILT Blockchain is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -// If you feel like getting in touch with us, you can do so at info@botlabs.org - -//! Autogenerated weights for pallet_balances +//! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `rust-2`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("spiritnet-dev"), DB CACHE: 1024 // Executed Command: @@ -40,50 +25,211 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; -/// Weights for `pallet_balances`. +/// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { - - fn transfer_allow_death() -> sp_weights::Weight { todo!() } - fn force_set_balance_creating() -> sp_weights::Weight { todo!() } - fn force_set_balance_killing() -> sp_weights::Weight { todo!() } - fn force_transfer() -> sp_weights::Weight { todo!() } - fn upgrade_accounts(_: u32) -> sp_weights::Weight { todo!() } - // Storage: System Account (r:2 w:2) - // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - - // Storage: System Account (r:1 w:1) - // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + fn transfer_allow_death() -> Weight { + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `3597` + // Minimum execution time: 36_429_000 picoseconds. + Weight::from_parts(37_980_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_keep_alive() -> Weight { - Weight::from_parts(70_328_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: System Account (r:1 w:1) - // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - - // Storage: System Account (r:1 w:1) - // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - - - // Storage: System Account (r:1 w:1) - // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `3597` + // Minimum execution time: 27_644_000 picoseconds. + Weight::from_parts(28_433_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + fn force_set_balance_creating() -> Weight { + // Proof Size summary in bytes: + // Measured: `481` + // Estimated: `3597` + // Minimum execution time: 11_317_000 picoseconds. + Weight::from_parts(11_656_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + fn force_set_balance_killing() -> Weight { + // Proof Size summary in bytes: + // Measured: `481` + // Estimated: `3597` + // Minimum execution time: 15_362_000 picoseconds. + Weight::from_parts(15_779_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + fn force_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `580` + // Estimated: `6204` + // Minimum execution time: 38_392_000 picoseconds. + Weight::from_parts(39_183_000, 0) + .saturating_add(Weight::from_parts(0, 6204)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_all() -> Weight { - Weight::from_parts(58_160_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Proof Size summary in bytes: + // Measured: `270` + // Estimated: `3597` + // Minimum execution time: 34_276_000 picoseconds. + Weight::from_parts(35_179_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } - // Storage: System Account (r:1 w:1) - // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_unreserve() -> Weight { - Weight::from_parts(31_980_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Proof Size summary in bytes: + // Measured: `481` + // Estimated: `3597` + // Minimum execution time: 12_914_000 picoseconds. + Weight::from_parts(13_366_000, 0) + .saturating_add(Weight::from_parts(0, 3597)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: System Account (r:999 w:999) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// The range of component `u` is `[1, 1000]`. + fn upgrade_accounts(u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `6922 + u * (143 ±0)` + // Estimated: `990 + u * (2607 ±0)` + // Minimum execution time: 12_089_000 picoseconds. + Weight::from_parts(12_384_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 6_368 + .saturating_add(Weight::from_parts(10_591_397, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 2607).saturating_mul(u.into())) + } +} + +#[cfg(test)] +mod tests { + #[test] + fn test_transfer_allow_death() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 3597 + ); + } + #[test] + fn test_transfer_keep_alive() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 3597 + ); + } + #[test] + fn test_force_set_balance_creating() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 3597 + ); + } + #[test] + fn test_force_set_balance_killing() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 3597 + ); + } + #[test] + fn test_force_transfer() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 6204 + ); + } + #[test] + fn test_transfer_all() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 3597 + ); + } + #[test] + fn test_force_unreserve() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 3597 + ); + } + #[test] + fn test_upgrade_accounts() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 990 + ); } } diff --git a/runtimes/spiritnet/src/weights/pallet_xcm.rs b/runtimes/spiritnet/src/weights/pallet_xcm.rs index 655b58f6b1..f5b443b757 100644 --- a/runtimes/spiritnet/src/weights/pallet_xcm.rs +++ b/runtimes/spiritnet/src/weights/pallet_xcm.rs @@ -1,25 +1,10 @@ -// KILT Blockchain – https://botlabs.org -// Copyright (C) 2019-2023 BOTLabs GmbH -// The KILT Blockchain is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The KILT Blockchain is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -// If you feel like getting in touch with us, you can do so at info@botlabs.org - -//! Autogenerated weights for pallet_xcm +//! Autogenerated weights for `pallet_xcm` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `rust-2`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("spiritnet-dev"), DB CACHE: 1024 // Executed Command: @@ -40,163 +25,370 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; -/// Weights for `pallet_xcm`. +/// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - // Storage: PolkadotXcm SupportedVersion (r:1 w:0) - // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - // Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - // Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - // Storage: ParachainSystem HostConfiguration (r:1 w:0) - // Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn send() -> Weight { - Weight::from_parts(47_819_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(5 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Proof Size summary in bytes: + // Measured: `75` + // Estimated: `3540` + // Minimum execution time: 16_473_000 picoseconds. + Weight::from_parts(16_813_000, 0) + .saturating_add(Weight::from_parts(0, 3540)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) } - - fn force_suspension() -> sp_weights::Weight { todo!() } - // Storage: Benchmark Override (r:0 w:0) - // Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn teleport_assets() -> Weight { - Weight::from_parts(18_446_744_073_709_551_000 as u64, 0) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } - // Storage: Benchmark Override (r:0 w:0) - // Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn reserve_transfer_assets() -> Weight { - Weight::from_parts(18_446_744_073_709_551_000 as u64, 0) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } - // Storage: Benchmark Override (r:0 w:0) - // Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn execute() -> Weight { - Weight::from_parts(18_446_744_073_709_551_000 as u64, 0) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } - // Storage: PolkadotXcm SupportedVersion (r:0 w:1) - // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm SupportedVersion (r:0 w:1) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn force_xcm_version() -> Weight { - Weight::from_parts(11_906_000 as u64, 0) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_618_000 picoseconds. + Weight::from_parts(5_839_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } - // Storage: PolkadotXcm SafeXcmVersion (r:0 w:1) - // Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:0 w:1) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) fn force_default_xcm_version() -> Weight { - Weight::from_parts(3_726_000 as u64, 0) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) - // Proof Skipped: PolkadotXcm VersionNotifiers (max_values: None, max_size: None, mode: Measured) - // Storage: PolkadotXcm QueryCounter (r:1 w:1) - // Proof Skipped: PolkadotXcm QueryCounter (max_values: Some(1), max_size: None, mode: Measured) - // Storage: PolkadotXcm SupportedVersion (r:1 w:0) - // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - // Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - // Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - // Storage: ParachainSystem HostConfiguration (r:1 w:0) - // Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - // Storage: PolkadotXcm Queries (r:0 w:1) - // Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_669_000 picoseconds. + Weight::from_parts(1_777_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionNotifiers (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm QueryCounter (r:1 w:1) + /// Proof Skipped: PolkadotXcm QueryCounter (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm Queries (r:0 w:1) + /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) fn force_subscribe_version_notify() -> Weight { - Weight::from_parts(39_357_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(7 as u64)) - .saturating_add(T::DbWeight::get().writes(5 as u64)) - } - // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) - // Proof Skipped: PolkadotXcm VersionNotifiers (max_values: None, max_size: None, mode: Measured) - // Storage: PolkadotXcm SupportedVersion (r:1 w:0) - // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - // Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - // Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - // Storage: ParachainSystem HostConfiguration (r:1 w:0) - // Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - // Storage: PolkadotXcm Queries (r:0 w:1) - // Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) + // Proof Size summary in bytes: + // Measured: `75` + // Estimated: `3540` + // Minimum execution time: 19_873_000 picoseconds. + Weight::from_parts(20_802_000, 0) + .saturating_add(Weight::from_parts(0, 3540)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionNotifiers (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm Queries (r:0 w:1) + /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) fn force_unsubscribe_version_notify() -> Weight { - Weight::from_parts(57_944_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(6 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) + // Proof Size summary in bytes: + // Measured: `257` + // Estimated: `3722` + // Minimum execution time: 19_919_000 picoseconds. + Weight::from_parts(20_827_000, 0) + .saturating_add(Weight::from_parts(0, 3722)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: PolkadotXcm XcmExecutionSuspended (r:0 w:1) + /// Proof Skipped: PolkadotXcm XcmExecutionSuspended (max_values: Some(1), max_size: None, mode: Measured) + fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_597_000 picoseconds. + Weight::from_parts(1_707_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } - // Storage: PolkadotXcm SupportedVersion (r:4 w:2) - // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm SupportedVersion (r:4 w:2) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { - Weight::from_parts(33_805_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Proof Size summary in bytes: + // Measured: `167` + // Estimated: `11057` + // Minimum execution time: 10_805_000 picoseconds. + Weight::from_parts(11_187_000, 0) + .saturating_add(Weight::from_parts(0, 11057)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) } - // Storage: PolkadotXcm VersionNotifiers (r:4 w:2) - // Proof Skipped: PolkadotXcm VersionNotifiers (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionNotifiers (r:4 w:2) + /// Proof Skipped: PolkadotXcm VersionNotifiers (max_values: None, max_size: None, mode: Measured) fn migrate_version_notifiers() -> Weight { - Weight::from_parts(35_045_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Proof Size summary in bytes: + // Measured: `171` + // Estimated: `11061` + // Minimum execution time: 10_832_000 picoseconds. + Weight::from_parts(11_129_000, 0) + .saturating_add(Weight::from_parts(0, 11061)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) } - // Storage: PolkadotXcm VersionNotifyTargets (r:5 w:0) - // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionNotifyTargets (r:5 w:0) + /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) fn already_notified_target() -> Weight { - Weight::from_parts(39_994_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(5 as u64)) - } - // Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) - // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) - // Storage: PolkadotXcm SupportedVersion (r:1 w:0) - // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - // Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - // Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - // Storage: ParachainSystem HostConfiguration (r:1 w:0) - // Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + // Proof Size summary in bytes: + // Measured: `178` + // Estimated: `13543` + // Minimum execution time: 11_720_000 picoseconds. + Weight::from_parts(12_047_000, 0) + .saturating_add(Weight::from_parts(0, 13543)) + .saturating_add(T::DbWeight::get().reads(5)) + } + /// Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) + /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn notify_current_targets() -> Weight { - Weight::from_parts(35_628_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(7 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + // Proof Size summary in bytes: + // Measured: `142` + // Estimated: `6082` + // Minimum execution time: 19_071_000 picoseconds. + Weight::from_parts(20_142_000, 0) + .saturating_add(Weight::from_parts(0, 6082)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } - // Storage: PolkadotXcm VersionNotifyTargets (r:3 w:0) - // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionNotifyTargets (r:3 w:0) + /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) fn notify_target_migration_fail() -> Weight { - Weight::from_parts(9_994_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(3 as u64)) + // Proof Size summary in bytes: + // Measured: `172` + // Estimated: `8587` + // Minimum execution time: 6_465_000 picoseconds. + Weight::from_parts(6_695_000, 0) + .saturating_add(Weight::from_parts(0, 8587)) + .saturating_add(T::DbWeight::get().reads(3)) } - // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) - // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) fn migrate_version_notify_targets() -> Weight { - Weight::from_parts(20_693_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) - // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) - // Storage: PolkadotXcm SupportedVersion (r:1 w:0) - // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - // Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - // Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - // Storage: ParachainSystem HostConfiguration (r:1 w:0) - // Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + // Proof Size summary in bytes: + // Measured: `178` + // Estimated: `11068` + // Minimum execution time: 11_436_000 picoseconds. + Weight::from_parts(11_870_000, 0) + .saturating_add(Weight::from_parts(0, 11068)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn migrate_and_notify_old_targets() -> Weight { - Weight::from_parts(44_084_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(9 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) + // Proof Size summary in bytes: + // Measured: `184` + // Estimated: `11074` + // Minimum execution time: 23_845_000 picoseconds. + Weight::from_parts(24_549_000, 0) + .saturating_add(Weight::from_parts(0, 11074)) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} + +#[cfg(test)] +mod tests { + #[test] + fn test_send() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 3540 + ); + } + #[test] + fn test_force_subscribe_version_notify() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 3540 + ); + } + #[test] + fn test_force_unsubscribe_version_notify() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 3722 + ); + } + #[test] + fn test_migrate_supported_version() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 11057 + ); + } + #[test] + fn test_migrate_version_notifiers() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 11061 + ); + } + #[test] + fn test_already_notified_target() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 13543 + ); + } + #[test] + fn test_notify_current_targets() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 6082 + ); + } + #[test] + fn test_notify_target_migration_fail() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 8587 + ); + } + #[test] + fn test_migrate_version_notify_targets() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 11068 + ); + } + #[test] + fn test_migrate_and_notify_old_targets() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 11074 + ); } } From 861b7c158775208ef3a82cc8b8fd7100b0b62a2d Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 31 May 2023 14:27:02 +0200 Subject: [PATCH 23/99] refactor files --- pallets/attestation/src/lib.rs | 2 +- .../src/{migration.rs => migrations.rs} | 0 pallets/delegation/src/lib.rs | 2 +- .../src/{migration.rs => migrations.rs} | 0 pallets/did/src/lib.rs | 2 +- pallets/did/src/{migration.rs => migrations.rs} | 0 pallets/pallet-web3-names/src/lib.rs | 2 +- .../src/{migration.rs => migrations.rs} | 0 pallets/parachain-staking/src/lib.rs | 1 - pallets/parachain-staking/src/migration.rs | 17 ----------------- pallets/public-credentials/src/lib.rs | 2 +- .../src/{migration.rs => migrations.rs} | 0 runtimes/peregrine/src/lib.rs | 10 +++++----- runtimes/spiritnet/src/lib.rs | 12 ++++++------ 14 files changed, 16 insertions(+), 34 deletions(-) rename pallets/attestation/src/{migration.rs => migrations.rs} (100%) rename pallets/delegation/src/{migration.rs => migrations.rs} (100%) rename pallets/did/src/{migration.rs => migrations.rs} (100%) rename pallets/pallet-web3-names/src/{migration.rs => migrations.rs} (100%) delete mode 100644 pallets/parachain-staking/src/migration.rs rename pallets/public-credentials/src/{migration.rs => migrations.rs} (100%) diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 967d4d5715..3f235eb522 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -63,7 +63,7 @@ pub mod attestations; pub mod default_weights; -pub mod migration; +pub mod migrations; #[cfg(any(feature = "mock", test))] pub mod mock; diff --git a/pallets/attestation/src/migration.rs b/pallets/attestation/src/migrations.rs similarity index 100% rename from pallets/attestation/src/migration.rs rename to pallets/attestation/src/migrations.rs diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index 543a7fe3ed..f9ffbcf989 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -66,7 +66,7 @@ mod access_control; pub mod default_weights; pub mod delegation_hierarchy; -pub mod migration; +pub mod migrations; #[cfg(any(feature = "mock", test))] pub mod mock; diff --git a/pallets/delegation/src/migration.rs b/pallets/delegation/src/migrations.rs similarity index 100% rename from pallets/delegation/src/migration.rs rename to pallets/delegation/src/migrations.rs diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index b3beb43d04..b031f2607b 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -85,7 +85,7 @@ pub mod benchmarking; pub mod default_weights; pub mod did_details; pub mod errors; -pub mod migration; +pub mod migrations; #[cfg(test)] mod mock; #[cfg(any(feature = "runtime-benchmarks", test))] diff --git a/pallets/did/src/migration.rs b/pallets/did/src/migrations.rs similarity index 100% rename from pallets/did/src/migration.rs rename to pallets/did/src/migrations.rs diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index aad2421a6e..4f6cbeb097 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -28,7 +28,7 @@ mod default_weights; #[cfg(any(test, feature = "runtime-benchmarks"))] mod mock; -mod migration; +pub mod migrations; #[cfg(any(test, feature = "try-runtime"))] mod try_state; diff --git a/pallets/pallet-web3-names/src/migration.rs b/pallets/pallet-web3-names/src/migrations.rs similarity index 100% rename from pallets/pallet-web3-names/src/migration.rs rename to pallets/pallet-web3-names/src/migrations.rs diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index c6999b45d2..7ca5ed101a 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -119,7 +119,6 @@ pub mod benchmarking; pub mod default_weights; -pub mod migration; #[cfg(test)] pub(crate) mod mock; #[cfg(test)] diff --git a/pallets/parachain-staking/src/migration.rs b/pallets/parachain-staking/src/migration.rs deleted file mode 100644 index 79e74681a2..0000000000 --- a/pallets/parachain-staking/src/migration.rs +++ /dev/null @@ -1,17 +0,0 @@ -// KILT Blockchain – https://botlabs.org -// Copyright (C) 2019-2023 BOTLabs GmbH - -// The KILT Blockchain is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The KILT Blockchain is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -// If you feel like getting in touch with us, you can do so at info@botlabs.org diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index e74742fcf6..d7336a1c50 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -33,7 +33,7 @@ mod access_control; pub mod credentials; pub mod default_weights; -pub mod migration; +pub mod migrations; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; diff --git a/pallets/public-credentials/src/migration.rs b/pallets/public-credentials/src/migrations.rs similarity index 100% rename from pallets/public-credentials/src/migration.rs rename to pallets/public-credentials/src/migrations.rs diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index d8c2fe516b..7a20997533 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -1090,12 +1090,12 @@ pub type Executive = frame_executive::Executive< runtime_common::migrations::RemoveInsecureRandomnessPallet, pallet_did_lookup::migrations::CleanupMigration, runtime_common::migrations::RemoveInsecureRandomnessPallet, - attestation::migration::BalanceMigration, - delegation::migration::BalanceMigration, - did::migration::BalanceMigration, + attestation::migrations::BalanceMigration, + delegation::migrations::BalanceMigration, + did::migrations::BalanceMigration, pallet_did_lookup::migrations::BalanceMigration, - pallet_web3_names::migration::BalanceMigration, - public_credentials::migration::BalanceMigration, + pallet_web3_names::migrations::BalanceMigration, + public_credentials::migrations::BalanceMigration, ), >; diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 5b013db18d..bba922ff57 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -1075,12 +1075,12 @@ pub type Executive = frame_executive::Executive< ( pallet_did_lookup::migrations::CleanupMigration, runtime_common::migrations::RemoveInsecureRandomnessPallet, - attestation::migration::BalanceMigration, - delegation::migration::BalanceMigration, - did::migration::BalanceMigration, - pallet_did_lookup::migration::BalanceMigration, - pallet_web3_names::migration::BalanceMigration, - public_credentials::migration::BalanceMigration, + attestation::migrations::BalanceMigration, + delegation::migrations::BalanceMigration, + did::migrations::BalanceMigration, + pallet_did_lookup::migrations::BalanceMigration, + pallet_web3_names::migrations::BalanceMigration, + public_credentials::migrations::BalanceMigration, ), >; From 8d121e96b6eb47b1991611677e4778fb2ffe3747 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 1 Jun 2023 09:21:42 +0200 Subject: [PATCH 24/99] intermediate state --- pallets/attestation/src/migrations.rs | 25 ++++++++----------------- runtimes/peregrine/src/lib.rs | 6 ++++-- runtimes/spiritnet/src/lib.rs | 6 ++++-- runtimes/standalone/src/lib.rs | 4 ++-- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 7eeef4b826..715efdd0ba 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -35,7 +35,7 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Attestation: Initiating migration"); - if ensure_upgraded::() { + if is_upgraded::() { return do_migration::(); } @@ -47,15 +47,9 @@ where fn pre_upgrade() -> Result, &'static str> { use frame_support::ensure; use sp_std::vec; - - let has_one_user_holds = Attestations::::iter_values() - .map(|details: AttestationDetails| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) - }) - .all(|user| !user); - // before the upgrade, there should be no account with holds - ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + ensure!(is_upgraded::(), "Pre upgrade: there are users with holds."); + log::info!("Attestation: There are no users with holds!"); Ok(vec![]) } @@ -64,14 +58,9 @@ where fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { use frame_support::ensure; - let has_all_user_holds = Attestations::::iter_values() - .map(|details: AttestationDetails| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) - }) - .all(|user| user); - // before the upgrade, there should be no account with holds - ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); + ensure!(!is_upgraded::(), "Post upgrade: there are users with reserves."); + log::info!("Attestation: Post migration checks"); Ok(()) } @@ -79,7 +68,7 @@ where /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn ensure_upgraded() -> bool +fn is_upgraded() -> bool where ::Currency: ReservableCurrency, { @@ -106,6 +95,8 @@ where return ::DbWeight::get().reads_writes(1, 1); } + log::error!("{:?}", error); + log::error!( " Attestation: Could not convert reserves to hold from attestation: {:?} ", key diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 7a20997533..6b91c431b8 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -173,6 +173,8 @@ parameter_types! { pub const ExistentialDeposit: u128 = EXISTENTIAL_DEPOSIT; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; + pub const MaxHolds: u32 = 50; + pub const MaxFreezes: u32 = 50; } impl pallet_multisig::Config for Runtime { @@ -198,8 +200,8 @@ impl pallet_balances::Config for Runtime { type Balance = Balance; type FreezeIdentifier = HFIdentifier; type HoldIdentifier = HFIdentifier; - type MaxFreezes = (); - type MaxHolds = (); + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index bba922ff57..4da97aebb9 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -174,6 +174,8 @@ parameter_types! { pub const ExistentialDeposit: u128 = EXISTENTIAL_DEPOSIT; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; + pub const MaxHolds: u32 = 50; + pub const MaxFreezes: u32 = 50; } impl pallet_multisig::Config for Runtime { @@ -197,8 +199,8 @@ impl pallet_indices::Config for Runtime { impl pallet_balances::Config for Runtime { type FreezeIdentifier = HFIdentifier; type HoldIdentifier = HFIdentifier; - type MaxFreezes = (); - type MaxHolds = (); + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index 31d0601a68..02b0b54098 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -252,8 +252,8 @@ parameter_types! { impl pallet_balances::Config for Runtime { type FreezeIdentifier = HFIdentifier; type HoldIdentifier = HFIdentifier; - type MaxFreezes = (); - type MaxHolds = (); + type MaxFreezes = MaxFreezes; + type MaxHolds = MaxHolds; type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; From 5f67e2fbc0e2700d6a264866b42f28363be6e4fa Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 1 Jun 2023 09:37:32 +0200 Subject: [PATCH 25/99] sharing is caring --- pallets/parachain-staking/src/lib.rs | 21 +++++++++++---------- pallets/parachain-staking/src/mock.rs | 5 +++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 7ca5ed101a..1402edcffc 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -147,13 +147,14 @@ pub mod pallet { pallet_prelude::*, storage::bounded_btree_map::BoundedBTreeMap, traits::{ - Currency, EstimateNextSessionRotation, Get, Imbalance, LockIdentifier, LockableCurrency, OnUnbalanced, - ReservableCurrency, StorageVersion, WithdrawReasons, + tokens::fungible::MutateFreeze, Currency, EstimateNextSessionRotation, Get, Imbalance, LockIdentifier, + OnUnbalanced, StorageVersion, }, BoundedVec, }; use frame_system::pallet_prelude::*; - use pallet_balances::{BalanceLock, Locks}; + use kilt_support::deposit::HFIdentifier; + use pallet_balances::{Freezes, IdAmount}; use pallet_session::ShouldEndSession; use scale_info::TypeInfo; use sp_runtime::{ @@ -194,8 +195,7 @@ pub mod pallet { /// The currency type /// Note: Declaration of Balance taken from pallet_gilt type Currency: Currency - + ReservableCurrency - + LockableCurrency + + MutateFreeze + Eq; /// Just the `Currency::Balance` type; we have this item to allow us to @@ -2187,7 +2187,7 @@ pub mod pallet { // Either set a new lock or potentially extend the existing one if amount // exceeds the currently locked amount - T::Currency::extend_lock(STAKING_ID, who, amount, WithdrawReasons::all()); + T::Currency::extend_freeze(&HFIdentifier::Staking, who, amount); Ok(unstaking_len) } @@ -2304,8 +2304,9 @@ pub mod pallet { } // iterate balance locks to retrieve amount of locked balance - let locks = Locks::::get(who); - total_locked = if let Some(BalanceLock { amount, .. }) = locks.iter().find(|l| l.id == STAKING_ID) { + let freezes = Freezes::::get(who); + total_locked = if let Some(IdAmount { amount, .. }) = freezes.iter().find(|l| l.id == HFIdentifier::Staking) + { amount.saturating_sub(total_unlocked.into()).into() } else { // should never fail to find the lock since we checked whether unstaking is not @@ -2314,10 +2315,10 @@ pub mod pallet { }; if total_locked.is_zero() { - T::Currency::remove_lock(STAKING_ID, who); + T::Currency::thaw(&HFIdentifier::Staking, who); Unstaking::::remove(who); } else { - T::Currency::set_lock(STAKING_ID, who, total_locked, WithdrawReasons::all()); + T::Currency::set_freeze(&HFIdentifier::Staking, who, total_locked); Unstaking::::insert(who, unstaking); } diff --git a/pallets/parachain-staking/src/mock.rs b/pallets/parachain-staking/src/mock.rs index 00d8cc1b3e..15c42ccbb9 100644 --- a/pallets/parachain-staking/src/mock.rs +++ b/pallets/parachain-staking/src/mock.rs @@ -25,6 +25,7 @@ use frame_support::{ assert_ok, construct_runtime, parameter_types, traits::{Currency, GenesisBuild, OnFinalize, OnInitialize, OnUnbalanced}, }; +use kilt_support::deposit::HFIdentifier; use pallet_authorship::EventHandler; use sp_consensus_aura::sr25519::AuthorityId; use sp_core::H256; @@ -102,8 +103,8 @@ parameter_types! { } impl pallet_balances::Config for Test { - type FreezeIdentifier = (); - type HoldIdentifier = (); + type FreezeIdentifier = HFIdentifier; + type HoldIdentifier = HFIdentifier; type MaxFreezes = (); type MaxHolds = (); type MaxLocks = (); From fa11d9d44ebc3ca48153c0eb25e33a93caaa0e17 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 1 Jun 2023 10:57:25 +0200 Subject: [PATCH 26/99] improved HFidentifier plus comments --- pallets/attestation/src/lib.rs | 24 +++- pallets/attestation/src/migrations.rs | 11 +- pallets/attestation/src/mock.rs | 3 +- pallets/attestation/src/tests.rs | 32 ++--- pallets/delegation/src/lib.rs | 20 ++- pallets/delegation/src/migrations.rs | 21 +++- pallets/delegation/src/tests.rs | 125 ++++++++++--------- pallets/did/src/benchmarking.rs | 6 +- pallets/did/src/did_details.rs | 14 ++- pallets/did/src/lib.rs | 9 +- pallets/did/src/migrations.rs | 21 +++- pallets/did/src/mock.rs | 10 +- pallets/did/src/tests.rs | 38 +++--- pallets/pallet-did-lookup/src/lib.rs | 6 +- pallets/pallet-did-lookup/src/migrations.rs | 26 +++- pallets/pallet-web3-names/src/lib.rs | 23 +++- pallets/pallet-web3-names/src/migrations.rs | 21 +++- pallets/pallet-web3-names/src/mock.rs | 5 +- pallets/parachain-staking/src/lib.rs | 59 ++++----- pallets/parachain-staking/src/types.rs | 1 + pallets/public-credentials/src/lib.rs | 26 +++- pallets/public-credentials/src/migrations.rs | 21 +++- pallets/public-credentials/src/mock.rs | 3 +- support/src/deposit.rs | 20 ++- support/src/migration.rs | 6 +- support/src/traits.rs | 12 +- 26 files changed, 365 insertions(+), 198 deletions(-) diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 3f235eb522..27e094ae2f 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -97,7 +97,7 @@ pub mod pallet { use ctype::CtypeHashOf; use kilt_support::{ - deposit::{Deposit, HFIdentifier}, + deposit::{Deposit, HFIdentifier, Pallets}, traits::{CallSources, StorageDepositCollector}, }; @@ -273,7 +273,11 @@ pub mod pallet { .transpose()?; let authorization_id = authorization.as_ref().map(|ac| ac.authorization_id()); - let deposit = kilt_support::reserve_deposit::, CurrencyOf>(payer, deposit_amount)?; + let deposit = kilt_support::reserve_deposit::, CurrencyOf>( + payer, + deposit_amount, + &HFIdentifier::Deposit(Pallets::Attestation), + )?; log::debug!("insert Attestation"); @@ -446,7 +450,11 @@ pub mod pallet { let attestation = Attestations::::get(claim_hash).ok_or(Error::::NotFound)?; ensure!(attestation.attester == subject, Error::::NotAuthorized); - AttestationStorageDepositCollector::::change_deposit_owner(&claim_hash, sender)?; + AttestationStorageDepositCollector::::change_deposit_owner( + &claim_hash, + sender, + &HFIdentifier::Deposit(Pallets::Attestation), + )?; Ok(()) } @@ -462,7 +470,10 @@ pub mod pallet { let attestation = Attestations::::get(claim_hash).ok_or(Error::::NotFound)?; ensure!(attestation.deposit.owner == sender, Error::::NotAuthorized); - AttestationStorageDepositCollector::::update_deposit(&claim_hash)?; + AttestationStorageDepositCollector::::update_deposit( + &claim_hash, + &HFIdentifier::Deposit(Pallets::Attestation), + )?; Ok(()) } @@ -470,7 +481,10 @@ pub mod pallet { impl Pallet { fn remove_attestation(attestation: AttestationDetails, claim_hash: ClaimHashOf) -> DispatchResult { - kilt_support::free_deposit::, CurrencyOf>(&attestation.deposit)?; + kilt_support::free_deposit::, CurrencyOf>( + &attestation.deposit, + &HFIdentifier::Deposit(Pallets::Attestation), + )?; Attestations::::remove(claim_hash); if let Some(authorization_id) = &attestation.authorization_id { ExternalAttestations::::remove(authorization_id, claim_hash); diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 715efdd0ba..a47ecd868e 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -20,7 +20,10 @@ use frame_support::{ traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; -use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use kilt_support::{ + deposit::{HFIdentifier, Pallets}, + migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, +}; use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; @@ -74,7 +77,10 @@ where { Attestations::::iter_values() .map(|details: AttestationDetails| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::Attestation), + ) }) .any(|user| !user) } @@ -88,6 +94,7 @@ where let deposit = attestations_detail.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, + &HFIdentifier::Deposit(Pallets::Attestation), deposit.amount.saturated_into(), ); diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index 129af7b1c6..b77315f65e 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -30,7 +30,7 @@ use sp_core::H256; use sp_runtime::DispatchError; use ctype::CtypeHashOf; -use kilt_support::deposit::Deposit; +use kilt_support::deposit::{Deposit, HFIdentifier, Pallets}; use crate::{ pallet::AuthorizationIdOf, AccountIdOf, AttestationAccessControl, AttestationDetails, AttesterOf, BalanceOf, @@ -156,6 +156,7 @@ pub fn insert_attestation(claim_hash: ClaimHashOf, details: Attest kilt_support::reserve_deposit::, CurrencyOf>( details.deposit.owner.clone(), details.deposit.amount, + &HFIdentifier::Deposit(Pallets::Attestation), ) .expect("Should have balance"); diff --git a/pallets/attestation/src/tests.rs b/pallets/attestation/src/tests.rs index e01631f9b6..d830489339 100644 --- a/pallets/attestation/src/tests.rs +++ b/pallets/attestation/src/tests.rs @@ -21,7 +21,7 @@ use frame_support::{assert_noop, assert_ok, traits::fungible::InspectHold}; use sp_runtime::{traits::Zero, DispatchError, TokenError}; use kilt_support::{ - deposit::{Deposit, HFIdentifier}, + deposit::{Deposit, HFIdentifier, Pallets}, mock::mock_origin::DoubleOrigin, }; @@ -187,7 +187,7 @@ fn test_revoke_remove() { assert!(stored_attestation.revoked); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), ::Deposit::get() ); @@ -197,7 +197,7 @@ fn test_revoke_remove() { None )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00).is_zero()); }); } @@ -226,7 +226,7 @@ fn test_authorized_revoke() { assert!(stored_attestation.revoked); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), ::Deposit::get() ); }); @@ -385,7 +385,7 @@ fn test_remove_not_found() { .with_balances(vec![(ACCOUNT_00, ::Deposit::get() * 100)]) .with_ctypes(vec![(attestation.ctype_hash, attester.clone())]) .build_and_execute_with_sanity_tests(|| { - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00).is_zero()); assert_noop!( Attestation::remove(DoubleOrigin(ACCOUNT_00, attester.clone()).into(), claim_hash, None), attestation::Error::::NotFound @@ -410,7 +410,7 @@ fn test_reclaim_deposit() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), ::Deposit::get() ); assert_ok!(Attestation::reclaim_deposit( @@ -422,7 +422,7 @@ fn test_reclaim_deposit() { claim_hash )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00).is_zero()); }); } @@ -438,7 +438,7 @@ fn test_reclaim_deposit_authorization() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), ::Deposit::get() ); assert_ok!(Attestation::reclaim_deposit( @@ -446,7 +446,7 @@ fn test_reclaim_deposit_authorization() { claim_hash )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00).is_zero()); }); } @@ -505,7 +505,7 @@ fn test_change_deposit_owner() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), ::Deposit::get() ); assert_ok!(Attestation::change_deposit_owner( @@ -521,9 +521,9 @@ fn test_change_deposit_owner() { amount: ::Deposit::get() } ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00).is_zero()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_01), ::Deposit::get() ); }); @@ -543,7 +543,7 @@ fn test_change_deposit_owner_insufficient_balance() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), ::Deposit::get() ); assert_noop!( @@ -606,7 +606,7 @@ fn test_update_deposit() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_ok!(Attestation::update_deposit( @@ -625,7 +625,7 @@ fn test_update_deposit() { // old deposit was 2x Deposit::get(), new deposit should be the the default // deposit value. assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), ::Deposit::get() ); }); @@ -648,7 +648,7 @@ fn test_update_deposit_unauthorized() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_noop!( diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index f9ffbcf989..2957be0053 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -100,7 +100,7 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::{Deposit, HFIdentifier}, + deposit::{Deposit, HFIdentifier, Pallets}, signature::{SignatureVerificationError, VerifySignature}, traits::CallSources, }; @@ -672,7 +672,11 @@ pub mod pallet { // parent or another ancestor. ensure!(delegation.details.owner == source.subject(), Error::::AccessDenied); - DelegationDepositCollector::::change_deposit_owner(&delegation_id, source.sender()) + DelegationDepositCollector::::change_deposit_owner( + &delegation_id, + source.sender(), + &HFIdentifier::Deposit(Pallets::Delegation), + ) } /// Updates the deposit amount to the current deposit rate. @@ -689,7 +693,10 @@ pub mod pallet { // parent or another ancestor. ensure!(delegation.deposit.owner == sender, Error::::AccessDenied); - DelegationDepositCollector::::update_deposit(&delegation_id)?; + DelegationDepositCollector::::update_deposit( + &delegation_id, + &HFIdentifier::Deposit(Pallets::Delegation), + )?; Ok(()) } @@ -729,6 +736,7 @@ pub mod pallet { kilt_support::reserve_deposit::, CurrencyOf>( deposit_owner.clone(), ::Deposit::get(), + &HFIdentifier::Deposit(Pallets::Delegation), )?; let root_node = DelegationNode::new_root_node( @@ -759,6 +767,7 @@ pub mod pallet { kilt_support::reserve_deposit::, CurrencyOf>( deposit_owner, ::Deposit::get(), + &HFIdentifier::Deposit(Pallets::Delegation), )?; // Add the new node as a child of that node @@ -970,7 +979,10 @@ pub mod pallet { // We can clear storage now that all children have been removed DelegationNodes::::remove(*delegation); - kilt_support::free_deposit::, CurrencyOf>(&delegation_node.deposit)?; + kilt_support::free_deposit::, CurrencyOf>( + &delegation_node.deposit, + &HFIdentifier::Deposit(Pallets::Delegation), + )?; consumed_weight = consumed_weight.saturating_add(T::DbWeight::get().reads_writes(1, 2)); diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index b67ae167fe..37eec3fa74 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -20,7 +20,10 @@ use frame_support::{ traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; -use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use kilt_support::{ + deposit::{HFIdentifier, Pallets}, + migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, +}; use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; @@ -50,7 +53,10 @@ where let has_one_user_holds = DelegationNodes::::iter_values() .map(|details: DelegationNode| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::Delegation), + ) }) .all(|user| !user); @@ -66,7 +72,10 @@ where let has_all_user_holds = DelegationNodes::::iter_values() .map(|details: DelegationNode| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::Delegation), + ) }) .all(|user| user); @@ -85,7 +94,10 @@ where { DelegationNodes::::iter_values() .map(|details: DelegationNode| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::Delegation), + ) }) .any(|user| !user) } @@ -99,6 +111,7 @@ where let deposit = delegation_detail.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, + &HFIdentifier::Deposit(Pallets::Delegation), deposit.amount.saturated_into(), ); diff --git a/pallets/delegation/src/tests.rs b/pallets/delegation/src/tests.rs index 85199a542f..b5e298bb57 100644 --- a/pallets/delegation/src/tests.rs +++ b/pallets/delegation/src/tests.rs @@ -20,7 +20,10 @@ use frame_support::{ assert_err, assert_noop, assert_ok, traits::fungible::{Inspect, InspectHold}, }; -use kilt_support::{deposit::HFIdentifier, mock::mock_origin::DoubleOrigin}; +use kilt_support::{ + deposit::{HFIdentifier, Pallets}, + mock::mock_origin::DoubleOrigin, +}; use crate::{ self as delegation, @@ -55,7 +58,7 @@ fn create_root_delegation_successful() { // Check reserved balance assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() ); @@ -174,7 +177,7 @@ fn create_delegation_direct_root_successful() { // 1 Deposit should be reserved for hierarchy assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() ); @@ -190,7 +193,7 @@ fn create_delegation_direct_root_successful() { // 2 Deposits should be reserved for hierarchy and delegation to root assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), 2 * ::Deposit::get() ); @@ -260,7 +263,7 @@ fn create_delegation_with_parent_successful() { // Should have deposited for hierarchy and parent delegation assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), 2 * ::Deposit::get() ); @@ -276,10 +279,10 @@ fn create_delegation_with_parent_successful() { // Should have deposited for hierarchy, parent delegation and sub-delegation assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), 3 * ::Deposit::get() ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); // Data in stored delegation and operation should match let stored_delegation = @@ -717,11 +720,11 @@ fn list_hierarchy_revoke_and_remove_root_successful() { .build_and_execute_with_sanity_tests(|| { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), ::Deposit::get() ); @@ -764,8 +767,8 @@ fn list_hierarchy_revoke_and_remove_root_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); }); } @@ -833,11 +836,11 @@ fn tree_hierarchy_revoke_and_remove_root_successful() { ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), ::Deposit::get() ); @@ -852,8 +855,8 @@ fn tree_hierarchy_revoke_and_remove_root_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation2_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); }); } @@ -917,11 +920,11 @@ fn max_max_revocations_revoke_and_remove_successful() { ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), ::Deposit::get() ); @@ -936,8 +939,8 @@ fn max_max_revocations_revoke_and_remove_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); }); } @@ -1098,7 +1101,7 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { ]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() ); @@ -1143,11 +1146,11 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { // Should not remove root because tree traversal steps are insufficient assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), 3 * ::Deposit::get() ); // assert_err and not assert_noop because the storage is indeed changed, but @@ -1166,11 +1169,11 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { assert!(Delegation::delegation_nodes(delegation2_id).is_some()); assert!(Delegation::delegation_nodes(delegation3_id).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), 3 * ::Deposit::get() ); @@ -1183,8 +1186,8 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { assert!(Delegation::delegation_nodes(operation.id).is_none()); assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation3_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); }); } @@ -1253,11 +1256,11 @@ fn direct_owner_revoke_and_remove_delegation_successful() { ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), ::Deposit::get() ); @@ -1273,10 +1276,10 @@ fn direct_owner_revoke_and_remove_delegation_successful() { assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); }); } @@ -1316,11 +1319,11 @@ fn parent_owner_revoke_delegation_successful() { .build_and_execute_with_sanity_tests(|| { // Parent should not be able to remove the child delegation directly assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), ::Deposit::get() ); assert_noop!( @@ -1364,10 +1367,10 @@ fn parent_owner_revoke_delegation_successful() { assert!(Delegation::delegation_nodes(parent_id).is_some()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), 2 * ::Deposit::get() ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); }); } @@ -1498,15 +1501,15 @@ fn parent_too_far_revoke_and_remove_delegation_error() { // removal assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_02), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_02), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), ::Deposit::get() ); @@ -1615,8 +1618,8 @@ fn direct_owner_reclaim_deposit_delegation_successful() { assert!(Delegation::delegation_nodes(delegation_id).is_none()); // We have released all the deposits by deleting the root node. - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); }); } @@ -1649,11 +1652,11 @@ fn parent_owner_reclaim_deposit_error() { // Parent should not be able to claim the deposit for the child delegation // directly assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), ::Deposit::get() ); assert_noop!( @@ -2095,7 +2098,7 @@ fn remove_single_hierarchy() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_some()); assert!(Delegation::delegation_nodes(hierarchy_root_id).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() ); @@ -2115,7 +2118,7 @@ fn remove_single_hierarchy() { )); assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(hierarchy_root_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); }); } @@ -2166,15 +2169,15 @@ fn remove_children_gas_runs_out() { ]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), 3 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_02), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_02), ::Deposit::get() ); @@ -2197,15 +2200,15 @@ fn remove_children_gas_runs_out() { assert!(Delegation::delegation_nodes(delegation3_id).is_some()); assert!(Delegation::delegation_nodes(delegation4_id).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), 3 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_02), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_02), ::Deposit::get() ); @@ -2219,9 +2222,9 @@ fn remove_children_gas_runs_out() { assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation2_id).is_none()); assert!(Delegation::delegation_nodes(delegation3_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_02).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_02).is_zero()); }); } @@ -2260,10 +2263,10 @@ fn test_change_deposit_owner() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() * 3 ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); assert_ok!(Delegation::change_deposit_owner( DoubleOrigin(ACCOUNT_01, delegate).into(), delegation_id @@ -2271,11 +2274,11 @@ fn test_change_deposit_owner() { // ACCOUNT_00 has still one deposit (there are two nodes) assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), ::Deposit::get() ); }); @@ -2306,10 +2309,10 @@ fn test_change_deposit_owner_insufficient_balance() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() * 3 ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); assert_noop!( Delegation::change_deposit_owner(DoubleOrigin(ACCOUNT_01, delegate).into(), delegation_id), TokenError::CannotCreateHold @@ -2407,7 +2410,7 @@ fn test_update_deposit() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() * 3 ); assert_ok!(Delegation::update_deposit( @@ -2417,7 +2420,7 @@ fn test_update_deposit() { // ACCOUNT_00 has still one deposit (there are two nodes) assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() * 2 ); }); @@ -2448,7 +2451,7 @@ fn test_update_deposit_unauthorized() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), ::Deposit::get() * 3 ); assert_noop!( diff --git a/pallets/did/src/benchmarking.rs b/pallets/did/src/benchmarking.rs index eac6e954cd..d529c7a1ab 100644 --- a/pallets/did/src/benchmarking.rs +++ b/pallets/did/src/benchmarking.rs @@ -30,7 +30,7 @@ use sp_runtime::{traits::IdentifyAccount, AccountId32, MultiSigner}; use sp_std::{convert::TryInto, vec::Vec}; use kilt_support::{ - deposit::{Deposit, HFIdentifier}, + deposit::{Deposit, HFIdentifier, Pallets}, signature::VerifySignature, }; @@ -1150,7 +1150,7 @@ benchmarks! { did_details.deposit.owner = did_account.clone(); make_free_for_did::(&did_account); - CurrencyOf::::hold(&HFIdentifier::Deposit ,&did_account, did_details.deposit.amount).expect("should reserve currency"); + CurrencyOf::::hold(&HFIdentifier::Deposit(Pallets::Did), &did_account, did_details.deposit.amount).expect("should reserve currency"); Did::::insert(&did_subject, did_details); let origin = RawOrigin::Signed(did_subject.clone()); @@ -1176,7 +1176,7 @@ benchmarks! { Did::::insert(&did_subject, did_details.clone()); make_free_for_did::(&did_account); - CurrencyOf::::hold(&HFIdentifier::Deposit, &did_account, did_details.deposit.amount).expect("should reserve currency"); + CurrencyOf::::hold(&HFIdentifier::Deposit(Pallets::Did), &did_account, did_details.deposit.amount).expect("should reserve currency"); let origin = RawOrigin::Signed(did_subject.clone()); let did_to_update = did_subject.clone(); diff --git a/pallets/did/src/did_details.rs b/pallets/did/src/did_details.rs index 9cd1344395..f0d1c4e708 100644 --- a/pallets/did/src/did_details.rs +++ b/pallets/did/src/did_details.rs @@ -23,7 +23,7 @@ use frame_support::{ traits::Get, RuntimeDebug, }; -use kilt_support::deposit::Deposit; +use kilt_support::deposit::{Deposit, HFIdentifier, Pallets}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen, WrapperTypeEncode}; use scale_info::TypeInfo; use sp_core::{ecdsa, ed25519, sr25519}; @@ -348,6 +348,7 @@ impl DidDetails { kilt_support::reserve_deposit::, CurrencyOf>( self.deposit.owner.clone(), deposit_to_reserve, + &HFIdentifier::Deposit(Pallets::Did), )?; self.deposit.amount = self.deposit.amount.saturating_add(deposit_to_reserve); } @@ -357,7 +358,10 @@ impl DidDetails { owner: self.deposit.owner.clone(), amount: deposit_to_release, }; - kilt_support::free_deposit::, CurrencyOf>(&deposit)?; + kilt_support::free_deposit::, CurrencyOf>( + &deposit, + &HFIdentifier::Deposit(Pallets::Did), + )?; self.deposit.amount = self.deposit.amount.saturating_sub(deposit_to_release); } _ => (), @@ -402,7 +406,11 @@ impl DidDetails { let deposit_amount = new_did_details.calculate_deposit(did_subject); new_did_details.deposit.amount = deposit_amount; - kilt_support::reserve_deposit::, CurrencyOf>(details.submitter, deposit_amount)?; + kilt_support::reserve_deposit::, CurrencyOf>( + details.submitter, + deposit_amount, + &HFIdentifier::Deposit(Pallets::Did), + )?; Ok(new_did_details) } diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index b031f2607b..16d9415467 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -146,7 +146,7 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::{Deposit, HFIdentifier}, + deposit::{Deposit, HFIdentifier, Pallets}, traits::{CallSources, StorageDepositCollector}, }; use sp_runtime::traits::BadOrigin; @@ -1108,7 +1108,7 @@ pub mod pallet { let subject = source.subject(); let sender = source.sender(); - DidDepositCollector::::change_deposit_owner(&subject, sender)?; + DidDepositCollector::::change_deposit_owner(&subject, sender, &HFIdentifier::Deposit(Pallets::Did))?; Ok(()) } @@ -1248,7 +1248,10 @@ pub mod pallet { let did_entry = Did::::take(&did_subject).ok_or(Error::::NotFound)?; DidEndpointsCount::::remove(&did_subject); - kilt_support::free_deposit::, CurrencyOf>(&did_entry.deposit)?; + kilt_support::free_deposit::, CurrencyOf>( + &did_entry.deposit, + &HFIdentifier::Deposit(Pallets::Did), + )?; // Mark as deleted to prevent potential replay-attacks of re-adding a previously // deleted DID. DidBlacklist::::insert(&did_subject, ()); diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index 370ee2080a..319862d234 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -20,7 +20,10 @@ use frame_support::{ traits::{Get, OnRuntimeUpgrade}, weights::Weight, }; -use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use kilt_support::{ + deposit::{HFIdentifier, Pallets}, + migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, +}; use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; @@ -47,7 +50,10 @@ impl OnRuntimeUpgrade for BalanceMigration { let has_one_user_holds = Did::::iter_values() .map(|details: DidDetails| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::Did), + ) }) .all(|user| !user); @@ -63,7 +69,10 @@ impl OnRuntimeUpgrade for BalanceMigration { let has_all_user_holds = Did::::iter_values() .map(|details: DidDetails| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::Did), + ) }) .all(|user| user); @@ -79,7 +88,10 @@ impl OnRuntimeUpgrade for BalanceMigration { fn ensure_upgraded() -> bool { Did::::iter_values() .map(|details: DidDetails| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::Did), + ) }) .any(|user| !user) } @@ -90,6 +102,7 @@ fn do_migration() -> Weight { let deposit = did_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, + &HFIdentifier::Deposit(Pallets::Did), deposit.amount.saturated_into(), ); diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index 1e17751772..9c51c2ed7d 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -22,7 +22,7 @@ use frame_support::{ weights::constants::RocksDbWeight, }; use frame_system::EnsureSigned; -use kilt_support::deposit::HFIdentifier; +use kilt_support::deposit::{HFIdentifier, Pallets}; use pallet_balances::NegativeImbalance; use sp_core::{ecdsa, ed25519, sr25519, Pair}; use sp_runtime::{ @@ -497,8 +497,12 @@ impl ExtBuilder { for did in self.dids_stored.iter() { did::Did::::insert(&did.0, did.1.clone()); - CurrencyOf::::hold(&HFIdentifier::Deposit, &did.1.deposit.owner, did.1.deposit.amount) - .expect("Deposit owner should have enough balance"); + CurrencyOf::::hold( + &HFIdentifier::Deposit(Pallets::Did), + &did.1.deposit.owner, + did.1.deposit.amount, + ) + .expect("Deposit owner should have enough balance"); } for did in self.deleted_dids.iter() { DidBlacklist::::insert(did, ()); diff --git a/pallets/did/src/tests.rs b/pallets/did/src/tests.rs index 8c12bfee4f..38b5dfeec7 100644 --- a/pallets/did/src/tests.rs +++ b/pallets/did/src/tests.rs @@ -20,7 +20,7 @@ use frame_support::{ assert_err, assert_noop, assert_ok, traits::fungible::{Inspect, InspectHold}, }; -use kilt_support::deposit::HFIdentifier; +use kilt_support::deposit::{HFIdentifier, Pallets}; use parity_scale_codec::Encode; use sp_core::{ed25519, Pair}; use sp_runtime::{ @@ -78,7 +78,7 @@ fn check_successful_simple_ed25519_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), ::BaseDeposit::get() ); @@ -121,7 +121,7 @@ fn check_successful_simple_sr25519_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), ::BaseDeposit::get() ); assert_eq!(Balances::balance(&ACCOUNT_FEE), ::Fee::get()); @@ -163,7 +163,7 @@ fn check_successful_simple_ecdsa_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), ::BaseDeposit::get() ); assert_eq!(Balances::balance(&ACCOUNT_FEE), ::Fee::get()); @@ -279,7 +279,7 @@ fn check_successful_complete_creation() { ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), ::BaseDeposit::get() + required_balance_for_endpoint + required_balance_for_key_agreement @@ -316,7 +316,7 @@ fn check_deposit_change_by_adding_service_endpoint() { )); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &alice_did), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &alice_did), ::ServiceEndpointDeposit::get() + ::BaseDeposit::get() ); @@ -2164,13 +2164,13 @@ fn check_successful_deletion_no_endpoints() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::delete(RuntimeOrigin::signed(alice_did.clone()), 0)); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00).is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); @@ -2211,13 +2211,13 @@ fn check_successful_deletion_with_endpoints() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 1); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::delete(RuntimeOrigin::signed(alice_did.clone()), 1)); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00).is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); @@ -2303,7 +2303,7 @@ fn check_successful_reclaiming() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 1); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::reclaim_deposit( @@ -2313,7 +2313,7 @@ fn check_successful_reclaiming() { )); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00).is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); // Re-adding the same DID identifier should fail. @@ -2349,7 +2349,7 @@ fn unauthorized_reclaiming() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), ::BaseDeposit::get() ); assert_noop!( @@ -3275,13 +3275,13 @@ fn test_change_deposit_owner() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::change_deposit_owner(RuntimeOrigin::signed(alice_did.clone()))); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit, &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00).is_zero()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &alice_did), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &alice_did), ::BaseDeposit::get() ); }); @@ -3369,7 +3369,7 @@ fn test_update_deposit() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &alice_did), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &alice_did), ::BaseDeposit::get() * 2 ); @@ -3379,7 +3379,7 @@ fn test_update_deposit() { )); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &alice_did), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &alice_did), ::BaseDeposit::get() ); @@ -3416,7 +3416,7 @@ fn test_update_deposit_unauthorized() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit, &alice_did), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &alice_did), ::BaseDeposit::get() * 2 ); assert_noop!( diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index d4c0fbb325..0fe1e77bf6 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -64,7 +64,7 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::{Deposit, HFIdentifier}, + deposit::{Deposit, HFIdentifier, Pallets}, traits::{CallSources, StorageDepositCollector}, }; use runtime_common::Balance; @@ -249,7 +249,7 @@ pub mod pallet { ensure!( >>::can_hold( - &HFIdentifier::Deposit, + &HFIdentifier::Deposit(Pallets::DidLookup), &sender, ::Deposit::get() ), @@ -284,7 +284,7 @@ pub mod pallet { ensure!( >>::can_hold( - &HFIdentifier::Deposit, + &HFIdentifier::Deposit(Pallets::DidLookup), &source.sender(), ::Deposit::get() ), diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index 9ddcc3d994..53bf6e4480 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -22,7 +22,10 @@ use frame_support::{ traits::{Get, GetStorageVersion, OnRuntimeUpgrade, ReservableCurrency, StorageVersion}, weights::Weight, }; -use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use kilt_support::{ + deposit::{HFIdentifier, Pallets}, + migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, +}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::AccountId32; @@ -141,7 +144,10 @@ where let has_one_user_holds = ConnectedDids::::iter_values() .map(|details: ConnectionRecordOf| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::DidLookup), + ) }) .all(|user| !user); @@ -157,7 +163,10 @@ where let has_all_user_holds = ConnectedDids::::iter_values() .map(|details: ConnectionRecordOf| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::DidLookup), + ) }) .all(|user| user); @@ -176,7 +185,10 @@ where { ConnectedDids::::iter_values() .map(|details: ConnectionRecordOf| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::DidLookup), + ) }) .any(|user| !user) } @@ -188,7 +200,11 @@ where ConnectedDids::::iter() .map(|(key, did_details)| -> Weight { let deposit = did_details.deposit; - let error = switch_reserved_to_hold::, CurrencyOf>(deposit.owner, deposit.amount); + let error = switch_reserved_to_hold::, CurrencyOf>( + deposit.owner, + &HFIdentifier::Deposit(Pallets::DidLookup), + deposit.amount, + ); if error.is_ok() { return ::DbWeight::get().reads_writes(1, 1); diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index 4f6cbeb097..270d296e13 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -57,7 +57,7 @@ pub mod pallet { use sp_std::{fmt::Debug, vec::Vec}; use kilt_support::{ - deposit::{Deposit, HFIdentifier}, + deposit::{Deposit, HFIdentifier, Pallets}, traits::{CallSources, StorageDepositCollector}, }; @@ -354,7 +354,11 @@ pub mod pallet { let source = ::OwnerOrigin::ensure_origin(origin)?; let w3n_owner = source.subject(); let name = Names::::get(&w3n_owner).ok_or(Error::::NotFound)?; - Web3NameStorageDepositCollector::::change_deposit_owner(&name, source.sender())?; + Web3NameStorageDepositCollector::::change_deposit_owner( + &name, + source.sender(), + &HFIdentifier::Deposit(Pallets::W3n), + )?; Ok(()) } @@ -370,7 +374,7 @@ pub mod pallet { let w3n_entry = Owner::::get(&name).ok_or(Error::::NotFound)?; ensure!(w3n_entry.deposit.owner == source, Error::::NotAuthorized); - Web3NameStorageDepositCollector::::update_deposit(&name)?; + Web3NameStorageDepositCollector::::update_deposit(&name, &HFIdentifier::Deposit(Pallets::W3n))?; Ok(()) } @@ -396,7 +400,7 @@ pub mod pallet { ensure!( >>::can_hold( - &HFIdentifier::Deposit, + &HFIdentifier::Deposit(Pallets::W3n), deposit_payer, T::Deposit::get() ), @@ -422,7 +426,11 @@ pub mod pallet { let block_number = frame_system::Pallet::::block_number(); // Should never fail since we checked in the preconditions - kilt_support::reserve_deposit::, CurrencyOf>(deposit.owner.clone(), deposit.amount)?; + kilt_support::reserve_deposit::, CurrencyOf>( + deposit.owner.clone(), + deposit.amount, + &HFIdentifier::Deposit(Pallets::W3n), + )?; Names::::insert(&owner, name.clone()); Owner::::insert( @@ -471,7 +479,10 @@ pub mod pallet { Names::::remove(&name_ownership.owner); // Should never fail since we checked in the preconditions - kilt_support::free_deposit::, CurrencyOf>(&name_ownership.deposit)?; + kilt_support::free_deposit::, CurrencyOf>( + &name_ownership.deposit, + &HFIdentifier::Deposit(Pallets::W3n), + )?; Ok(name_ownership) } diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index c4cda4cbbf..3d0f976da8 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -20,7 +20,10 @@ use frame_support::{ traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; -use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use kilt_support::{ + deposit::{HFIdentifier, Pallets}, + migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, +}; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; @@ -48,7 +51,10 @@ where let has_one_user_holds = Owner::::iter_values() .map(|details: Web3OwnershipOf| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::W3n), + ) }) .all(|user| !user); @@ -64,7 +70,10 @@ where let has_all_user_holds = Owner::::iter_values() .map(|details: Web3OwnershipOf| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::W3n), + ) }) .all(|user| user); @@ -83,7 +92,10 @@ where { Owner::::iter_values() .map(|details: Web3OwnershipOf| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::W3n), + ) }) .any(|user| !user) } @@ -97,6 +109,7 @@ where let deposit = w3n_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, + &HFIdentifier::Deposit(Pallets::W3n), deposit.amount.saturated_into(), ); diff --git a/pallets/pallet-web3-names/src/mock.rs b/pallets/pallet-web3-names/src/mock.rs index 14275b0602..908f9501e0 100644 --- a/pallets/pallet-web3-names/src/mock.rs +++ b/pallets/pallet-web3-names/src/mock.rs @@ -16,7 +16,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::traits::fungible::MutateHold; -use kilt_support::deposit::{Deposit, HFIdentifier}; +use kilt_support::deposit::{Deposit, HFIdentifier, Pallets}; use crate::{AccountIdOf, BalanceOf, Config, CurrencyOf, Names, Owner, Web3NameOf, Web3NameOwnerOf, Web3OwnershipOf}; @@ -29,7 +29,8 @@ pub(crate) fn insert_raw_w3n( block_number: BlockNumberOf, deposit: BalanceOf, ) { - CurrencyOf::::hold(&HFIdentifier::Deposit, &payer, deposit).expect("Payer should have enough funds for deposit"); + CurrencyOf::::hold(&HFIdentifier::Deposit(Pallets::W3n), &payer, deposit) + .expect("Payer should have enough funds for deposit"); Names::::insert(&owner, name.clone()); Owner::::insert( diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 1402edcffc..fb606fa512 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -71,14 +71,14 @@ //! //! ### Terminology //! -//! - **Candidate:** A user which locks up tokens to be included into the set of -//! authorities which author blocks and receive rewards for doing so. +//! - **Candidate:** A user which freezes up tokens to be included into the set +//! of authorities which author blocks and receive rewards for doing so. //! //! - **Collator:** A candidate that was chosen to collate this round. //! -//! - **Delegator:** A user which locks up tokens for collators they trust. When -//! their collator authors a block, the corresponding delegators also receive -//! rewards. +//! - **Delegator:** A user which freezes up tokens for collators they trust. +//! When their collator authors a block, the corresponding delegators also +//! receive rewards. //! //! - **Total Stake:** A collator’s own stake + the sum of delegated stake to //! this collator. @@ -98,8 +98,8 @@ //! a staking round, thus both words are interchangeable in the context of //! this pallet. //! -//! - **Lock:** A freeze on a specified amount of an account's free balance -//! until a specified block number. Multiple locks always operate over the +//! - **Freeze:** A freeze on a specified amount of an account's free balance +//! until a specified block number. Multiple freezes always operate over the //! same funds, so they "overlay" rather than "stack" //! //! ## Genesis config @@ -1620,9 +1620,9 @@ pub mod pallet { /// /// Weight: O(U) where U is the number of locked unstaking requests /// bounded by `MaxUnstakeRequests`. - /// - Reads: [Origin Account], Unstaking, Locks - /// - Writes: Unstaking, Locks - /// - Kills: Unstaking & Locks if no balance is locked anymore + /// - Reads: [Origin Account], Unstaking, Freezes + /// - Writes: Unstaking, Freezes + /// - Kills: Unstaking & Freezess if no balance is locked anymore /// # #[pallet::call_index(16)] #[pallet::weight(::WeightInfo::unlock_unstaked( @@ -2280,45 +2280,48 @@ pub mod pallet { /// Withdraw all staked currency which was unstaked at least /// `StakeDuration` blocks ago. - fn do_unlock(who: &T::AccountId) -> Result { + fn do_unlock(who: &T::AccountId) -> Result + where + ::FreezeIdentifier: From, + { let now = frame_system::Pallet::::block_number(); let mut unstaking = Unstaking::::get(who); let unstaking_len = unstaking.len().saturated_into::(); ensure!(!unstaking.is_empty(), Error::::UnstakingIsEmpty); - let mut total_unlocked: BalanceOf = Zero::zero(); - let mut total_locked: BalanceOf = Zero::zero(); + let mut total_unfreezed: BalanceOf = Zero::zero(); + let mut total_freezed: BalanceOf = Zero::zero(); let mut expired = Vec::new(); - // check potential unlocks - for (block_number, locked_balance) in unstaking.clone().into_iter() { + // check potential unfreezed + for (block_number, freezed_balance) in unstaking.clone().into_iter() { if block_number <= now { expired.push(block_number); - total_unlocked = total_unlocked.saturating_add(locked_balance); + total_unfreezed = total_unfreezed.saturating_add(freezed_balance); } else { - total_locked = total_locked.saturating_add(locked_balance); + total_freezed = total_freezed.saturating_add(freezed_balance); } } for block_number in expired { unstaking.remove(&block_number); } - // iterate balance locks to retrieve amount of locked balance + // iterate balance freezes to retrieve amount of freezed balance let freezes = Freezes::::get(who); - total_locked = if let Some(IdAmount { amount, .. }) = freezes.iter().find(|l| l.id == HFIdentifier::Staking) - { - amount.saturating_sub(total_unlocked.into()).into() - } else { - // should never fail to find the lock since we checked whether unstaking is not - // empty but let's be safe - Zero::zero() - }; + total_freezed = + if let Some(IdAmount { amount, .. }) = freezes.iter().find(|l| l.id == HFIdentifier::Staking.into()) { + amount.saturating_sub(total_freezed.into()).into() + } else { + // should never fail to find the lock since we checked whether unstaking is not + // empty but let's be safe + Zero::zero() + }; - if total_locked.is_zero() { + if total_freezed.is_zero() { T::Currency::thaw(&HFIdentifier::Staking, who); Unstaking::::remove(who); } else { - T::Currency::set_freeze(&HFIdentifier::Staking, who, total_locked); + T::Currency::set_freeze(&HFIdentifier::Staking, who, total_freezed); Unstaking::::insert(who, unstaking); } diff --git a/pallets/parachain-staking/src/types.rs b/pallets/parachain-staking/src/types.rs index 2d3f7899cf..65e493288b 100644 --- a/pallets/parachain-staking/src/types.rs +++ b/pallets/parachain-staking/src/types.rs @@ -314,3 +314,4 @@ pub type BalanceOf = <::Currency as Currency>>::B pub type CandidateOf = Candidate, BalanceOf, S>; pub type StakeOf = Stake, BalanceOf>; pub type NegativeImbalanceOf = <::Currency as Currency>>::NegativeImbalance; +pub type CurrencyOf = ::Currency; diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index d7336a1c50..1bff578a07 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -69,7 +69,7 @@ pub mod pallet { pub use ctype::CtypeHashOf; use kilt_support::{ - deposit::{Deposit, HFIdentifier}, + deposit::{Deposit, HFIdentifier, Pallets}, traits::{CallSources, StorageDepositCollector}, }; @@ -299,8 +299,12 @@ pub mod pallet { Error::::AlreadyAttested ); - let deposit = kilt_support::reserve_deposit::, CurrencyOf>(payer, deposit_amount) - .map_err(|_| Error::::UnableToPayFees)?; + let deposit = kilt_support::reserve_deposit::, CurrencyOf>( + payer, + deposit_amount, + &HFIdentifier::Deposit(Pallets::PublicCredentials), + ) + .map_err(|_| Error::::UnableToPayFees)?; let block_number = frame_system::Pallet::::block_number(); @@ -514,7 +518,11 @@ pub mod pallet { ensure!(subject == credential_entry.attester, Error::::NotAuthorized); - PublicCredentialDepositCollector::::change_deposit_owner(&credential_id, source.sender())?; + PublicCredentialDepositCollector::::change_deposit_owner( + &credential_id, + source.sender(), + &HFIdentifier::Deposit(Pallets::PublicCredentials), + )?; Ok(()) } @@ -530,7 +538,10 @@ pub mod pallet { ensure!(source == credential_entry.deposit.owner, Error::::NotAuthorized); - PublicCredentialDepositCollector::::update_deposit(&credential_id)?; + PublicCredentialDepositCollector::::update_deposit( + &credential_id, + &HFIdentifier::Deposit(Pallets::PublicCredentials), + )?; Ok(()) } @@ -544,7 +555,10 @@ pub mod pallet { credential_id: CredentialIdOf, credential: CredentialEntryOf, ) -> DispatchResult { - kilt_support::free_deposit::>(&credential.deposit)?; + kilt_support::free_deposit::>( + &credential.deposit, + &HFIdentifier::Deposit(Pallets::PublicCredentials), + )?; Credentials::::remove(&credential_subject, &credential_id); CredentialSubjects::::remove(&credential_id); diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index 60e5147476..a7499c77f9 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -20,7 +20,10 @@ use frame_support::{ traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; -use kilt_support::migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}; +use kilt_support::{ + deposit::{HFIdentifier, Pallets}, + migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, +}; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; @@ -48,7 +51,10 @@ where let has_one_user_holds = Credentials::::iter_values() .map(|details: CredentialEntryOf| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::PublicCredentials), + ) }) .all(|user| !user); @@ -64,7 +70,10 @@ where let has_all_user_holds = Credentials::::iter_values() .map(|details: CredentialEntryOf| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::PublicCredentials), + ) }) .all(|user| user); @@ -83,7 +92,10 @@ where { Credentials::::iter_values() .map(|details: CredentialEntryOf| { - has_user_holds_and_no_reserves::, CurrencyOf>(&details.deposit.owner) + has_user_holds_and_no_reserves::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::PublicCredentials), + ) }) .any(|user| !user) } @@ -97,6 +109,7 @@ where let deposit = pc_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, + &HFIdentifier::Deposit(Pallets::PublicCredentials), deposit.amount.saturated_into(), ); diff --git a/pallets/public-credentials/src/mock.rs b/pallets/public-credentials/src/mock.rs index 4545666513..3c6c5ea4df 100644 --- a/pallets/public-credentials/src/mock.rs +++ b/pallets/public-credentials/src/mock.rs @@ -20,7 +20,7 @@ use frame_support::traits::Get; use parity_scale_codec::Encode; use sp_runtime::traits::Hash; -use kilt_support::deposit::Deposit; +use kilt_support::deposit::{Deposit, HFIdentifier, Pallets}; use crate::{ AccountIdOf, AttesterOf, BalanceOf, Config, CredentialEntryOf, CredentialIdOf, CredentialSubjects, Credentials, @@ -79,6 +79,7 @@ pub(crate) fn insert_public_credentials( kilt_support::reserve_deposit::, CurrencyOf>( credential_entry.deposit.owner.clone(), credential_entry.deposit.amount, + &HFIdentifier::Deposit(Pallets::PublicCredentials), ) .expect("Attester should have enough balance"); diff --git a/support/src/deposit.rs b/support/src/deposit.rs index 08b443c4ac..a2407d2779 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -25,11 +25,23 @@ use sp_runtime::DispatchError; #[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen, Copy)] pub enum HFIdentifier { - Deposit, + Deposit(Pallets), Staking, Misc, } +#[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen, Copy)] +pub enum Pallets { + Attestation, + Ctype, + Delegation, + Did, + DidLookup, + W3n, + Staking, + PublicCredentials, +} + /// An amount of balance reserved by the specified address. #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen)] @@ -41,8 +53,9 @@ pub struct Deposit { pub fn reserve_deposit>( account: Account, deposit_amount: Currency::Balance, + reason: &HFIdentifier, ) -> Result, DispatchError> { - let q = Currency::hold(&HFIdentifier::Deposit, &account, deposit_amount); + let q = Currency::hold(reason, &account, deposit_amount); q?; Ok(Deposit { owner: account, @@ -52,7 +65,8 @@ pub fn reserve_deposit pub fn free_deposit>( deposit: &Deposit, + reason: &HFIdentifier, ) -> DispatchResult { - Currency::release(&HFIdentifier::Deposit, &deposit.owner, deposit.amount, Precision::Exact)?; + Currency::release(reason, &deposit.owner, deposit.amount, Precision::Exact)?; Ok(()) } diff --git a/support/src/migration.rs b/support/src/migration.rs index 06c1d2dbc1..b892b683fb 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -35,8 +35,9 @@ pub fn has_user_holds_and_no_reserves< Currency: ReservableCurrency + MutateHold + InspectHold, >( owner: &AccountId, + reason: &HFIdentifier, ) -> bool { - Currency::balance_on_hold(&HFIdentifier::Deposit, owner).saturated_into::() > 0 + Currency::balance_on_hold(reason, owner).saturated_into::() > 0 && Currency::reserved_balance(owner).saturated_into::() == 0 } @@ -55,8 +56,9 @@ pub fn switch_reserved_to_hold< Currency: ReservableCurrency + MutateHold + InspectHold, >( owner: AccountId, + reason: &HFIdentifier, amount: u128, ) -> DispatchResult { Currency::unreserve(&owner, amount.saturated_into()); - Currency::hold(&HFIdentifier::Deposit, &owner, amount.saturated_into()) + Currency::hold(reason, &owner, amount.saturated_into()) } diff --git a/support/src/traits.rs b/support/src/traits.rs index 2b7d65645c..dc49e0ff71 100644 --- a/support/src/traits.rs +++ b/support/src/traits.rs @@ -117,16 +117,16 @@ pub trait StorageDepositCollector { /// The deposit balance of the current owner will be freed, while the /// deposit balance of the new owner will get reserved. The deposit amount /// will not change even if the required byte and item fees were updated. - fn change_deposit_owner(key: &Key, new_owner: AccountId) -> Result<(), DispatchError> { + fn change_deposit_owner(key: &Key, new_owner: AccountId, reason: &HFIdentifier) -> Result<(), DispatchError> { let deposit = Self::deposit(key)?; - free_deposit::(&deposit)?; + free_deposit::(&deposit, reason)?; let deposit = Deposit { owner: new_owner, ..deposit }; - Self::Currency::hold(&HFIdentifier::Deposit, &deposit.owner, deposit.amount)?; + Self::Currency::hold(reason, &deposit.owner, deposit.amount)?; Self::store_deposit(key, deposit)?; @@ -139,16 +139,16 @@ pub trait StorageDepositCollector { /// updates the deposit amount. It either frees parts of the reserved /// balance in case the deposit was lowered or reserves more balance when /// the deposit was raised. - fn update_deposit(key: &Key) -> Result<(), DispatchError> { + fn update_deposit(key: &Key, reason: &HFIdentifier) -> Result<(), DispatchError> { let deposit = Self::deposit(key)?; - free_deposit::(&deposit)?; + free_deposit::(&deposit, reason)?; let deposit = Deposit { amount: Self::deposit_amount(key), ..deposit }; - Self::Currency::hold(&HFIdentifier::Deposit, &deposit.owner, deposit.amount)?; + Self::Currency::hold(reason, &deposit.owner, deposit.amount)?; Self::store_deposit(key, deposit)?; From 8409c169fc1142ae433137ff5a3f33dccb25b284 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 1 Jun 2023 11:00:26 +0200 Subject: [PATCH 27/99] Quick fix --- pallets/parachain-staking/src/lib.rs | 6 +++++- pallets/parachain-staking/src/mock.rs | 1 + support/src/deposit.rs | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 1402edcffc..7cd9326fa3 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -198,6 +198,8 @@ pub mod pallet { + MutateFreeze + Eq; + type Identifier: AsRef<::FreezeIdentifier> + From; + /// Just the `Currency::Balance` type; we have this item to allow us to /// constrain it to `From`. /// Note: Definition taken from pallet_gilt @@ -2305,7 +2307,9 @@ pub mod pallet { // iterate balance locks to retrieve amount of locked balance let freezes = Freezes::::get(who); - total_locked = if let Some(IdAmount { amount, .. }) = freezes.iter().find(|l| l.id == HFIdentifier::Staking) + total_locked = if let Some(IdAmount { amount, .. }) = freezes + .iter() + .find(|l| &l.id == T::Identifier::from(HFIdentifier::Staking).as_ref()) { amount.saturating_sub(total_unlocked.into()).into() } else { diff --git a/pallets/parachain-staking/src/mock.rs b/pallets/parachain-staking/src/mock.rs index 15c42ccbb9..9da37ec3bc 100644 --- a/pallets/parachain-staking/src/mock.rs +++ b/pallets/parachain-staking/src/mock.rs @@ -176,6 +176,7 @@ impl Config for Test { type NetworkRewardStart = NetworkRewardStart; type NetworkRewardBeneficiary = ToBeneficiary; type WeightInfo = (); + type Identifier = HFIdentifier; const BLOCKS_PER_YEAR: Self::BlockNumber = 5 * 60 * 24 * 36525 / 100; } diff --git a/support/src/deposit.rs b/support/src/deposit.rs index 08b443c4ac..8ae8d868ea 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -30,6 +30,12 @@ pub enum HFIdentifier { Misc, } +impl AsRef for HFIdentifier { + fn as_ref(&self) -> &HFIdentifier { + self + } +} + /// An amount of balance reserved by the specified address. #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen)] From fa6c821ab1abb0e4f08114c6979cd6378e7736ff Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 1 Jun 2023 13:46:35 +0200 Subject: [PATCH 28/99] working ! --- pallets/parachain-staking/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 80672dd1de..701cf90b2b 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -2308,7 +2308,7 @@ pub mod pallet { .iter() .find(|l| &l.id == T::Identifier::from(HFIdentifier::Staking).as_ref()) { - amount.saturating_sub(total_freezed.into()).into() + amount.saturating_sub(total_unfreezed.into()).into() } else { // should never fail to find the lock since we checked whether unstaking is not // empty but let's be safe From ed9400e4aba1b0402e66150238610ada4f333e04 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 1 Jun 2023 14:43:37 +0200 Subject: [PATCH 29/99] migration for staking pallet --- pallets/parachain-staking/src/lib.rs | 7 +- pallets/parachain-staking/src/migrations.rs | 109 ++++++++++++++++++++ pallets/parachain-staking/src/types.rs | 1 + support/src/migration.rs | 15 ++- 4 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 pallets/parachain-staking/src/migrations.rs diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 701cf90b2b..de4e526e1a 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -129,6 +129,7 @@ mod try_state; pub mod api; mod inflation; +mod migrations; mod set; mod types; @@ -147,8 +148,8 @@ pub mod pallet { pallet_prelude::*, storage::bounded_btree_map::BoundedBTreeMap, traits::{ - tokens::fungible::MutateFreeze, Currency, EstimateNextSessionRotation, Get, Imbalance, OnUnbalanced, - StorageVersion, + tokens::fungible::MutateFreeze, Currency, EstimateNextSessionRotation, Get, Imbalance, LockIdentifier, + LockableCurrency, OnUnbalanced, StorageVersion, }, BoundedVec, }; @@ -173,6 +174,7 @@ pub mod pallet { }; use sp_std::{convert::TryInto, fmt::Debug}; + pub(crate) const STAKING_ID: LockIdentifier = *b"kiltpstk"; /// The current storage version. const STORAGE_VERSION: StorageVersion = StorageVersion::new(8); @@ -193,6 +195,7 @@ pub mod pallet { /// Note: Declaration of Balance taken from pallet_gilt type Currency: Currency + MutateFreeze + + LockableCurrency + Eq; type Identifier: AsRef<::FreezeIdentifier> + From; diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs new file mode 100644 index 0000000000..a7ebd7d673 --- /dev/null +++ b/pallets/parachain-staking/src/migrations.rs @@ -0,0 +1,109 @@ +// KILT Blockchain – https://botlabs.org +// Copyright (C) 2019-2023 BOTLabs GmbH + +// The KILT Blockchain is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The KILT Blockchain is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@botlabs.org + +use frame_support::{ + traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, + weights::Weight, +}; +use kilt_support::{deposit::HFIdentifier, migration::switch_locks_to_freeze}; +use pallet_balances::{BalanceLock, Locks}; +use sp_runtime::SaturatedConversion; +use sp_std::marker::PhantomData; + +use crate::{ + types::{AccountIdOf, CurrencyOf}, + Config, STAKING_ID, +}; + +pub struct BalanceMigration(PhantomData); + +impl OnRuntimeUpgrade for BalanceMigration +where + ::Currency: ReservableCurrency, +{ + fn on_runtime_upgrade() -> frame_support::weights::Weight { + log::info!("Staking: Initiating migration"); + if is_upgraded::() { + return do_migration::(); + } + + log::info!("Staking: No migration needed. This file should be deleted."); + ::DbWeight::get().reads_writes(0, 0) + } + + // #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + use frame_support::ensure; + use sp_std::vec; + // before the upgrade, there should be no account with holds + ensure!(is_upgraded::(), "Pre upgrade: there are users with holds."); + log::info!("Staking: Starting pre migration checks!"); + + Ok(vec![]) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { + use frame_support::ensure; + + // before the upgrade, there should be no account with holds + ensure!(!is_upgraded::(), "Post upgrade: there are users with reserves."); + log::info!("Staking: Post migration checks succeded!"); + + Ok(()) + } +} + +/// If there exists one user with locks -> the migration has to be executed. +fn is_upgraded() -> bool +where + ::Currency: ReservableCurrency, +{ + Locks::::iter_values() + .flatten() + .map(|lock: BalanceLock<_>| lock.id == STAKING_ID) + .any(|is_staking| !is_staking) +} + +fn do_migration() -> Weight +where + ::Currency: ReservableCurrency, +{ + Locks::::iter() + .map(|(user_id, locks)| { + locks + .iter() + .map(|lock: &BalanceLock<_>| -> Weight { + if lock.id == STAKING_ID { + let error = switch_locks_to_freeze::, CurrencyOf>( + user_id.clone(), + STAKING_ID, + &HFIdentifier::Staking, + lock.amount.saturated_into(), + ); + + if error.is_ok() { + return ::DbWeight::get().reads_writes(1, 1); + } + } + ::DbWeight::get().reads_writes(0, 0) + }) + .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) + }) + .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) +} diff --git a/pallets/parachain-staking/src/types.rs b/pallets/parachain-staking/src/types.rs index 2d3f7899cf..db04b91b44 100644 --- a/pallets/parachain-staking/src/types.rs +++ b/pallets/parachain-staking/src/types.rs @@ -309,6 +309,7 @@ pub struct DelegationCounter { pub counter: u32, } +pub type CurrencyOf = ::Currency; pub type AccountIdOf = ::AccountId; pub type BalanceOf = <::Currency as Currency>>::Balance; pub type CandidateOf = Candidate, BalanceOf, S>; diff --git a/support/src/migration.rs b/support/src/migration.rs index b892b683fb..011770f225 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -23,7 +23,7 @@ use frame_support::{ freeze::{Inspect as InspectFreeze, Mutate as MutateFreeze}, hold::{Inspect as InspectHold, Mutate as MutateHold}, }, - ReservableCurrency, + LockIdentifier, LockableCurrency, ReservableCurrency, }, }; use sp_runtime::SaturatedConversion; @@ -62,3 +62,16 @@ pub fn switch_reserved_to_hold< Currency::unreserve(&owner, amount.saturated_into()); Currency::hold(reason, &owner, amount.saturated_into()) } + +pub fn switch_locks_to_freeze< + AccountId, + Currency: LockableCurrency + MutateFreeze, +>( + who: AccountId, + id_lock: LockIdentifier, + id_freeze: &HFIdentifier, + amount: u128, +) -> DispatchResult { + Currency::remove_lock(id_lock, &who); + Currency::set_freeze(id_freeze, &who, amount.saturated_into()) +} From c4fae0b78cf5635c2f5ef119e5e56c514bfff6af Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 1 Jun 2023 14:46:30 +0200 Subject: [PATCH 30/99] migration for staking pallet --- pallets/parachain-staking/src/lib.rs | 2 +- runtimes/peregrine/src/lib.rs | 1 + runtimes/spiritnet/src/lib.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index de4e526e1a..e1926d0400 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -129,7 +129,7 @@ mod try_state; pub mod api; mod inflation; -mod migrations; +pub mod migrations; mod set; mod types; diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 5f4e510bd6..1fd7f7e794 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -1099,6 +1099,7 @@ pub type Executive = frame_executive::Executive< pallet_did_lookup::migrations::BalanceMigration, pallet_web3_names::migrations::BalanceMigration, public_credentials::migrations::BalanceMigration, + parachain_staking::migrations::BalanceMigration, ), >; diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 548874327a..075a499635 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -1084,6 +1084,7 @@ pub type Executive = frame_executive::Executive< pallet_did_lookup::migrations::BalanceMigration, pallet_web3_names::migrations::BalanceMigration, public_credentials::migrations::BalanceMigration, + parachain_staking::migrations::BalanceMigration, ), >; From 9ab1ffde7c1020ecb13909a36fc63826b2af17b7 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 1 Jun 2023 15:24:39 +0200 Subject: [PATCH 31/99] delegation --- pallets/attestation/src/migrations.rs | 9 ++--- pallets/delegation/src/migrations.rs | 47 +++++++++++++++------------ support/src/migration.rs | 14 ++++++-- 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index dfab4a0f35..9727f37bc3 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -22,7 +22,7 @@ use frame_support::{ }; use kilt_support::{ deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, + migration::switch_reserved_to_hold, }; use log; use sp_runtime::SaturatedConversion; @@ -76,12 +76,7 @@ where ::Currency: ReservableCurrency, { Attestations::::iter_values() - .map(|details: AttestationDetails| { - has_user_holds_and_no_reserves::, CurrencyOf>( - &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::Attestation), - ) - }) + .map(|details: AttestationDetails| true) .any(|user| !user) } diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index 37eec3fa74..f9c2b29253 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -22,7 +22,7 @@ use frame_support::{ }; use kilt_support::{ deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, + migration::{has_user_holds, switch_reserved_to_hold}, }; use log; use sp_runtime::SaturatedConversion; @@ -51,17 +51,19 @@ where use frame_support::ensure; use sp_std::vec; - let has_one_user_holds = DelegationNodes::::iter_values() + let has_all_user_no_holds = DelegationNodes::::iter_values() .map(|details: DelegationNode| { - has_user_holds_and_no_reserves::, CurrencyOf>( + has_user_holds::, CurrencyOf>( &details.deposit.owner, &HFIdentifier::Deposit(Pallets::Delegation), ) }) - .all(|user| !user); + .all(|user| user); - // before the upgrade, there should be no account with holds - ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + ensure!( + has_all_user_no_holds, + "Pre Upgrade Delegation: there are users with holds!" + ); Ok(vec![]) } @@ -69,20 +71,23 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { use frame_support::ensure; + use kilt_support::test_utils::log_and_return_error_message; - let has_all_user_holds = DelegationNodes::::iter_values() - .map(|details: DelegationNode| { - has_user_holds_and_no_reserves::, CurrencyOf>( - &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::Delegation), - ) - }) - .all(|user| user); - - // before the upgrade, there should be no account with holds - ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); - - Ok(()) + DelegationNodes::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { + let hold_balance: u128 = ::Currency::balance_on_hold( + &HFIdentifier::Deposit(Pallets::Delegation), + &details.deposit.owner, + ) + .saturated_into(); + ensure!( + details.deposit.amount.saturated_into::() == hold_balance, + log_and_return_error_message(format!( + "Delegation: Hold balance is not matching for delegation node {:?}. Expected hold: {:?}. Real hold: {:?}", + key, details.deposit.amount, hold_balance + )) + ); + Ok(()) + }) } } @@ -94,12 +99,12 @@ where { DelegationNodes::::iter_values() .map(|details: DelegationNode| { - has_user_holds_and_no_reserves::, CurrencyOf>( + has_user_holds::, CurrencyOf>( &details.deposit.owner, &HFIdentifier::Deposit(Pallets::Delegation), ) }) - .any(|user| !user) + .all(|user| user) } fn do_migration() -> Weight diff --git a/support/src/migration.rs b/support/src/migration.rs index 011770f225..d3fa335441 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -37,8 +37,18 @@ pub fn has_user_holds_and_no_reserves< owner: &AccountId, reason: &HFIdentifier, ) -> bool { - Currency::balance_on_hold(reason, owner).saturated_into::() > 0 - && Currency::reserved_balance(owner).saturated_into::() == 0 + true +} +/// Checks some precondition of the migrations. +pub fn has_user_holds< + AccountId, + Currency: ReservableCurrency + MutateHold + InspectHold, +>( + owner: &AccountId, + reason: &HFIdentifier, +) -> bool { + Currency::balance_on_hold(reason, owner).saturated_into::() == 0 + && Currency::reserved_balance(owner).saturated_into::() > 0 } pub fn has_user_freezes< From df4c9e1737d29cf96dd0a036dd51e39e347da340 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 1 Jun 2023 20:37:32 +0200 Subject: [PATCH 32/99] pre post function update --- pallets/attestation/src/migrations.rs | 60 +++++++++++++++----- pallets/delegation/src/migrations.rs | 10 ++-- pallets/did/src/migrations.rs | 51 +++++++++-------- pallets/pallet-did-lookup/src/migrations.rs | 56 ++++++++++-------- pallets/pallet-web3-names/src/migrations.rs | 52 +++++++++-------- pallets/parachain-staking/src/migrations.rs | 18 +++--- pallets/public-credentials/src/migrations.rs | 53 +++++++++-------- support/src/migration.rs | 9 --- 8 files changed, 178 insertions(+), 131 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 9727f37bc3..bfc56ccec4 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -22,7 +22,7 @@ use frame_support::{ }; use kilt_support::{ deposit::{HFIdentifier, Pallets}, - migration::switch_reserved_to_hold, + migration::{has_user_holds, switch_reserved_to_hold}, }; use log; use sp_runtime::SaturatedConversion; @@ -37,7 +37,7 @@ where ::Currency: ReservableCurrency, { fn on_runtime_upgrade() -> frame_support::weights::Weight { - log::info!("Attestation: Initiating migration"); + log::info!("bla bla Attestation: Initiating migration {:?}", is_upgraded::()); if is_upgraded::() { return do_migration::(); } @@ -46,26 +46,53 @@ where ::DbWeight::get().reads_writes(0, 0) } - // #[cfg(feature = "try-runtime")] + #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, &'static str> { use frame_support::ensure; use sp_std::vec; - // before the upgrade, there should be no account with holds - ensure!(is_upgraded::(), "Pre upgrade: there are users with holds."); - log::info!("Attestation: There are no users with holds!"); + + let has_all_user_no_holds = Attestations::::iter_values() + .map(|details: AttestationDetails| { + has_user_holds::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::Attestation), + ) + }) + .all(|user| user); + + ensure!( + has_all_user_no_holds, + "Pre Upgrade Attestation: there are users with holds!" + ); + + log::info!( + "Attestation Pre upgrade: There are no users with holds! {:?}", + has_all_user_no_holds + ); Ok(vec![]) } #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::ensure; + use frame_support::{ensure, traits::fungible::InspectHold}; + use kilt_support::test_utils::log_and_return_error_message; - // before the upgrade, there should be no account with holds - ensure!(!is_upgraded::(), "Post upgrade: there are users with reserves."); - log::info!("Attestation: Post migration checks"); - - Ok(()) + Attestations::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { + let hold_balance: u128 = ::Currency::balance_on_hold( + &HFIdentifier::Deposit(Pallets::Attestation), + &details.deposit.owner, + ) + .saturated_into(); + ensure!( + details.deposit.amount.saturated_into::() == hold_balance, + log_and_return_error_message(scale_info::prelude::format!( + "Attestation: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", + key, details.deposit.amount, hold_balance + )) + ); + Ok(()) + }) } } @@ -76,8 +103,13 @@ where ::Currency: ReservableCurrency, { Attestations::::iter_values() - .map(|details: AttestationDetails| true) - .any(|user| !user) + .map(|details: AttestationDetails| { + has_user_holds::, CurrencyOf>( + &details.deposit.owner, + &HFIdentifier::Deposit(Pallets::Attestation), + ) + }) + .all(|user| user) } fn do_migration() -> Weight diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index f9c2b29253..a93ba338c8 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -38,7 +38,7 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Delegation: Initiating migration"); - if ensure_upgraded::() { + if is_upgraded::() { return do_migration::(); } @@ -65,12 +65,14 @@ where "Pre Upgrade Delegation: there are users with holds!" ); + log::info!("Delegation: There are no users with holds!"); + Ok(vec![]) } #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::ensure; + use frame_support::{ensure, traits::fungible::InspectHold}; use kilt_support::test_utils::log_and_return_error_message; DelegationNodes::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { @@ -81,7 +83,7 @@ where .saturated_into(); ensure!( details.deposit.amount.saturated_into::() == hold_balance, - log_and_return_error_message(format!( + log_and_return_error_message(scale_info::prelude::format!( "Delegation: Hold balance is not matching for delegation node {:?}. Expected hold: {:?}. Real hold: {:?}", key, details.deposit.amount, hold_balance )) @@ -93,7 +95,7 @@ where /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn ensure_upgraded() -> bool +fn is_upgraded() -> bool where ::Currency: ReservableCurrency, { diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index 319862d234..2695c0d32e 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -22,7 +22,7 @@ use frame_support::{ }; use kilt_support::{ deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, + migration::{has_user_holds, switch_reserved_to_hold}, }; use log; use sp_runtime::SaturatedConversion; @@ -35,7 +35,7 @@ pub struct BalanceMigration(PhantomData); impl OnRuntimeUpgrade for BalanceMigration { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Did: Initiating migration"); - if ensure_upgraded::() { + if is_upgraded::() { return do_migration::(); } @@ -48,47 +48,50 @@ impl OnRuntimeUpgrade for BalanceMigration { use frame_support::ensure; use sp_std::vec; - let has_one_user_holds = Did::::iter_values() + let has_all_user_no_holds = Did::::iter_values() .map(|details: DidDetails| { - has_user_holds_and_no_reserves::, CurrencyOf>( + has_user_holds::, CurrencyOf>( &details.deposit.owner, &HFIdentifier::Deposit(Pallets::Did), ) }) - .all(|user| !user); + .all(|user| user); - // before the upgrade, there should be no account with holds - ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + ensure!(has_all_user_no_holds, "Pre Upgrade Did: there are users with holds!"); + log::info!("Did: There are no users with holds!"); Ok(vec![]) } #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::ensure; - - let has_all_user_holds = Did::::iter_values() - .map(|details: DidDetails| { - has_user_holds_and_no_reserves::, CurrencyOf>( - &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::Did), - ) - }) - .all(|user| user); - - // before the upgrade, there should be no account with holds - ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); - - Ok(()) + use frame_support::{ensure, traits::fungible::InspectHold}; + use kilt_support::test_utils::log_and_return_error_message; + + Did::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { + let hold_balance: u128 = + ::Currency::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &details.deposit.owner) + .saturated_into(); + ensure!( + details.deposit.amount.saturated_into::() == hold_balance, + log_and_return_error_message(scale_info::prelude::format!( + "Did: Hold balance is not matching for Did {:?}. Expected hold: {:?}. Real hold: {:?}", + key, + details.deposit.amount, + hold_balance + )) + ); + Ok(()) + }) } } /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn ensure_upgraded() -> bool { +fn is_upgraded() -> bool { Did::::iter_values() .map(|details: DidDetails| { - has_user_holds_and_no_reserves::, CurrencyOf>( + has_user_holds::, CurrencyOf>( &details.deposit.owner, &HFIdentifier::Deposit(Pallets::Did), ) diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index 53bf6e4480..b41ec86be1 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -24,7 +24,7 @@ use frame_support::{ }; use kilt_support::{ deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, + migration::{has_user_holds, switch_reserved_to_hold}, }; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; @@ -130,7 +130,7 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Did lookup: Initiating migration"); - if ensure_upgraded::() { + if is_upgraded::() { return do_migration::(); } log::info!("Did lookup: No migration needed. This file should be deleted."); @@ -142,50 +142,58 @@ where use frame_support::ensure; use sp_std::vec; - let has_one_user_holds = ConnectedDids::::iter_values() - .map(|details: ConnectionRecordOf| { - has_user_holds_and_no_reserves::, CurrencyOf>( + let has_all_user_no_holds = ConnectedDids::::iter_values() + .map(|details| { + has_user_holds::, CurrencyOf>( &details.deposit.owner, &HFIdentifier::Deposit(Pallets::DidLookup), ) }) - .all(|user| !user); + .all(|user| user); + + ensure!( + has_all_user_no_holds, + "Pre Upgrade Did lookup: there are users with holds!" + ); - // before the upgrade, there should be no account with holds - ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + log::info!("Did lookup: There are no users with holds!"); Ok(vec![]) } #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::ensure; + use frame_support::{ensure, traits::fungible::InspectHold}; + use kilt_support::test_utils::log_and_return_error_message; + use sp_runtime::SaturatedConversion; - let has_all_user_holds = ConnectedDids::::iter_values() - .map(|details: ConnectionRecordOf| { - has_user_holds_and_no_reserves::, CurrencyOf>( - &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::DidLookup), - ) - }) - .all(|user| user); - - // before the upgrade, there should be no account with holds - ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); - - Ok(()) + ConnectedDids::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { + let hold_balance: u128 = ::Currency::balance_on_hold( + &HFIdentifier::Deposit(Pallets::DidLookup), + &details.deposit.owner, + ) + .saturated_into(); + ensure!( + details.deposit.amount.saturated_into::() == hold_balance, + log_and_return_error_message(scale_info::prelude::format!( + "Did lookup: Hold balance is not matching for connected did {:?}. Expected hold: {:?}. Real hold: {:?}", + key, details.deposit.amount, hold_balance + )) + ); + Ok(()) + }) } } /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn ensure_upgraded() -> bool +fn is_upgraded() -> bool where ::Currency: ReservableCurrency, { ConnectedDids::::iter_values() .map(|details: ConnectionRecordOf| { - has_user_holds_and_no_reserves::, CurrencyOf>( + has_user_holds::, CurrencyOf>( &details.deposit.owner, &HFIdentifier::Deposit(Pallets::DidLookup), ) diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index 3d0f976da8..dfc07c105d 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -22,7 +22,7 @@ use frame_support::{ }; use kilt_support::{ deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, + migration::{has_user_holds, switch_reserved_to_hold}, }; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; @@ -37,7 +37,7 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("W3n: Initiating migration"); - if ensure_upgraded::() { + if is_upgraded::() { return do_migration::(); } log::info!("W3n: No migration needed. This file should be deleted."); @@ -49,50 +49,54 @@ where use frame_support::ensure; use sp_std::vec; - let has_one_user_holds = Owner::::iter_values() + let has_all_user_no_holds = Owner::::iter_values() .map(|details: Web3OwnershipOf| { - has_user_holds_and_no_reserves::, CurrencyOf>( + has_user_holds::, CurrencyOf>( &details.deposit.owner, &HFIdentifier::Deposit(Pallets::W3n), ) }) - .all(|user| !user); + .all(|user| user); + + ensure!(has_all_user_no_holds, "Pre Upgrade W3n: there are users with holds!"); - // before the upgrade, there should be no account with holds - ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + log::info!("W3n: There are no users with holds!"); Ok(vec![]) } #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::ensure; - - let has_all_user_holds = Owner::::iter_values() - .map(|details: Web3OwnershipOf| { - has_user_holds_and_no_reserves::, CurrencyOf>( - &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::W3n), - ) - }) - .all(|user| user); - - // before the upgrade, there should be no account with holds - ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); - - Ok(()) + use frame_support::{ensure, traits::fungible::InspectHold}; + use kilt_support::test_utils::log_and_return_error_message; + + Owner::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { + let hold_balance: u128 = + ::Currency::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &details.deposit.owner) + .saturated_into(); + ensure!( + details.deposit.amount.saturated_into::() == hold_balance, + log_and_return_error_message(scale_info::prelude::format!( + "W3n: Hold balance is not matching for w3n {:?}. Expected hold: {:?}. Real hold: {:?}", + key, + details.deposit.amount, + hold_balance + )) + ); + Ok(()) + }) } } /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn ensure_upgraded() -> bool +fn is_upgraded() -> bool where ::Currency: ReservableCurrency, { Owner::::iter_values() .map(|details: Web3OwnershipOf| { - has_user_holds_and_no_reserves::, CurrencyOf>( + has_user_holds::, CurrencyOf>( &details.deposit.owner, &HFIdentifier::Deposit(Pallets::W3n), ) diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index a7ebd7d673..c6fb181596 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -46,24 +46,24 @@ where ::DbWeight::get().reads_writes(0, 0) } - // #[cfg(feature = "try-runtime")] + #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, &'static str> { - use frame_support::ensure; + // use frame_support::ensure; use sp_std::vec; - // before the upgrade, there should be no account with holds - ensure!(is_upgraded::(), "Pre upgrade: there are users with holds."); - log::info!("Staking: Starting pre migration checks!"); + // // before the upgrade, there should be no account with holds + // ensure!(is_upgraded::(), "Pre upgrade: there are users with holds."); + // log::info!("Staking: Starting pre migration checks!"); Ok(vec![]) } #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::ensure; + // use frame_support::ensure; - // before the upgrade, there should be no account with holds - ensure!(!is_upgraded::(), "Post upgrade: there are users with reserves."); - log::info!("Staking: Post migration checks succeded!"); + // // before the upgrade, there should be no account with holds + // ensure!(!is_upgraded::(), "Post upgrade: there are users with reserves."); + // log::info!("Staking: Post migration checks succeded!"); Ok(()) } diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index a7499c77f9..4345016fd4 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -22,7 +22,7 @@ use frame_support::{ }; use kilt_support::{ deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds_and_no_reserves, switch_reserved_to_hold}, + migration::{has_user_holds, switch_reserved_to_hold}, }; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; @@ -37,7 +37,7 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Public Credentials: Initiating migration"); - if ensure_upgraded::() { + if is_upgraded::() { return do_migration::(); } log::info!("Public Credentials: No migration needed. This file should be deleted."); @@ -49,50 +49,57 @@ where use frame_support::ensure; use sp_std::vec; - let has_one_user_holds = Credentials::::iter_values() + let has_all_user_no_holds = Credentials::::iter_values() .map(|details: CredentialEntryOf| { - has_user_holds_and_no_reserves::, CurrencyOf>( + has_user_holds::, CurrencyOf>( &details.deposit.owner, &HFIdentifier::Deposit(Pallets::PublicCredentials), ) }) - .all(|user| !user); + .all(|user| user); + + ensure!( + has_all_user_no_holds, + "Pre Upgrade Public Credentials: there are users with holds!" + ); - // before the upgrade, there should be no account with holds - ensure!(has_one_user_holds, "Pre upgrade: there are users with holds."); + log::info!("Public Credentials: There are no users with holds!"); Ok(vec![]) } #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::ensure; - - let has_all_user_holds = Credentials::::iter_values() - .map(|details: CredentialEntryOf| { - has_user_holds_and_no_reserves::, CurrencyOf>( - &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::PublicCredentials), - ) - }) - .all(|user| user); + use frame_support::{ensure, traits::fungible::InspectHold}; + use kilt_support::test_utils::log_and_return_error_message; - // before the upgrade, there should be no account with holds - ensure!(has_all_user_holds, "Post upgrade: there are user with reserves."); - - Ok(()) + Credentials::::iter().try_for_each(|(key, key2, details)| -> Result<(), &'static str> { + let hold_balance: u128 = ::Currency::balance_on_hold( + &HFIdentifier::Deposit(Pallets::PublicCredentials), + &details.deposit.owner, + ) + .saturated_into(); + ensure!( + details.deposit.amount.saturated_into::() == hold_balance, + log_and_return_error_message(scale_info::prelude::format!( + "Public Credentails: Hold balance is not matching for credential {:?} {:?}. Expected hold: {:?}. Real hold: {:?}", + key, key2, details.deposit.amount, hold_balance + )) + ); + Ok(()) + }) } } /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn ensure_upgraded() -> bool +fn is_upgraded() -> bool where ::Currency: ReservableCurrency, { Credentials::::iter_values() .map(|details: CredentialEntryOf| { - has_user_holds_and_no_reserves::, CurrencyOf>( + has_user_holds::, CurrencyOf>( &details.deposit.owner, &HFIdentifier::Deposit(Pallets::PublicCredentials), ) diff --git a/support/src/migration.rs b/support/src/migration.rs index d3fa335441..86f607afe5 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -30,15 +30,6 @@ use sp_runtime::SaturatedConversion; use crate::deposit::HFIdentifier; -pub fn has_user_holds_and_no_reserves< - AccountId, - Currency: ReservableCurrency + MutateHold + InspectHold, ->( - owner: &AccountId, - reason: &HFIdentifier, -) -> bool { - true -} /// Checks some precondition of the migrations. pub fn has_user_holds< AccountId, From de58a27c042da3726c0867dd94401744bfee8bed Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 2 Jun 2023 11:26:45 +0200 Subject: [PATCH 33/99] logic error --- pallets/attestation/src/migrations.rs | 17 +++++++++------ pallets/delegation/src/migrations.rs | 11 +++++++--- pallets/did/src/migrations.rs | 13 +++++++---- pallets/pallet-did-lookup/src/migrations.rs | 13 +++++++---- pallets/pallet-web3-names/src/migrations.rs | 14 ++++++++---- pallets/parachain-staking/src/migrations.rs | 23 ++++++++++---------- pallets/public-credentials/src/migrations.rs | 14 ++++++++---- support/src/migration.rs | 6 ++--- 8 files changed, 71 insertions(+), 40 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index bfc56ccec4..0be4e0de84 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -37,7 +37,7 @@ where ::Currency: ReservableCurrency, { fn on_runtime_upgrade() -> frame_support::weights::Weight { - log::info!("bla bla Attestation: Initiating migration {:?}", is_upgraded::()); + log::info!("Attestation: Initiating migration"); if is_upgraded::() { return do_migration::(); } @@ -65,10 +65,7 @@ where "Pre Upgrade Attestation: there are users with holds!" ); - log::info!( - "Attestation Pre upgrade: There are no users with holds! {:?}", - has_all_user_no_holds - ); + log::info!("Attestation: Pre migration checks successful"); Ok(vec![]) } @@ -85,14 +82,20 @@ where ) .saturated_into(); ensure!( - details.deposit.amount.saturated_into::() == hold_balance, + details.deposit.amount.saturated_into::() <= hold_balance, log_and_return_error_message(scale_info::prelude::format!( "Attestation: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", key, details.deposit.amount, hold_balance )) ); + + ensure!(!is_upgraded::(), "Attestation Post: Users have still no holds"); + Ok(()) - }) + })?; + + log::info!("Attestation: Post migration checks successful"); + Ok(()) } } diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index a93ba338c8..31b413b9fc 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -65,7 +65,7 @@ where "Pre Upgrade Delegation: there are users with holds!" ); - log::info!("Delegation: There are no users with holds!"); + log::info!("Delegation: Pre migration checks successful"); Ok(vec![]) } @@ -82,14 +82,19 @@ where ) .saturated_into(); ensure!( - details.deposit.amount.saturated_into::() == hold_balance, + details.deposit.amount.saturated_into::() <= hold_balance, log_and_return_error_message(scale_info::prelude::format!( "Delegation: Hold balance is not matching for delegation node {:?}. Expected hold: {:?}. Real hold: {:?}", key, details.deposit.amount, hold_balance )) ); + + ensure!(!is_upgraded::(), "Delegation: Users have still no holds"); + Ok(()) - }) + })?; + log::info!("Delegation: Post migration checks successful"); + Ok(()) } } diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index 2695c0d32e..138a532f7b 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -58,7 +58,7 @@ impl OnRuntimeUpgrade for BalanceMigration { .all(|user| user); ensure!(has_all_user_no_holds, "Pre Upgrade Did: there are users with holds!"); - log::info!("Did: There are no users with holds!"); + log::info!("Did: Pre migration checks successful"); Ok(vec![]) } @@ -73,7 +73,7 @@ impl OnRuntimeUpgrade for BalanceMigration { ::Currency::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &details.deposit.owner) .saturated_into(); ensure!( - details.deposit.amount.saturated_into::() == hold_balance, + details.deposit.amount.saturated_into::() <= hold_balance, log_and_return_error_message(scale_info::prelude::format!( "Did: Hold balance is not matching for Did {:?}. Expected hold: {:?}. Real hold: {:?}", key, @@ -81,8 +81,13 @@ impl OnRuntimeUpgrade for BalanceMigration { hold_balance )) ); + ensure!(!is_upgraded::(), "Did: Users have still no holds"); + Ok(()) - }) + })?; + + log::info!("Did: Post migration checks successful"); + Ok(()) } } @@ -96,7 +101,7 @@ fn is_upgraded() -> bool { &HFIdentifier::Deposit(Pallets::Did), ) }) - .any(|user| !user) + .all(|user| user) } fn do_migration() -> Weight { diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index b41ec86be1..b3a566a54f 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -156,7 +156,7 @@ where "Pre Upgrade Did lookup: there are users with holds!" ); - log::info!("Did lookup: There are no users with holds!"); + log::info!("Did: Pre migration checks successful"); Ok(vec![]) } @@ -174,14 +174,19 @@ where ) .saturated_into(); ensure!( - details.deposit.amount.saturated_into::() == hold_balance, + details.deposit.amount.saturated_into::() <= hold_balance, log_and_return_error_message(scale_info::prelude::format!( "Did lookup: Hold balance is not matching for connected did {:?}. Expected hold: {:?}. Real hold: {:?}", key, details.deposit.amount, hold_balance )) ); + + ensure!(!is_upgraded::(), "Did lookup: Users have still no holds"); + Ok(()) - }) + })?; + log::info!("Did lookup: Post migration checks successful"); + Ok(()) } } @@ -198,7 +203,7 @@ where &HFIdentifier::Deposit(Pallets::DidLookup), ) }) - .any(|user| !user) + .all(|user| user) } fn do_migration() -> Weight diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index dfc07c105d..add9282274 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -60,7 +60,7 @@ where ensure!(has_all_user_no_holds, "Pre Upgrade W3n: there are users with holds!"); - log::info!("W3n: There are no users with holds!"); + log::info!("W3n: Pre migration checks successful"); Ok(vec![]) } @@ -75,7 +75,7 @@ where ::Currency::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &details.deposit.owner) .saturated_into(); ensure!( - details.deposit.amount.saturated_into::() == hold_balance, + details.deposit.amount.saturated_into::() <= hold_balance, log_and_return_error_message(scale_info::prelude::format!( "W3n: Hold balance is not matching for w3n {:?}. Expected hold: {:?}. Real hold: {:?}", key, @@ -83,8 +83,14 @@ where hold_balance )) ); + + ensure!(!is_upgraded::(), "Users have still no holds"); + Ok(()) - }) + })?; + + log::info!("W3n: Post migration checks successful"); + Ok(()) } } @@ -101,7 +107,7 @@ where &HFIdentifier::Deposit(Pallets::W3n), ) }) - .any(|user| !user) + .all(|user| user) } fn do_migration() -> Weight diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index c6fb181596..2af061802f 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -48,22 +48,24 @@ where #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, &'static str> { - // use frame_support::ensure; + use frame_support::ensure; use sp_std::vec; - // // before the upgrade, there should be no account with holds - // ensure!(is_upgraded::(), "Pre upgrade: there are users with holds."); - // log::info!("Staking: Starting pre migration checks!"); + let count_freezes = pallet_balances::Freezes::::iter().count(); + ensure!(count_freezes == 0, "Staking Pre: There are already freezes."); + + log::info!("Staking: Pre migration checks successful"); Ok(vec![]) } #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - // use frame_support::ensure; + use frame_support::ensure; + + let count_freezes = pallet_balances::Freezes::::iter().count(); + ensure!(count_freezes > 0, "Staking Post: There are still no freezes."); - // // before the upgrade, there should be no account with holds - // ensure!(!is_upgraded::(), "Post upgrade: there are users with reserves."); - // log::info!("Staking: Post migration checks succeded!"); + log::info!("Staking: Post migration checks successful"); Ok(()) } @@ -77,7 +79,7 @@ where Locks::::iter_values() .flatten() .map(|lock: BalanceLock<_>| lock.id == STAKING_ID) - .any(|is_staking| !is_staking) + .any(|is_staking| is_staking) } fn do_migration() -> Weight @@ -91,12 +93,11 @@ where .map(|lock: &BalanceLock<_>| -> Weight { if lock.id == STAKING_ID { let error = switch_locks_to_freeze::, CurrencyOf>( - user_id.clone(), + &user_id, STAKING_ID, &HFIdentifier::Staking, lock.amount.saturated_into(), ); - if error.is_ok() { return ::DbWeight::get().reads_writes(1, 1); } diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index 4345016fd4..fa1a189fad 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -63,7 +63,7 @@ where "Pre Upgrade Public Credentials: there are users with holds!" ); - log::info!("Public Credentials: There are no users with holds!"); + log::info!("Public Credentials: Pre migration checks successful"); Ok(vec![]) } @@ -80,14 +80,20 @@ where ) .saturated_into(); ensure!( - details.deposit.amount.saturated_into::() == hold_balance, + details.deposit.amount.saturated_into::() <= hold_balance, log_and_return_error_message(scale_info::prelude::format!( "Public Credentails: Hold balance is not matching for credential {:?} {:?}. Expected hold: {:?}. Real hold: {:?}", key, key2, details.deposit.amount, hold_balance )) ); + + ensure!(!is_upgraded::(), "Users have still no holds"); + Ok(()) - }) + })?; + + log::info!("Public Credentials: Post migration checks successful"); + Ok(()) } } @@ -104,7 +110,7 @@ where &HFIdentifier::Deposit(Pallets::PublicCredentials), ) }) - .any(|user| !user) + .all(|user| user) } fn do_migration() -> Weight diff --git a/support/src/migration.rs b/support/src/migration.rs index 86f607afe5..3e97b43b8f 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -68,11 +68,11 @@ pub fn switch_locks_to_freeze< AccountId, Currency: LockableCurrency + MutateFreeze, >( - who: AccountId, + who: &AccountId, id_lock: LockIdentifier, id_freeze: &HFIdentifier, amount: u128, ) -> DispatchResult { - Currency::remove_lock(id_lock, &who); - Currency::set_freeze(id_freeze, &who, amount.saturated_into()) + Currency::remove_lock(id_lock, who); + Currency::set_freeze(id_freeze, who, amount.saturated_into()) } From e33a56323847ee71ac7a05b29d6ee668aed75199 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 2 Jun 2023 14:42:35 +0200 Subject: [PATCH 34/99] other migration approach for the staking pallet --- pallets/parachain-staking/src/migrations.rs | 70 +++++++++++++++++---- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index 2af061802f..e83664b33b 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -17,11 +17,11 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, + traits::{fungible::freeze::Mutate as MutateFreeze, Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; -use kilt_support::{deposit::HFIdentifier, migration::switch_locks_to_freeze}; -use pallet_balances::{BalanceLock, Locks}; +use kilt_support::deposit::HFIdentifier; +use pallet_balances::{BalanceLock, Freezes, IdAmount, Locks}; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; @@ -63,7 +63,9 @@ where use frame_support::ensure; let count_freezes = pallet_balances::Freezes::::iter().count(); - ensure!(count_freezes > 0, "Staking Post: There are still no freezes."); + let count_locks = pallet_balances::Locks::::iter().count(); + ensure!(count_freezes > 0, "Staking: There are still no freezes."); + ensure!(count_locks == 0 , "Staking: There are still locks."); log::info!("Staking: Post migration checks successful"); @@ -88,23 +90,67 @@ where { Locks::::iter() .map(|(user_id, locks)| { - locks + let weight = locks .iter() .map(|lock: &BalanceLock<_>| -> Weight { if lock.id == STAKING_ID { - let error = switch_locks_to_freeze::, CurrencyOf>( + update_or_create_freeze::(user_id.clone(), lock) + } else { + log::info!("Staking: Found unexpected lock with undefined lock id {:?}. for user: {:?}. Create new freeze with freeze_id Misc.", lock.id, user_id); + let result = as MutateFreeze>>::set_freeze( + &HFIdentifier::Misc, &user_id, - STAKING_ID, - &HFIdentifier::Staking, lock.amount.saturated_into(), ); - if error.is_ok() { - return ::DbWeight::get().reads_writes(1, 1); + + if result.is_err() { + log::info!("Staking: While creating a new freeze for id: {:?}, amount: {:?} for lock:{:?} an error occured.", + HFIdentifier::Misc, + lock.amount, + user_id); + return ::DbWeight::get().reads_writes(0, 0); } + ::DbWeight::get().reads_writes(1, 1) } - ::DbWeight::get().reads_writes(0, 0) + }) - .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) + .fold(Weight::zero(), |acc, next| acc.saturating_add(next)); + Locks::::remove(user_id); + weight }) .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) } + +fn update_or_create_freeze( + user_id: T::AccountId, + lock: &BalanceLock<::Balance>, +) -> Weight { + let freezes = Freezes::::get(&user_id); + + let result = if let Some(IdAmount { amount, .. }) = freezes + .iter() + .find(|freeze| &freeze.id == ::Identifier::from(HFIdentifier::Staking).as_ref()) + { + let total_lock = lock + .amount + .saturated_into::() + .saturating_add((*amount).saturated_into()); + + as MutateFreeze>>::extend_freeze( + &HFIdentifier::Staking, + &user_id, + total_lock.saturated_into(), + ) + } else { + as MutateFreeze>>::set_freeze( + &HFIdentifier::Staking, + &user_id, + lock.amount.saturated_into(), + ) + }; + + if result.is_err() { + return ::DbWeight::get().reads_writes(0, 0); + } + ::DbWeight::get().reads_writes(1, 1) +} From 2ec1e5a979805daedeb6a9ace7ea130f6a831019 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 2 Jun 2023 15:15:49 +0200 Subject: [PATCH 35/99] no errors --- pallets/parachain-staking/src/migrations.rs | 28 +++++---------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index e83664b33b..ff04c479df 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{fungible::freeze::Mutate as MutateFreeze, Get, OnRuntimeUpgrade, ReservableCurrency}, + traits::{fungible::freeze::Mutate as MutateFreeze, Get, LockableCurrency, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; use kilt_support::deposit::HFIdentifier; @@ -63,9 +63,8 @@ where use frame_support::ensure; let count_freezes = pallet_balances::Freezes::::iter().count(); - let count_locks = pallet_balances::Locks::::iter().count(); + ensure!(count_freezes > 0, "Staking: There are still no freezes."); - ensure!(count_locks == 0 , "Staking: There are still locks."); log::info!("Staking: Post migration checks successful"); @@ -94,28 +93,11 @@ where .iter() .map(|lock: &BalanceLock<_>| -> Weight { if lock.id == STAKING_ID { - update_or_create_freeze::(user_id.clone(), lock) - } else { - log::info!("Staking: Found unexpected lock with undefined lock id {:?}. for user: {:?}. Create new freeze with freeze_id Misc.", lock.id, user_id); - let result = as MutateFreeze>>::set_freeze( - &HFIdentifier::Misc, - &user_id, - lock.amount.saturated_into(), - ); - - if result.is_err() { - log::info!("Staking: While creating a new freeze for id: {:?}, amount: {:?} for lock:{:?} an error occured.", - HFIdentifier::Misc, - lock.amount, - user_id); - return ::DbWeight::get().reads_writes(0, 0); - } - ::DbWeight::get().reads_writes(1, 1) + return update_or_create_freeze::(user_id.clone(), lock); } - + ::DbWeight::get().reads_writes(0, 0) }) .fold(Weight::zero(), |acc, next| acc.saturating_add(next)); - Locks::::remove(user_id); weight }) .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) @@ -149,6 +131,8 @@ fn update_or_create_freeze( ) }; + as LockableCurrency>>::remove_lock(STAKING_ID, &user_id); + if result.is_err() { return ::DbWeight::get().reads_writes(0, 0); } From eed3df02a5235b87a9210dd21b0a3d8c6639a66c Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 2 Jun 2023 15:17:26 +0200 Subject: [PATCH 36/99] renaming --- pallets/parachain-staking/src/default_weights.rs | 2 +- pallets/parachain-staking/src/lib.rs | 6 +++--- pallets/parachain-staking/src/tests.rs | 2 +- runtimes/peregrine/src/weights/parachain_staking.rs | 2 +- runtimes/spiritnet/src/weights/parachain_staking.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pallets/parachain-staking/src/default_weights.rs b/pallets/parachain-staking/src/default_weights.rs index 6ca7839452..a7fc05e9ad 100644 --- a/pallets/parachain-staking/src/default_weights.rs +++ b/pallets/parachain-staking/src/default_weights.rs @@ -1256,7 +1256,7 @@ impl WeightInfo for () { /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) /// The range of component `u` is `[1, 9]`. - fn unfreeze_unstaked(u: u32, ) -> Weight { + fn unlock_unstaked(u: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1488 + u * (24 ±0)` // Estimated: `9137` diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index e1926d0400..c17c84c1da 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -1627,10 +1627,10 @@ pub mod pallet { /// - Kills: Unstaking & Freezess if no balance is locked anymore /// # #[pallet::call_index(16)] - #[pallet::weight(::WeightInfo::unfreeze_unstaked( + #[pallet::weight(::WeightInfo::unlock_unstaked( T::MaxUnstakeRequests::get().saturated_into::() ))] - pub fn unfreeze_unstaked( + pub fn unlock_unstaked( origin: OriginFor, target: ::Source, ) -> DispatchResultWithPostInfo { @@ -1639,7 +1639,7 @@ pub mod pallet { let unstaking_len = Self::do_unlock(&target)?; - Ok(Some(::WeightInfo::unfreeze_unstaked(unstaking_len)).into()) + Ok(Some(::WeightInfo::unlock_unstaked(unstaking_len)).into()) } /// Claim block authoring rewards for the target address. diff --git a/pallets/parachain-staking/src/tests.rs b/pallets/parachain-staking/src/tests.rs index 7f66ea0bf7..4098ab33ee 100644 --- a/pallets/parachain-staking/src/tests.rs +++ b/pallets/parachain-staking/src/tests.rs @@ -2112,7 +2112,7 @@ fn update_inflation() { } #[test] -fn unfreeze_unstaked() { +fn unlock_unstaked() { // same_unstaked_as_restaked // block 1: stake & unstake for 100 // block 2: stake & unstake for 100 diff --git a/runtimes/peregrine/src/weights/parachain_staking.rs b/runtimes/peregrine/src/weights/parachain_staking.rs index a149e907c3..4df4fddf5d 100644 --- a/runtimes/peregrine/src/weights/parachain_staking.rs +++ b/runtimes/peregrine/src/weights/parachain_staking.rs @@ -595,7 +595,7 @@ impl parachain_staking::WeightInfo for WeightInfo { /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) /// The range of component `u` is `[1, 9]`. - fn unfreeze_unstaked(_u: u32, ) -> Weight { + fn unlock_unstaked(_u: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1449 + u * (28 ±0)` // Estimated: `9137` diff --git a/runtimes/spiritnet/src/weights/parachain_staking.rs b/runtimes/spiritnet/src/weights/parachain_staking.rs index e432bd9d6a..040ad9ff5a 100644 --- a/runtimes/spiritnet/src/weights/parachain_staking.rs +++ b/runtimes/spiritnet/src/weights/parachain_staking.rs @@ -469,7 +469,7 @@ impl parachain_staking::WeightInfo for WeightInfo { // Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - fn unfreeze_unstaked(_u: u32, ) -> Weight { + fn unlock_unstaked(_u: u32, ) -> Weight { Weight::from_parts(40_259_781 as u64, 0) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) From ccc25a7660db9777d4bd59f69cf039e427f9d5a5 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Sat, 3 Jun 2023 12:02:43 +0200 Subject: [PATCH 37/99] fixed tests --- pallets/parachain-staking/src/benchmarking.rs | 47 ++++++++------ .../parachain-staking/src/default_weights.rs | 4 +- pallets/parachain-staking/src/lib.rs | 40 +++++++----- pallets/parachain-staking/src/tests.rs | 62 +++++++++---------- .../src/weights/parachain_staking.rs | 2 +- 5 files changed, 89 insertions(+), 66 deletions(-) diff --git a/pallets/parachain-staking/src/benchmarking.rs b/pallets/parachain-staking/src/benchmarking.rs index 606db7dc6d..63ea27237a 100644 --- a/pallets/parachain-staking/src/benchmarking.rs +++ b/pallets/parachain-staking/src/benchmarking.rs @@ -22,7 +22,10 @@ use crate::{types::RoundInfo, *}; use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, Zero}; use frame_support::{ assert_ok, - traits::{Currency, Get, OnInitialize}, + traits::{ + fungible::{Inspect, Mutate}, + Get, OnInitialize, + }, }; use frame_system::{Pallet as System, RawOrigin}; use pallet_session::Pallet as Session; @@ -39,7 +42,10 @@ const DELEGATOR_ACCOUNT_SEED: u32 = 1; fn setup_collator_candidates( num_candidates: u32, default_amount: Option, -) -> Vec { +) -> Vec +where + ::Currency: Mutate, +{ let current_collator_count = TopCandidates::::get().len().saturated_into::(); let collators: Vec = (current_collator_count..num_candidates) .map(|i| account("collator", i.saturated_into::(), COLLATOR_ACCOUNT_SEED)) @@ -47,7 +53,7 @@ fn setup_collator_candidates( let amount: T::CurrencyBalance = default_amount.unwrap_or_else(T::MinCollatorCandidateStake::get); for acc in collators.iter() { - T::Currency::make_free_balance_be(acc, amount); + >::set_balance(acc, amount); assert_ok!(Pallet::::join_candidates( T::RuntimeOrigin::from(Some(acc.clone()).into()), amount, @@ -63,7 +69,10 @@ fn setup_collator_candidates( .collect() } -fn fill_delegators(num_delegators: u32, collator: T::AccountId, collator_seed: u32) -> Vec { +fn fill_delegators(num_delegators: u32, collator: T::AccountId, collator_seed: u32) -> Vec +where + ::Currency: Mutate, +{ let state = CandidatePool::::get(&collator).unwrap(); let current_delegators = state.delegators.len().saturated_into::(); @@ -78,7 +87,7 @@ fn fill_delegators(num_delegators: u32, collator: T::AccountId, colla .collect(); for acc in delegators.iter() { - T::Currency::make_free_balance_be(acc, T::MinDelegatorStake::get()); + >::set_balance(acc, T::MinDelegatorStake::get()); assert_ok!(Pallet::::join_delegators( T::RuntimeOrigin::from(Some(acc.clone()).into()), T::Lookup::unlookup(collator.clone()), @@ -115,7 +124,9 @@ where } benchmarks! { - where_clause { where u64: Into<::BlockNumber> } + where_clause { where u64: Into<::BlockNumber>, + ::Currency: Mutate + } on_initialize_no_action { assert_eq!(Round::::get().current, 0u32); @@ -243,7 +254,7 @@ benchmarks! { } let new_candidate = account("new_collator", u32::MAX , COLLATOR_ACCOUNT_SEED); - T::Currency::make_free_balance_be(&new_candidate, min_candidate_stake); + T::Currency::set_balance(&new_candidate, min_candidate_stake); let origin = RawOrigin::Signed(new_candidate.clone()); }: _(origin, min_candidate_stake) @@ -305,7 +316,7 @@ benchmarks! { // increase stake so we can unstake, because current stake is minimum let more_stake = T::MinCollatorCandidateStake::get(); - T::Currency::make_free_balance_be(&candidate, T::CurrencyBalance::from(u128::MAX)); + T::Currency::set_balance(&candidate, T::CurrencyBalance::from(10u128.pow(20))); assert_ok!(Pallet::::candidate_stake_more(RawOrigin::Signed(candidate.clone()).into(), more_stake)); // fill unstake BTreeMap by unstaked many entries of 1 @@ -344,7 +355,7 @@ benchmarks! { let more_stake = T::MinCollatorCandidateStake::get(); // increase stake so we can unstake, because current stake is minimum - T::Currency::make_free_balance_be(&candidate, T::CurrencyBalance::from(u128::MAX)); + T::Currency::set_balance(&candidate, T::CurrencyBalance::from(10u128.pow(20))); assert_ok!(Pallet::::candidate_stake_more(RawOrigin::Signed(candidate.clone()).into(), more_stake)); // fill unstake BTreeMap by unstaked many entries of 1 @@ -372,7 +383,7 @@ benchmarks! { let old_stake = CandidatePool::::get(&candidate).unwrap().stake; let more_stake = T::MinCollatorCandidateStake::get(); - T::Currency::make_free_balance_be(&candidate, T::CurrencyBalance::from(u128::MAX)); + T::Currency::set_balance(&candidate, T::CurrencyBalance::from(10u128.pow(20))); Pallet::::candidate_stake_more(RawOrigin::Signed(candidate.clone()).into(), more_stake).expect("should increase stake"); let new_stake = CandidatePool::::get(&candidate).unwrap().stake; @@ -396,7 +407,7 @@ benchmarks! { let collator = candidates[0].clone(); let delegator = account("new-delegator", 0, DELEGATOR_ACCOUNT_SEED); let amount = T::MinDelegatorStake::get(); - T::Currency::make_free_balance_be(&delegator, amount + amount + amount + amount); + T::Currency::set_balance(&delegator, amount + amount + amount + amount); let unlookup_collator = T::Lookup::unlookup(collator.clone()); @@ -427,7 +438,7 @@ benchmarks! { assert_eq!(DelegatorState::::get(&delegator).unwrap().amount, amount); // increase stake so we can unstake, because current stake is minimum - T::Currency::make_free_balance_be(&delegator, T::CurrencyBalance::from(u128::MAX)); + T::Currency::set_balance(&delegator, T::CurrencyBalance::from(10u128.pow(15))); assert_ok!(Pallet::::delegator_stake_more(RawOrigin::Signed(delegator.clone()).into(), T::CurrencyBalance::from(u as u64))); assert_eq!(DelegatorState::::get(&delegator).unwrap().amount, amount + T::CurrencyBalance::from(u as u64)); @@ -463,7 +474,7 @@ benchmarks! { assert_eq!(DelegatorState::::get(&delegator).unwrap().amount, T::MinDelegatorStake::get()); // increase stake so we can unstake, because current stake is minimum - T::Currency::make_free_balance_be(&delegator, T::CurrencyBalance::from(u128::MAX)); + T::Currency::set_balance(&delegator, T::CurrencyBalance::from(10u128.pow(15))); assert_ok!(Pallet::::delegator_stake_more(RawOrigin::Signed(delegator.clone()).into(), amount + amount)); assert_eq!(DelegatorState::::get(&delegator).unwrap().amount, T::MinDelegatorStake::get() + amount + amount); @@ -500,7 +511,7 @@ benchmarks! { assert_eq!(DelegatorState::::get(&delegator).unwrap().amount, T::MinDelegatorStake::get()); // increase stake so we can unstake, because current stake is minimum - T::Currency::make_free_balance_be(&delegator, T::CurrencyBalance::from(u128::MAX)); + T::Currency::set_balance(&delegator, T::CurrencyBalance::from(10u128.pow(15))); assert_ok!(Pallet::::delegator_stake_more(RawOrigin::Signed(delegator.clone()).into(), amount + amount)); assert_eq!(DelegatorState::::get(&delegator).unwrap().amount, T::MinDelegatorStake::get() + amount + amount); @@ -518,13 +529,13 @@ benchmarks! { assert_eq!(Unstaking::::get(&delegator).len(), 2); } - unfreeze_unstaked { + unlock_unstaked { let u in 1 .. (T::MaxUnstakeRequests::get() - 1); let candidate = account("collator", 0u32, COLLATOR_ACCOUNT_SEED); - let free_balance = T::CurrencyBalance::from(u128::MAX); + let free_balance = T::CurrencyBalance::from(10u128.pow(15)); let stake = T::MinCollatorCandidateStake::get(); - T::Currency::make_free_balance_be(&candidate, free_balance); + T::Currency::set_balance(&candidate, free_balance); assert_ok!(Pallet::::join_candidates( T::RuntimeOrigin::from(Some(candidate.clone()).into()), stake, @@ -591,7 +602,7 @@ benchmarks! { claim_rewards { let beneficiary = account("beneficiary", 0, 0); let amount = T::MinCollatorCandidateStake::get(); - T::Currency::make_free_balance_be(&beneficiary, amount); + T::Currency::set_balance(&beneficiary, amount); Rewards::::insert(&beneficiary, amount); assert_eq!(pallet_balances::Pallet::::usable_balance(&beneficiary), amount.into()); let origin = RawOrigin::Signed(beneficiary.clone()); diff --git a/pallets/parachain-staking/src/default_weights.rs b/pallets/parachain-staking/src/default_weights.rs index a7fc05e9ad..11dc1bd1b9 100644 --- a/pallets/parachain-staking/src/default_weights.rs +++ b/pallets/parachain-staking/src/default_weights.rs @@ -68,7 +68,7 @@ pub trait WeightInfo { fn delegator_stake_more(n: u32, m: u32, u: u32, ) -> Weight; fn delegator_stake_less(n: u32, m: u32, ) -> Weight; fn leave_delegators(n: u32, m: u32, ) -> Weight; - fn unfreeze_unstaked(u: u32, ) -> Weight; + fn unlock_unstaked(u: u32, ) -> Weight; fn set_max_candidate_stake() -> Weight; fn increment_delegator_rewards() -> Weight; fn increment_collator_rewards() -> Weight; @@ -609,7 +609,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) /// The range of component `u` is `[1, 9]`. - fn unfreeze_unstaked(u: u32, ) -> Weight { + fn unlock_unstaked(u: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1488 + u * (24 ±0)` // Estimated: `9137` diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index c17c84c1da..adca534a60 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -148,8 +148,11 @@ pub mod pallet { pallet_prelude::*, storage::bounded_btree_map::BoundedBTreeMap, traits::{ - tokens::fungible::MutateFreeze, Currency, EstimateNextSessionRotation, Get, Imbalance, LockIdentifier, - LockableCurrency, OnUnbalanced, StorageVersion, + tokens::{ + fungible::{Inspect, MutateFreeze, Unbalanced}, + Fortitude, Precision, Preservation, + }, + Currency, EstimateNextSessionRotation, Get, LockIdentifier, LockableCurrency, OnUnbalanced, StorageVersion, }, BoundedVec, }; @@ -164,6 +167,7 @@ pub mod pallet { }; use sp_staking::SessionIndex; use sp_std::prelude::*; + use types::AccountIdOf; use crate::{ set::OrderedSet, @@ -193,7 +197,8 @@ pub mod pallet { // multiplication /// The currency type /// Note: Declaration of Balance taken from pallet_gilt - type Currency: Currency + type Currency: Inspect + + Unbalanced + MutateFreeze + LockableCurrency + Eq; @@ -227,7 +232,7 @@ pub mod pallet { type DefaultBlocksPerRound: Get; /// Number of blocks for which unstaked balance will still be locked /// before it can be unlocked by actively calling the extrinsic - /// `unfreeze_unstaked`. + /// `unlock_unstacked`. #[pallet::constant] type StakeDuration: Get; /// Number of rounds a collator has to stay active after submitting a @@ -689,7 +694,7 @@ pub mod pallet { // Setup delegate & collators for &(ref actor, ref opt_val, balance) in &self.stakers { assert!( - T::Currency::free_balance(actor) >= balance, + T::Currency::reducible_balance(actor, Preservation::Expendable, Fortitude::Polite) >= balance, "Account does not have enough balance to stake." ); if let Some(delegated_val) = opt_val { @@ -901,7 +906,7 @@ pub mod pallet { /// delegators. /// /// Prepares unstaking of the candidates and their delegators stake - /// which can be unfreezed via `unfreeze_unstaked` after waiting at + /// which can be unfreezed via `unlock_unstacked` after waiting at /// least `StakeDuration` many blocks. Also increments rewards for the /// collator and their delegators. /// @@ -1091,7 +1096,7 @@ pub mod pallet { /// Execute the network exit of a candidate who requested to leave at /// least `ExitQueueDelay` rounds ago. Prepares unstaking of the /// candidates and their delegators stake which can be unfreezed via - /// `unfreeze_unstaked` after waiting at least `StakeDuration` many + /// `unlock_unstacked` after waiting at least `StakeDuration` many /// blocks. /// /// Requires the candidate to previously have called @@ -1345,7 +1350,7 @@ pub mod pallet { // check balance ensure!( - pallet_balances::Pallet::::free_balance(acc.clone()) >= amount.into(), + pallet_balances::Pallet::::balance(&acc) >= amount.into(), pallet_balances::Error::::InsufficientBalance ); @@ -1667,9 +1672,10 @@ pub mod pallet { ensure!(!rewards.is_zero(), Error::::RewardsNotFound); // mint into target - let rewards = T::Currency::deposit_into_existing(&target, rewards)?; + let rewards = + >>::increase_balance(&target, rewards, Precision::Exact)?; - Self::deposit_event(Event::Rewarded(target, rewards.peek())); + Self::deposit_event(Event::Rewarded(target, rewards)); Ok(()) } @@ -2153,7 +2159,13 @@ pub mod pallet { /// amount and updates `Unstaking` storage accordingly. fn increase_lock(who: &T::AccountId, amount: BalanceOf, more: BalanceOf) -> Result { ensure!( - pallet_balances::Pallet::::free_balance(who) >= amount.into(), + pallet_balances::Pallet::::reducible_balance(who, Preservation::Preserve, Fortitude::Polite) + >= more.into(), + pallet_balances::Error::::InsufficientBalance + ); + + ensure!( + >>::total_balance(who) >= amount, pallet_balances::Error::::InsufficientBalance ); @@ -2195,7 +2207,7 @@ pub mod pallet { } /// Set the unlocking block for the account and corresponding amount - /// which can be unfreezed via `unfreeze_unstaked` after waiting at + /// which can be unfreezed via `unlock_unstacked` after waiting at /// least for `StakeDuration` many blocks. /// /// Throws if the amount is zero (unlikely) or if active unlocking @@ -2387,7 +2399,7 @@ pub mod pallet { /// Depends on the current total issuance and staking reward /// configuration for collators. pub(crate) fn calc_block_rewards_collator(stake: BalanceOf, multiplier: BalanceOf) -> BalanceOf { - let total_issuance = T::Currency::total_issuance(); + let total_issuance = >>::total_issuance(); let TotalStake { collators: total_collators, .. @@ -2405,7 +2417,7 @@ pub mod pallet { /// Depends on the current total issuance and staking reward /// configuration for delegators. pub(crate) fn calc_block_rewards_delegator(stake: BalanceOf, multiplier: BalanceOf) -> BalanceOf { - let total_issuance = T::Currency::total_issuance(); + let total_issuance = >>::total_issuance(); let TotalStake { delegators: total_delegators, .. diff --git a/pallets/parachain-staking/src/tests.rs b/pallets/parachain-staking/src/tests.rs index 4098ab33ee..78dc1560d8 100644 --- a/pallets/parachain-staking/src/tests.rs +++ b/pallets/parachain-staking/src/tests.rs @@ -993,10 +993,10 @@ fn multiple_delegations() { roll_to(37, vec![Some(1), Some(2)]); assert!(StakePallet::delegator_state(8).is_none()); assert!(StakePallet::delegator_state(17).is_none()); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(8), 8)); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(17), 17)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(8), 8)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(17), 17)); assert_noop!( - StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(12), 12), + StakePallet::unlock_unstaked(RuntimeOrigin::signed(12), 12), Error::::UnstakingIsEmpty ); assert_eq!(Balances::usable_balance(17), 100); @@ -1561,7 +1561,7 @@ fn delegator_should_not_receive_rewards_after_revoking() { assert_eq!(Balances::usable_balance(2), Balance::zero()); roll_to_claim_rewards(100, authors); assert!(Balances::usable_balance(1) > Balance::zero()); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(Balances::usable_balance(2), 10_000_000 * DECIMALS); }); @@ -1584,7 +1584,7 @@ fn delegator_should_not_receive_rewards_after_revoking() { roll_to_claim_rewards(100, authors); assert!(Balances::usable_balance(1) > Balance::zero()); assert!(Balances::usable_balance(2) > Balance::zero()); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(3), 3)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(3), 3)); assert_eq!(Balances::usable_balance(3), 10_000_000 * DECIMALS); }); } @@ -2135,7 +2135,7 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![freeze.clone()]); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![freeze.clone()]); @@ -2148,7 +2148,7 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![freeze.clone()]); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![freeze.clone()]); @@ -2157,7 +2157,7 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![freeze.clone()]); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![freeze.clone()]); @@ -2165,7 +2165,7 @@ fn unlock_unstaked() { unstaking.remove(&4); assert_eq!(Freezes::::get(2), vec![freeze]); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![]); }); @@ -2191,7 +2191,7 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); @@ -2205,7 +2205,7 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); @@ -2213,7 +2213,7 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); @@ -2221,7 +2221,7 @@ fn unlock_unstaked() { roll_to(4, vec![]); unstaking.remove(&4); assert_eq!(Freezes::::get(2), vec![lock]); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![]); }); @@ -2249,7 +2249,7 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); @@ -2262,7 +2262,7 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); @@ -2271,7 +2271,7 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![lock.clone()]); // should be able to unlock 90 of 100 from unstaking - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); unstaking.remove(&3); lock.amount = 10; assert_eq!(StakePallet::unstaking(2), unstaking); @@ -2280,7 +2280,7 @@ fn unlock_unstaked() { roll_to(4, vec![]); assert_eq!(Freezes::::get(2), vec![lock]); // should be able to unlock 10 of remaining 10 - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); unstaking.remove(&4); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(2), vec![]); @@ -2325,8 +2325,8 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(1), unstaking); assert_eq!(StakePallet::unstaking(2), unstaking); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(1), 1)); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(1), 1)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(1), unstaking); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(1), vec![lock.clone()]); @@ -2341,8 +2341,8 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(1), unstaking); assert_eq!(StakePallet::unstaking(2), unstaking); // shouldn't be able to unlock anything - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(1), 1)); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(1), 1)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); assert_eq!(StakePallet::unstaking(1), unstaking); assert_eq!(StakePallet::unstaking(2), unstaking); assert_eq!(Freezes::::get(1), vec![lock.clone()]); @@ -2358,8 +2358,8 @@ fn unlock_unstaked() { assert_eq!(StakePallet::unstaking(1), unstaking); assert_eq!(StakePallet::unstaking(2), unstaking); // should unlock 60 - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(1), 1)); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(1), 1)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); lock.amount = 140; unstaking.remove(&3); assert_eq!(StakePallet::unstaking(1), unstaking); @@ -2394,8 +2394,8 @@ fn unlock_unstaked() { StakePallet::delegator_stake_less(RuntimeOrigin::signed(2), 10), Error::::NoMoreUnstaking ); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(1), 1)); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(2), 2)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(1), 1)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(2), 2)); unstaking.remove(&4); unstaking.remove(&5); unstaking.remove(&6); @@ -2451,7 +2451,7 @@ fn kick_candidate_with_full_unstaking() { StakePallet::join_candidates(RuntimeOrigin::signed(3), 100), Error::::CannotJoinBeforeUnlocking ); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(3), 3)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(3), 3)); assert_ok!(StakePallet::join_candidates(RuntimeOrigin::signed(3), 100)); }); } @@ -2497,7 +2497,7 @@ fn kick_delegator_with_full_unstaking() { StakePallet::join_delegators(RuntimeOrigin::signed(5), 1, 100), Error::::CannotJoinBeforeUnlocking ); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(5), 5)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(5), 5)); assert_ok!(StakePallet::join_delegators(RuntimeOrigin::signed(5), 1, 220)); }); } @@ -2643,16 +2643,16 @@ fn candidate_leaves() { // cannot unlock yet roll_to(16, vec![]); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(4), 1)); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(4), 12)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(4), 1)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(4), 12)); assert_eq!(StakePallet::unstaking(1), unstaking); assert_eq!(StakePallet::unstaking(12), unstaking); // can unlock now roll_to(17, vec![]); unstaking.remove(&17); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(4), 1)); - assert_ok!(StakePallet::unfreeze_unstaked(RuntimeOrigin::signed(4), 12)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(4), 1)); + assert_ok!(StakePallet::unlock_unstaked(RuntimeOrigin::signed(4), 12)); assert_eq!(StakePallet::unstaking(1), unstaking); assert_eq!(StakePallet::unstaking(12), unstaking); }); diff --git a/runtimes/peregrine/src/weights/parachain_staking.rs b/runtimes/peregrine/src/weights/parachain_staking.rs index 4df4fddf5d..0300cb1bfb 100644 --- a/runtimes/peregrine/src/weights/parachain_staking.rs +++ b/runtimes/peregrine/src/weights/parachain_staking.rs @@ -921,7 +921,7 @@ mod tests { ); } #[test] - fn test_unfreeze_unstaked() { + fn test_unlock_unstaked() { assert!( ::BlockWeights::get() .per_class From dd74a5b9151aee076f8f16bf93a9b3e13b4e6017 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Sat, 3 Jun 2023 12:21:43 +0200 Subject: [PATCH 38/99] remove not used function --- support/src/migration.rs | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/support/src/migration.rs b/support/src/migration.rs index 3e97b43b8f..509322a2dd 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -19,11 +19,8 @@ use frame_support::{ pallet_prelude::DispatchResult, traits::{ - fungible::{ - freeze::{Inspect as InspectFreeze, Mutate as MutateFreeze}, - hold::{Inspect as InspectHold, Mutate as MutateHold}, - }, - LockIdentifier, LockableCurrency, ReservableCurrency, + fungible::hold::{Inspect as InspectHold, Mutate as MutateHold}, + ReservableCurrency, }, }; use sp_runtime::SaturatedConversion; @@ -42,16 +39,6 @@ pub fn has_user_holds< && Currency::reserved_balance(owner).saturated_into::() > 0 } -pub fn has_user_freezes< - AccountId, - Currency: ReservableCurrency + MutateFreeze + InspectFreeze, ->( - owner: &AccountId, - reason: &HFIdentifier, -) -> bool { - Currency::balance_frozen(reason, owner).saturated_into::() > 0 -} - pub fn switch_reserved_to_hold< AccountId, Currency: ReservableCurrency + MutateHold + InspectHold, @@ -63,16 +50,3 @@ pub fn switch_reserved_to_hold< Currency::unreserve(&owner, amount.saturated_into()); Currency::hold(reason, &owner, amount.saturated_into()) } - -pub fn switch_locks_to_freeze< - AccountId, - Currency: LockableCurrency + MutateFreeze, ->( - who: &AccountId, - id_lock: LockIdentifier, - id_freeze: &HFIdentifier, - amount: u128, -) -> DispatchResult { - Currency::remove_lock(id_lock, who); - Currency::set_freeze(id_freeze, who, amount.saturated_into()) -} From e912064ba484a2774a57c2bfb2ca72e1c06e18d2 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Sat, 3 Jun 2023 12:24:42 +0200 Subject: [PATCH 39/99] remove trait --- support/src/migration.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/support/src/migration.rs b/support/src/migration.rs index 509322a2dd..64a5e928c7 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -18,10 +18,7 @@ use frame_support::{ pallet_prelude::DispatchResult, - traits::{ - fungible::hold::{Inspect as InspectHold, Mutate as MutateHold}, - ReservableCurrency, - }, + traits::{fungible::hold::Mutate as MutateHold, ReservableCurrency}, }; use sp_runtime::SaturatedConversion; @@ -30,7 +27,7 @@ use crate::deposit::HFIdentifier; /// Checks some precondition of the migrations. pub fn has_user_holds< AccountId, - Currency: ReservableCurrency + MutateHold + InspectHold, + Currency: ReservableCurrency + MutateHold, >( owner: &AccountId, reason: &HFIdentifier, @@ -41,7 +38,7 @@ pub fn has_user_holds< pub fn switch_reserved_to_hold< AccountId, - Currency: ReservableCurrency + MutateHold + InspectHold, + Currency: ReservableCurrency + MutateHold, >( owner: AccountId, reason: &HFIdentifier, From 0e15d56dc24b68f675c62771c908f5bcc0233ca6 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Sat, 3 Jun 2023 13:12:55 +0200 Subject: [PATCH 40/99] remove free_balance and reserved_balance --- pallets/pallet-did-lookup/src/tests.rs | 53 +++++++++------ pallets/pallet-inflation/src/tests.rs | 15 +++-- pallets/pallet-web3-names/src/tests.rs | 48 ++++++++------ pallets/parachain-staking/src/tests.rs | 85 ++++++++++++------------- pallets/public-credentials/src/tests.rs | 51 +++++++++++---- 5 files changed, 153 insertions(+), 99 deletions(-) diff --git a/pallets/pallet-did-lookup/src/tests.rs b/pallets/pallet-did-lookup/src/tests.rs index 47a1f0997d..b9567a0403 100644 --- a/pallets/pallet-did-lookup/src/tests.rs +++ b/pallets/pallet-did-lookup/src/tests.rs @@ -16,8 +16,11 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{assert_noop, assert_ok, crypto::ecdsa::ECDSAExt}; -use kilt_support::{deposit::Deposit, mock::mock_origin}; +use frame_support::{assert_noop, assert_ok, crypto::ecdsa::ECDSAExt, traits::fungible::InspectHold}; +use kilt_support::{ + deposit::{Deposit, HFIdentifier, Pallets}, + mock::mock_origin, +}; use parity_scale_codec::Encode; use sha3::{Digest, Keccak256}; use sp_runtime::{ @@ -57,7 +60,7 @@ fn test_add_association_sender() { ); assert!(ConnectedAccounts::::get(DID_00, LINKABLE_ACCOUNT_00).is_some()); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), ::Deposit::get() ); @@ -76,7 +79,7 @@ fn test_add_association_sender() { assert!(ConnectedAccounts::::get(DID_00, LINKABLE_ACCOUNT_00).is_none()); assert!(ConnectedAccounts::::get(DID_01, LINKABLE_ACCOUNT_00).is_some()); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), ::Deposit::get() ); }); @@ -121,7 +124,7 @@ fn test_add_association_account() { ConnectedAccounts::::get(DID_00, LinkableAccountId::from(account_hash_alice.clone())).is_some() ); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), ::Deposit::get() ); @@ -152,7 +155,7 @@ fn test_add_association_account() { ConnectedAccounts::::get(DID_01, LinkableAccountId::from(account_hash_alice.clone())).is_some() ); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), ::Deposit::get() ); @@ -177,9 +180,12 @@ fn test_add_association_account() { ConnectedAccounts::::get(DID_00, LinkableAccountId::from(account_hash_alice.clone())).is_none() ); assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(account_hash_alice)).is_some()); - assert_eq!(Balances::reserved_balance(ACCOUNT_00), 0); assert_eq!( - Balances::reserved_balance(ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + 0 + ); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), ::Deposit::get() ); }); @@ -223,7 +229,7 @@ fn test_add_eth_association() { ); assert!(ConnectedAccounts::::get(DID_00, LinkableAccountId::from(eth_account)).is_some()); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), ::Deposit::get() ); }); @@ -294,7 +300,10 @@ fn test_remove_association_sender() { assert!(DidLookup::remove_sender_association(RuntimeOrigin::signed(ACCOUNT_00)).is_ok()); assert_eq!(ConnectedDids::::get(LinkableAccountId::from(ACCOUNT_00)), None); assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(ACCOUNT_00)).is_none()); - assert_eq!(Balances::reserved_balance(ACCOUNT_00), 0); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + 0 + ); }); } @@ -329,7 +338,10 @@ fn test_remove_association_account() { .is_ok()); assert_eq!(ConnectedDids::::get(LinkableAccountId::from(ACCOUNT_00)), None); assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(ACCOUNT_00)).is_none()); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), 0); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), + 0 + ); }); } @@ -370,7 +382,7 @@ fn test_remove_association_account_not_authorized() { Error::::NotAuthorized ); assert_eq!( - Balances::reserved_balance(ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), ::Deposit::get() ); }); @@ -389,7 +401,10 @@ fn test_reclaim_deposit() { RuntimeOrigin::signed(ACCOUNT_01), ACCOUNT_00.into() )); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), 0); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), + 0 + ); }); } @@ -407,7 +422,7 @@ fn test_reclaim_deposit_not_authorized() { Error::::NotAuthorized ); assert_eq!( - Balances::reserved_balance(ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), ::Deposit::get() ); }); @@ -429,9 +444,9 @@ fn test_change_deposit_owner() { mock_origin::DoubleOrigin(ACCOUNT_01, DID_00).into(), ACCOUNT_00.into() )); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00).is_zero()); assert_eq!( - Balances::reserved_balance(ACCOUNT_01), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), ::Deposit::get() ); }) @@ -499,7 +514,7 @@ fn test_update_deposit() { ::Deposit::get() * 2, ); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_ok!(DidLookup::update_deposit( @@ -507,7 +522,7 @@ fn test_update_deposit() { ACCOUNT_00.into() )); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), ::Deposit::get() ); }) @@ -528,7 +543,7 @@ fn test_update_deposit_unauthorized() { ::Deposit::get() * 2, ); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_noop!( diff --git a/pallets/pallet-inflation/src/tests.rs b/pallets/pallet-inflation/src/tests.rs index a44678dffe..12c92c2370 100644 --- a/pallets/pallet-inflation/src/tests.rs +++ b/pallets/pallet-inflation/src/tests.rs @@ -16,6 +16,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org +use frame_support::traits::fungible::Inspect; use sp_runtime::traits::Zero; use crate::{mock::*, pallet::Config}; @@ -23,12 +24,12 @@ use crate::{mock::*, pallet::Config}; #[test] fn during_initial_period() { new_test_ext().execute_with(|| { - assert!(Balances::free_balance(&TREASURY_ACC).is_zero()); + assert!(Balances::balance(&TREASURY_ACC).is_zero()); assert!(::Currency::total_issuance().is_zero()); roll_to(1); assert_eq!( - Balances::free_balance(&TREASURY_ACC), + Balances::balance(&TREASURY_ACC), ::InitialPeriodReward::get() ); assert_eq!( @@ -38,7 +39,7 @@ fn during_initial_period() { roll_to(2); assert_eq!( - Balances::free_balance(&TREASURY_ACC), + Balances::balance(&TREASURY_ACC), 2 * ::InitialPeriodReward::get() ); assert_eq!( @@ -48,7 +49,7 @@ fn during_initial_period() { roll_to(100); assert_eq!( - Balances::free_balance(&TREASURY_ACC), + Balances::balance(&TREASURY_ACC), 100 * ::InitialPeriodReward::get() ); assert_eq!( @@ -61,16 +62,16 @@ fn during_initial_period() { #[test] fn after_initial_period() { new_test_ext().execute_with(|| { - assert!(Balances::free_balance(&TREASURY_ACC).is_zero()); + assert!(Balances::balance(&TREASURY_ACC).is_zero()); assert!(::Currency::total_issuance().is_zero()); System::set_block_number(::InitialPeriodLength::get()); roll_to(::InitialPeriodLength::get() + 1); - assert!(Balances::free_balance(&TREASURY_ACC).is_zero()); + assert!(Balances::balance(&TREASURY_ACC).is_zero()); assert!(::Currency::total_issuance().is_zero()); roll_to(::InitialPeriodLength::get() + 100); - assert!(Balances::free_balance(&TREASURY_ACC).is_zero()); + assert!(Balances::balance(&TREASURY_ACC).is_zero()); assert!(::Currency::total_issuance().is_zero()); }); } diff --git a/pallets/pallet-web3-names/src/tests.rs b/pallets/pallet-web3-names/src/tests.rs index 4c23dbe2bd..d45075a19c 100644 --- a/pallets/pallet-web3-names/src/tests.rs +++ b/pallets/pallet-web3-names/src/tests.rs @@ -16,10 +16,17 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{assert_noop, assert_ok, BoundedVec}; +use frame_support::{ + assert_noop, assert_ok, + traits::fungible::{Inspect, InspectHold}, + BoundedVec, +}; use frame_system::RawOrigin; -use kilt_support::{deposit::Deposit, mock::mock_origin}; +use kilt_support::{ + deposit::{Deposit, HFIdentifier, Pallets}, + mock::mock_origin, +}; use sp_runtime::{traits::Zero, DispatchError, TokenError}; use crate::{mock::*, Banned, Config, Error, Names, Owner, Pallet, Web3OwnershipOf}; @@ -36,7 +43,7 @@ fn claiming_successful() { .build_and_execute_with_sanity_tests(|| { assert!(Names::::get(&DID_00).is_none()); assert!(Owner::::get(&web3_name_00).is_none()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00).is_zero()); assert_ok!(Pallet::::claim( mock_origin::DoubleOrigin(ACCOUNT_00, DID_00).into(), @@ -60,11 +67,11 @@ fn claiming_successful() { } ); // Test that the deposit was reserved correctly. - assert_eq!(Balances::reserved_balance(ACCOUNT_00), Web3NameDeposit::get()); assert_eq!( - Balances::free_balance(ACCOUNT_00), - initial_balance - Web3NameDeposit::get(), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00), + Web3NameDeposit::get() ); + assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance - Web3NameDeposit::get(),); // Test that the same name cannot be claimed again. assert_noop!( @@ -172,8 +179,8 @@ fn releasing_by_owner_successful() { assert!(Owner::::get(&web3_name_00).is_none()); // Test that the deposit was returned to the payer correctly. - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert_eq!(Balances::free_balance(ACCOUNT_00), initial_balance); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00).is_zero()); + assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance); }) } @@ -192,10 +199,9 @@ fn releasing_by_payer_successful() { )); assert!(Names::::get(&DID_00).is_none()); assert!(Owner::::get(&web3_name_00).is_none()); - // Test that the deposit was returned to the payer correctly. - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert_eq!(Balances::free_balance(ACCOUNT_00), initial_balance); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00).is_zero()); + assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance); }) } @@ -265,8 +271,8 @@ fn banning_successful() { assert!(Owner::::get(&web3_name_00).is_none()); assert!(Banned::::get(&web3_name_00).is_some()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert_eq!(Balances::free_balance(ACCOUNT_00), initial_balance); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00).is_zero()); + assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance); // Ban an unclaimed name assert_ok!(Pallet::::ban(RawOrigin::Root.into(), web3_name_01.clone().0)); @@ -385,8 +391,11 @@ fn test_change_deposit_owner() { amount: ::Deposit::get() } ); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); + assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00).is_zero()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_01), + ::Deposit::get() + ); }) } @@ -435,7 +444,7 @@ fn test_update_deposit() { ::Deposit::get() * 2, ); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_ok!(Pallet::::update_deposit( @@ -451,7 +460,10 @@ fn test_update_deposit() { amount: ::Deposit::get() } ); - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00), + ::Deposit::get() + ); }) } @@ -470,7 +482,7 @@ fn test_update_deposit_unauthorized() { ::Deposit::get() * 2, ); assert_eq!( - Balances::reserved_balance(ACCOUNT_00), + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_noop!( diff --git a/pallets/parachain-staking/src/tests.rs b/pallets/parachain-staking/src/tests.rs index 78dc1560d8..e49511069d 100644 --- a/pallets/parachain-staking/src/tests.rs +++ b/pallets/parachain-staking/src/tests.rs @@ -117,7 +117,7 @@ fn genesis() { // 1 assert_eq!(Balances::usable_balance(1), 500); - assert_eq!(Balances::free_balance(1), 1000); + assert_eq!(Balances::balance(&1), 1000); assert!(StakePallet::is_active_candidate(&1).is_some()); assert_eq!( StakePallet::candidate_pool(1), @@ -140,7 +140,7 @@ fn genesis() { ); // 2 assert_eq!(Balances::usable_balance(2), 100); - assert_eq!(Balances::free_balance(2), 300); + assert_eq!(Balances::balance(&2), 300); assert!(StakePallet::is_active_candidate(&2).is_some()); assert_eq!( StakePallet::candidate_pool(2), @@ -172,17 +172,17 @@ fn genesis() { for x in 3..7 { assert!(StakePallet::is_delegator(&x)); assert_eq!(Balances::usable_balance(x), 0); - assert_eq!(Balances::free_balance(x), 100); + assert_eq!(Balances::balance(&x), 100); } // Uninvolved for x in 7..10 { assert!(!StakePallet::is_delegator(&x)); } - assert_eq!(Balances::free_balance(7), 100); + assert_eq!(Balances::balance(&7), 100); assert_eq!(Balances::usable_balance(7), 100); - assert_eq!(Balances::free_balance(8), 9); + assert_eq!(Balances::balance(&8), 9); assert_eq!(Balances::usable_balance(8), 9); - assert_eq!(Balances::free_balance(9), 4); + assert_eq!(Balances::balance(&9), 4); assert_eq!(Balances::usable_balance(9), 4); // Safety first checks @@ -235,16 +235,16 @@ fn genesis() { ); for x in 1..5 { assert!(StakePallet::is_active_candidate(&x).is_some()); - assert_eq!(Balances::free_balance(x), 100); + assert_eq!(Balances::balance(&x), 100); assert_eq!(Balances::usable_balance(x), 80); } assert!(StakePallet::is_active_candidate(&5).is_some()); - assert_eq!(Balances::free_balance(5), 100); + assert_eq!(Balances::balance(&5), 100); assert_eq!(Balances::usable_balance(5), 90); // Delegators for x in 6..11 { assert!(StakePallet::is_delegator(&x)); - assert_eq!(Balances::free_balance(x), 100); + assert_eq!(Balances::balance(&x), 100); assert_eq!(Balances::usable_balance(x), 90); } @@ -1290,7 +1290,7 @@ fn delegators_bond() { assert_ok!(StakePallet::execute_leave_candidates(RuntimeOrigin::signed(1), 1)); assert!(!StakePallet::is_delegator(&6)); assert_eq!(Balances::usable_balance(6), 80); - assert_eq!(Balances::free_balance(6), 100); + assert_eq!(Balances::balance(&6), 100); }); } @@ -1615,11 +1615,11 @@ fn coinbase_rewards_many_blocks_simple_check() { let authors: Vec> = (0u64..=end_block).map(|i| Some(i % 2 + 1)).collect(); roll_to_claim_rewards(end_block, authors); - let rewards_1 = Balances::free_balance(1).saturating_sub(40_000_000 * DECIMALS); - let rewards_2 = Balances::free_balance(2).saturating_sub(40_000_000 * DECIMALS); - let rewards_3 = Balances::free_balance(3).saturating_sub(40_000_000 * DECIMALS); - let rewards_4 = Balances::free_balance(4).saturating_sub(20_000_000 * DECIMALS); - let rewards_5 = Balances::free_balance(5).saturating_sub(20_000_000 * DECIMALS); + let rewards_1 = Balances::balance(&1).saturating_sub(40_000_000 * DECIMALS); + let rewards_2 = Balances::balance(&2).saturating_sub(40_000_000 * DECIMALS); + let rewards_3 = Balances::balance(&3).saturating_sub(40_000_000 * DECIMALS); + let rewards_4 = Balances::balance(&4).saturating_sub(20_000_000 * DECIMALS); + let rewards_5 = Balances::balance(&5).saturating_sub(20_000_000 * DECIMALS); let expected_collator_rewards = num_of_years * inflation.collator.reward_rate.annual * 16_000_000 * DECIMALS; let expected_delegator_rewards = @@ -2673,8 +2673,8 @@ fn adjust_reward_rates() { // reward once in first year roll_to_claim_rewards(2, authors.clone()); - let c_rewards_0 = Balances::free_balance(1).saturating_sub(10_000_000 * DECIMALS); - let d_rewards_0 = Balances::free_balance(2).saturating_sub(90_000_000 * DECIMALS); + let c_rewards_0 = Balances::balance(&1).saturating_sub(10_000_000 * DECIMALS); + let d_rewards_0 = Balances::balance(&2).saturating_sub(90_000_000 * DECIMALS); assert!(!c_rewards_0.is_zero()); assert!(!d_rewards_0.is_zero()); @@ -2695,10 +2695,10 @@ fn adjust_reward_rates() { assert_eq!(StakePallet::inflation_config(), inflation_1); // reward once in 2nd year roll_to_claim_rewards(::BLOCKS_PER_YEAR + 2, authors.clone()); - let c_rewards_1 = Balances::free_balance(1) + let c_rewards_1 = Balances::balance(&1) .saturating_sub(10_000_000 * DECIMALS) .saturating_sub(c_rewards_0); - let d_rewards_1 = Balances::free_balance(2) + let d_rewards_1 = Balances::balance(&2) .saturating_sub(90_000_000 * DECIMALS) .saturating_sub(d_rewards_0); assert!( @@ -2726,13 +2726,13 @@ fn adjust_reward_rates() { assert_eq!(StakePallet::inflation_config(), inflation_2); // reward once in 3rd year roll_to_claim_rewards(2 * ::BLOCKS_PER_YEAR + 2, authors); - let c_rewards_2 = Balances::free_balance(1) + let c_rewards_2 = Balances::balance(&1) .saturating_sub(10_000_000 * DECIMALS) .saturating_sub(c_rewards_0) .saturating_sub(c_rewards_1); assert!(c_rewards_1 > c_rewards_2); // should be zero because we set reward rate to zero - let d_rewards_2 = Balances::free_balance(2) + let d_rewards_2 = Balances::balance(&2) .saturating_sub(90_000_000 * DECIMALS) .saturating_sub(d_rewards_0) .saturating_sub(d_rewards_1); @@ -3246,7 +3246,7 @@ fn authorities_per_round() { // roll to last block of round 0 roll_to_claim_rewards(4, authors.clone()); let reward_0 = inflation.collator.reward_rate.per_block * stake * 2; - assert_eq!(Balances::free_balance(1), stake + reward_0); + assert_eq!(Balances::balance(&1), stake + reward_0); // increase max selected candidates which will become effective in round 2 assert_ok!(StakePallet::set_max_selected_candidates(RuntimeOrigin::root(), 10)); @@ -3255,22 +3255,19 @@ fn authorities_per_round() { // round 1 roll_to_claim_rewards(9, authors.clone()); let reward_1 = inflation.collator.reward_rate.per_block * stake * 2; - assert_eq!(Balances::free_balance(1), stake + reward_0 + reward_1); + assert_eq!(Balances::balance(&1), stake + reward_0 + reward_1); // roll to last block of round 2 // should multiply with 4 because there are only 4 candidates roll_to_claim_rewards(14, authors.clone()); let reward_2 = inflation.collator.reward_rate.per_block * stake * 4; - assert_eq!(Balances::free_balance(1), stake + reward_0 + reward_1 + reward_2); + assert_eq!(Balances::balance(&1), stake + reward_0 + reward_1 + reward_2); // roll to last block of round 3 // should multiply with 4 because there are only 4 candidates roll_to_claim_rewards(19, authors); let reward_3 = inflation.collator.reward_rate.per_block * stake * 4; - assert_eq!( - Balances::free_balance(1), - stake + reward_0 + reward_1 + reward_2 + reward_3 - ); + assert_eq!(Balances::balance(&1), stake + reward_0 + reward_1 + reward_2 + reward_3); }); } @@ -3411,13 +3408,13 @@ fn network_reward_multiple_blocks() { assert_eq!(max_stake, StakePallet::max_candidate_stake()); let total_collator_stake = max_stake.saturating_mul(::MinCollators::get().into()); assert_eq!(total_collator_stake, StakePallet::total_collator_stake().collators); - assert!(Balances::free_balance(TREASURY_ACC).is_zero()); + assert!(Balances::balance(&TREASURY_ACC).is_zero()); let total_issuance = ::Currency::total_issuance(); // total issuance should not increase when not noting authors because we haven't // reached NetworkRewardStart yet roll_to(10, vec![None]); - assert!(Balances::free_balance(TREASURY_ACC).is_zero()); + assert!(Balances::balance(&TREASURY_ACC).is_zero()); assert_eq!(total_issuance, ::Currency::total_issuance()); // set current block to one block before NetworkRewardStart @@ -3426,12 +3423,12 @@ fn network_reward_multiple_blocks() { // network rewards should only appear 1 block after start roll_to(network_reward_start, vec![None]); - assert!(Balances::free_balance(TREASURY_ACC).is_zero()); + assert!(Balances::balance(&TREASURY_ACC).is_zero()); assert_eq!(total_issuance, ::Currency::total_issuance()); // should mint to treasury now roll_to(network_reward_start + 1, vec![None]); - let network_reward = Balances::free_balance(TREASURY_ACC); + let network_reward = Balances::balance(&TREASURY_ACC); assert!(!network_reward.is_zero()); assert_eq!( total_issuance + network_reward, @@ -3443,7 +3440,7 @@ fn network_reward_multiple_blocks() { // should mint exactly the same amount roll_to(network_reward_start + 2, vec![None]); - assert_eq!(2 * network_reward, Balances::free_balance(TREASURY_ACC)); + assert_eq!(2 * network_reward, Balances::balance(&TREASURY_ACC)); assert_eq!( total_issuance + 2 * network_reward, ::Currency::total_issuance() @@ -3451,7 +3448,7 @@ fn network_reward_multiple_blocks() { // should mint exactly the same amount in each block roll_to(network_reward_start + 100, vec![None]); - assert_eq!(100 * network_reward, Balances::free_balance(TREASURY_ACC)); + assert_eq!(100 * network_reward, Balances::balance(&TREASURY_ACC)); assert_eq!( total_issuance + 100 * network_reward, ::Currency::total_issuance() @@ -3461,7 +3458,7 @@ fn network_reward_multiple_blocks() { // based on MaxCollatorCandidateStake and MaxSelectedCandidates assert_ok!(StakePallet::init_leave_candidates(RuntimeOrigin::signed(1))); roll_to(network_reward_start + 101, vec![None]); - assert_eq!(101 * network_reward, Balances::free_balance(TREASURY_ACC)); + assert_eq!(101 * network_reward, Balances::balance(&TREASURY_ACC)); assert_eq!( total_issuance + 101 * network_reward, ::Currency::total_issuance() @@ -3486,7 +3483,7 @@ fn network_reward_increase_max_candidate_stake() { // should mint to treasury now roll_to(network_reward_start + 1, vec![None]); - let reward_before = Balances::free_balance(TREASURY_ACC); + let reward_before = Balances::balance(&TREASURY_ACC); assert!(!reward_before.is_zero()); assert_eq!( total_issuance + reward_before, @@ -3501,7 +3498,7 @@ fn network_reward_increase_max_candidate_stake() { max_stake_doubled )); roll_to(network_reward_start + 2, vec![None]); - assert_eq!(reward_before + reward_after, Balances::free_balance(TREASURY_ACC)); + assert_eq!(reward_before + reward_after, Balances::balance(&TREASURY_ACC)); assert_eq!( reward_before + reward_after + total_issuance, ::Currency::total_issuance() @@ -3526,7 +3523,7 @@ fn network_reward_increase_max_collator_count() { // should mint to treasury now roll_to(network_reward_start + 1, vec![None]); - let reward_before = Balances::free_balance(TREASURY_ACC); + let reward_before = Balances::balance(&TREASURY_ACC); assert!(!reward_before.is_zero()); assert_eq!( total_issuance + reward_before, @@ -3540,7 +3537,7 @@ fn network_reward_increase_max_collator_count() { ::MinCollators::get() * 3 )); roll_to(network_reward_start + 2, vec![None]); - assert_eq!(reward_before + reward_after, Balances::free_balance(TREASURY_ACC)); + assert_eq!(reward_before + reward_after, Balances::balance(&TREASURY_ACC)); assert_eq!( reward_before + reward_after + total_issuance, ::Currency::total_issuance() @@ -4213,9 +4210,9 @@ fn rewards_incrementing_and_claiming() { assert_ok!(StakePallet::claim_rewards(RuntimeOrigin::signed(1))); assert!(StakePallet::rewards(1).is_zero()); // delegator situation should be unchanged - assert!(Balances::free_balance(1) > DECIMALS); - assert_eq!(Balances::free_balance(2), DECIMALS); - assert_eq!(Balances::free_balance(3), DECIMALS); + assert!(Balances::balance(&1) > DECIMALS); + assert_eq!(Balances::balance(&2), DECIMALS); + assert_eq!(Balances::balance(&3), DECIMALS); // incrementing again should not change anything because collator has not // authored blocks since last inc @@ -4223,9 +4220,9 @@ fn rewards_incrementing_and_claiming() { assert_eq!(StakePallet::blocks_rewarded(2), 2); // claim for 2 to move rewards into balance assert_ok!(StakePallet::claim_rewards(RuntimeOrigin::signed(2))); - assert!(Balances::free_balance(2) > DECIMALS); + assert!(Balances::balance(&2) > DECIMALS); assert!(StakePallet::rewards(2).is_zero()); - assert_eq!(Balances::free_balance(3), DECIMALS); + assert_eq!(Balances::balance(&3), DECIMALS); // should not be able to claim for incorrect role assert_noop!( diff --git a/pallets/public-credentials/src/tests.rs b/pallets/public-credentials/src/tests.rs index 471379fcb0..146c3c1b1c 100644 --- a/pallets/public-credentials/src/tests.rs +++ b/pallets/public-credentials/src/tests.rs @@ -16,11 +16,17 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{assert_noop, assert_ok, traits::Get}; +use frame_support::{ + assert_noop, assert_ok, + traits::{fungible::InspectHold, Get}, +}; use sp_runtime::traits::Zero; use ctype::mock::get_ctype_hash; -use kilt_support::{deposit::Deposit, mock::mock_origin::DoubleOrigin}; +use kilt_support::{ + deposit::{Deposit, HFIdentifier, Pallets}, + mock::mock_origin::DoubleOrigin, +}; use crate::{mock::*, Config, CredentialIdOf, CredentialSubjects, Credentials, Error, InputClaimsContentOf}; @@ -51,7 +57,9 @@ fn add_successful_without_authorization() { .with_ctypes(vec![(ctype_hash_1, attester.clone()), (ctype_hash_2, attester.clone())]) .build_and_execute_with_sanity_tests(|| { // Check for 0 reserved deposit - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00).is_zero() + ); assert_ok!(PublicCredentials::add( DoubleOrigin(ACCOUNT_00, attester.clone()).into(), @@ -69,7 +77,10 @@ fn add_successful_without_authorization() { assert_eq!(CredentialSubjects::::get(credential_id_1), Some(subject_id)); // Check deposit reservation logic - assert_eq!(Balances::reserved_balance(ACCOUNT_00), deposit); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00), + deposit + ); // Re-issuing the same credential will fail assert_noop!( @@ -81,7 +92,10 @@ fn add_successful_without_authorization() { ); // Check deposit has not changed - assert_eq!(Balances::reserved_balance(ACCOUNT_00), deposit); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00), + deposit + ); System::set_block_number(1); @@ -103,7 +117,10 @@ fn add_successful_without_authorization() { assert_eq!(CredentialSubjects::::get(credential_id_2), Some(subject_id)); // Deposit is 2x now - assert_eq!(Balances::reserved_balance(ACCOUNT_00), 2 * deposit); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00), + 2 * deposit + ); }); } @@ -569,7 +586,9 @@ fn remove_successful() { assert!(CredentialSubjects::::get(credential_id).is_none()); // Check deposit release logic - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00).is_zero() + ); // Removing the same credential again will fail assert_noop!( @@ -701,7 +720,9 @@ fn reclaim_deposit_successful() { assert!(CredentialSubjects::::get(credential_id).is_none()); // Check deposit release logic - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00).is_zero() + ); // Reclaiming the deposit for the same credential again will fail assert_noop!( @@ -794,8 +815,13 @@ fn test_change_deposit_owner() { .owner, ACCOUNT_01 ); - assert_eq!(Balances::reserved_balance(ACCOUNT_01), ::Deposit::get()); - assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_01), + ::Deposit::get() + ); + assert!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00).is_zero() + ); }); } @@ -890,7 +916,10 @@ fn test_update_deposit() { .amount, ::Deposit::get() ); - assert_eq!(Balances::reserved_balance(ACCOUNT_00), ::Deposit::get()); + assert_eq!( + Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00), + ::Deposit::get() + ); }); } From d84796ed2c69b96d59863ac715e7386362efc819 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 12 Jun 2023 16:12:53 +0200 Subject: [PATCH 41/99] intermediate state --- pallets/attestation/src/lib.rs | 27 ++++++++++++++++++------- pallets/attestation/src/mock.rs | 6 +++--- support/src/deposit.rs | 36 +++++++++++++++++++++++++++++++++ support/src/lib.rs | 2 +- support/src/traits.rs | 13 ++++++------ 5 files changed, 67 insertions(+), 17 deletions(-) diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 27e094ae2f..c5fb2744fb 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -85,6 +85,7 @@ pub use crate::{ #[frame_support::pallet] pub mod pallet { use super::*; + use frame_support::{ dispatch::{DispatchResult, DispatchResultWithPostInfo}, pallet_prelude::*, @@ -119,6 +120,13 @@ pub mod pallet { pub(crate) type CurrencyOf = ::Currency; + pub(crate) type HoldReasonOf = ::RuntimeHoldReason; + + #[pallet::composite_enum] + pub enum HoldReason { + Deposit, + } + #[pallet::config] pub trait Config: frame_system::Config + ctype::Config { type EnsureOrigin: EnsureOrigin< @@ -129,8 +137,10 @@ pub mod pallet { type RuntimeEvent: From> + IsType<::RuntimeEvent>; type WeightInfo: WeightInfo; + type RuntimeHoldReason: From; + /// The currency that is used to hold funds for each attestation. - type Currency: MutateHold, Reason = HFIdentifier>; + type Currency: MutateHold, Reason = HoldReasonOf>; /// The deposit that is required for storing an attestation. #[pallet::constant] @@ -273,10 +283,12 @@ pub mod pallet { .transpose()?; let authorization_id = authorization.as_ref().map(|ac| ac.authorization_id()); - let deposit = kilt_support::reserve_deposit::, CurrencyOf>( + ::Currency::hold(&T::RuntimeHoldReason::from(HoldReason::Deposit), &payer, deposit_amount); + + let deposit = kilt_support::reserve_deposit2::, HoldReasonOf, CurrencyOf>( payer, deposit_amount, - &HFIdentifier::Deposit(Pallets::Attestation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; log::debug!("insert Attestation"); @@ -453,7 +465,7 @@ pub mod pallet { AttestationStorageDepositCollector::::change_deposit_owner( &claim_hash, sender, - &HFIdentifier::Deposit(Pallets::Attestation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Ok(()) @@ -472,7 +484,7 @@ pub mod pallet { AttestationStorageDepositCollector::::update_deposit( &claim_hash, - &HFIdentifier::Deposit(Pallets::Attestation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Ok(()) @@ -481,9 +493,9 @@ pub mod pallet { impl Pallet { fn remove_attestation(attestation: AttestationDetails, claim_hash: ClaimHashOf) -> DispatchResult { - kilt_support::free_deposit::, CurrencyOf>( + kilt_support::free_deposit2::, HoldReasonOf, CurrencyOf>( &attestation.deposit, - &HFIdentifier::Deposit(Pallets::Attestation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Attestations::::remove(claim_hash); if let Some(authorization_id) = &attestation.authorization_id { @@ -495,6 +507,7 @@ pub mod pallet { struct AttestationStorageDepositCollector(PhantomData); impl StorageDepositCollector, ClaimHashOf> for AttestationStorageDepositCollector { + type Reason = HoldReasonOf; type Currency = ::Currency; fn deposit( diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index b77315f65e..35ed36e386 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -255,8 +255,8 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; + type HoldIdentifier = RuntimeHoldReason; type MaxFreezes = MaxFreezes; type MaxHolds = MaxHolds; type Balance = Balance; @@ -303,7 +303,7 @@ pub(crate) mod runtime { type OriginSuccess = mock_origin::DoubleOrigin>; type RuntimeEvent = (); type WeightInfo = (); - + type RuntimeHoldReason = RuntimeHoldReason; type Currency = Balances; type Deposit = Deposit; type MaxDelegatedAttestations = MaxDelegatedAttestations; diff --git a/support/src/deposit.rs b/support/src/deposit.rs index 8653caa27f..462a6bfd47 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -48,6 +48,21 @@ impl AsRef for HFIdentifier { } } +impl From for HFIdentifier { + fn from(value: Pallets) -> Self { + match value { + Pallets::Attestation => HFIdentifier::Deposit(Pallets::Attestation), + Pallets::Ctype => HFIdentifier::Deposit(Pallets::Ctype), + Pallets::Delegation => HFIdentifier::Deposit(Pallets::Delegation), + Pallets::Did => HFIdentifier::Deposit(Pallets::Did), + Pallets::DidLookup => HFIdentifier::Deposit(Pallets::DidLookup), + Pallets::W3n => HFIdentifier::Deposit(Pallets::W3n), + Pallets::Staking => HFIdentifier::Deposit(Pallets::Staking), + Pallets::PublicCredentials => HFIdentifier::Deposit(Pallets::PublicCredentials), + } + } +} + /// An amount of balance reserved by the specified address. #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen)] @@ -69,6 +84,19 @@ pub fn reserve_deposit }) } +pub fn reserve_deposit2>( + account: Account, + deposit_amount: Currency::Balance, + reason: &Reason, +) -> Result, DispatchError> { + let q = Currency::hold(reason, &account, deposit_amount); + q?; + Ok(Deposit { + owner: account, + amount: deposit_amount, + }) +} + pub fn free_deposit>( deposit: &Deposit, reason: &HFIdentifier, @@ -76,3 +104,11 @@ pub fn free_deposit>( Currency::release(reason, &deposit.owner, deposit.amount, Precision::Exact)?; Ok(()) } + +pub fn free_deposit2>( + deposit: &Deposit, + reason: &Reason, +) -> DispatchResult { + Currency::release(reason, &deposit.owner, deposit.amount, Precision::Exact)?; + Ok(()) +} diff --git a/support/src/lib.rs b/support/src/lib.rs index 6b1e3306a8..99dd552ef0 100644 --- a/support/src/lib.rs +++ b/support/src/lib.rs @@ -18,7 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] pub mod deposit; -pub use deposit::{free_deposit, reserve_deposit}; +pub use deposit::{free_deposit, free_deposit2, reserve_deposit, reserve_deposit2}; pub mod migration; #[cfg(any(feature = "runtime-benchmarks", feature = "mock"))] diff --git a/support/src/traits.rs b/support/src/traits.rs index dc49e0ff71..e0addc9011 100644 --- a/support/src/traits.rs +++ b/support/src/traits.rs @@ -24,7 +24,7 @@ use sp_runtime::DispatchError; use crate::{ deposit::{Deposit, HFIdentifier}, - free_deposit, + free_deposit, free_deposit2, }; /// The sources of a call struct. @@ -93,7 +93,8 @@ pub trait ItemFilter { } pub trait StorageDepositCollector { - type Currency: Mutate + InspectHold; + type Reason; + type Currency: Mutate + InspectHold; /// Returns the deposit of the storage entry that is stored behind the key. fn deposit(key: &Key) @@ -117,10 +118,10 @@ pub trait StorageDepositCollector { /// The deposit balance of the current owner will be freed, while the /// deposit balance of the new owner will get reserved. The deposit amount /// will not change even if the required byte and item fees were updated. - fn change_deposit_owner(key: &Key, new_owner: AccountId, reason: &HFIdentifier) -> Result<(), DispatchError> { + fn change_deposit_owner(key: &Key, new_owner: AccountId, reason: &Self::Reason) -> Result<(), DispatchError> { let deposit = Self::deposit(key)?; - free_deposit::(&deposit, reason)?; + free_deposit2::(&deposit, reason)?; let deposit = Deposit { owner: new_owner, @@ -139,10 +140,10 @@ pub trait StorageDepositCollector { /// updates the deposit amount. It either frees parts of the reserved /// balance in case the deposit was lowered or reserves more balance when /// the deposit was raised. - fn update_deposit(key: &Key, reason: &HFIdentifier) -> Result<(), DispatchError> { + fn update_deposit(key: &Key, reason: &Self::Reason) -> Result<(), DispatchError> { let deposit = Self::deposit(key)?; - free_deposit::(&deposit, reason)?; + free_deposit2::(&deposit, reason)?; let deposit = Deposit { amount: Self::deposit_amount(key), From fa21854115cb8665adb2c25f96a01be9344b0a50 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 15 Jun 2023 11:50:41 +0200 Subject: [PATCH 42/99] good intermediate state --- pallets/attestation/src/lib.rs | 9 +- pallets/attestation/src/migrations.rs | 15 +- pallets/attestation/src/mock.rs | 13 +- pallets/attestation/src/tests.rs | 87 +++-- pallets/delegation/src/lib.rs | 20 +- pallets/delegation/src/migrations.rs | 15 +- pallets/delegation/src/mock.rs | 7 +- pallets/delegation/src/tests.rs | 326 +++++++++++++++---- pallets/did/src/did_details.rs | 10 +- pallets/did/src/lib.rs | 20 +- pallets/did/src/migrations.rs | 21 +- pallets/did/src/mock.rs | 13 +- pallets/did/src/tests.rs | 97 ++++-- pallets/pallet-configuration/src/mock.rs | 5 +- pallets/pallet-web3-names/src/lib.rs | 24 +- pallets/pallet-web3-names/src/migrations.rs | 21 +- pallets/pallet-web3-names/src/mock.rs | 20 +- pallets/pallet-web3-names/src/tests.rs | 62 +++- pallets/parachain-staking/src/lib.rs | 42 ++- pallets/parachain-staking/src/migrations.rs | 9 +- pallets/parachain-staking/src/mock.rs | 9 +- pallets/parachain-staking/src/tests.rs | 11 +- pallets/public-credentials/src/lib.rs | 19 +- pallets/public-credentials/src/migrations.rs | 15 +- pallets/public-credentials/src/mock.rs | 18 +- pallets/public-credentials/src/tests.rs | 66 ++-- support/src/deposit.rs | 72 +--- support/src/lib.rs | 2 +- support/src/migration.rs | 16 +- support/src/traits.rs | 25 +- 30 files changed, 705 insertions(+), 384 deletions(-) diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index c5fb2744fb..36e991de98 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -98,7 +98,7 @@ pub mod pallet { use ctype::CtypeHashOf; use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, + deposit::Deposit, traits::{CallSources, StorageDepositCollector}, }; @@ -283,9 +283,7 @@ pub mod pallet { .transpose()?; let authorization_id = authorization.as_ref().map(|ac| ac.authorization_id()); - ::Currency::hold(&T::RuntimeHoldReason::from(HoldReason::Deposit), &payer, deposit_amount); - - let deposit = kilt_support::reserve_deposit2::, HoldReasonOf, CurrencyOf>( + let deposit = kilt_support::reserve_deposit::, CurrencyOf>( payer, deposit_amount, &T::RuntimeHoldReason::from(HoldReason::Deposit), @@ -493,7 +491,7 @@ pub mod pallet { impl Pallet { fn remove_attestation(attestation: AttestationDetails, claim_hash: ClaimHashOf) -> DispatchResult { - kilt_support::free_deposit2::, HoldReasonOf, CurrencyOf>( + kilt_support::free_deposit::, CurrencyOf>( &attestation.deposit, &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; @@ -507,7 +505,6 @@ pub mod pallet { struct AttestationStorageDepositCollector(PhantomData); impl StorageDepositCollector, ClaimHashOf> for AttestationStorageDepositCollector { - type Reason = HoldReasonOf; type Currency = ::Currency; fn deposit( diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 0be4e0de84..e0df255d8b 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -20,15 +20,12 @@ use frame_support::{ traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; -use kilt_support::{ - deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds, switch_reserved_to_hold}, -}; +use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, AttestationDetails, Attestations, Config, CurrencyOf}; +use crate::{AccountIdOf, AttestationDetails, Attestations, Config, CurrencyOf, HoldReason}; pub struct BalanceMigration(PhantomData); @@ -55,7 +52,7 @@ where .map(|details: AttestationDetails| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::Attestation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); @@ -77,7 +74,7 @@ where Attestations::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( - &HFIdentifier::Deposit(Pallets::Attestation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), &details.deposit.owner, ) .saturated_into(); @@ -109,7 +106,7 @@ where .map(|details: AttestationDetails| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::Attestation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user) @@ -124,7 +121,7 @@ where let deposit = attestations_detail.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &HFIdentifier::Deposit(Pallets::Attestation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), deposit.amount.saturated_into(), ); diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index 35ed36e386..c33421774e 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -30,11 +30,11 @@ use sp_core::H256; use sp_runtime::DispatchError; use ctype::CtypeHashOf; -use kilt_support::deposit::{Deposit, HFIdentifier, Pallets}; +use kilt_support::deposit::Deposit; use crate::{ pallet::AuthorizationIdOf, AccountIdOf, AttestationAccessControl, AttestationDetails, AttesterOf, BalanceOf, - ClaimHashOf, Config, CurrencyOf, + ClaimHashOf, Config, CurrencyOf, HoldReason, }; #[cfg(test)] @@ -156,7 +156,7 @@ pub fn insert_attestation(claim_hash: ClaimHashOf, details: Attest kilt_support::reserve_deposit::, CurrencyOf>( details.deposit.owner.clone(), details.deposit.amount, - &HFIdentifier::Deposit(Pallets::Attestation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) .expect("Should have balance"); @@ -179,10 +179,7 @@ pub(crate) mod runtime { }; use ctype::{CtypeCreatorOf, CtypeEntryOf}; - use kilt_support::{ - deposit::HFIdentifier, - mock::{mock_origin, SubjectId}, - }; + use kilt_support::mock::{mock_origin, SubjectId}; use super::*; @@ -206,7 +203,7 @@ pub(crate) mod runtime { UncheckedExtrinsic = UncheckedExtrinsic, { System: frame_system::{Pallet, Call, Config, Storage, Event}, - Attestation: crate::{Pallet, Call, Storage, Event}, + Attestation: crate::{Pallet, Call, Storage, Event, HoldReason}, Ctype: ctype::{Pallet, Call, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Event}, MockOrigin: mock_origin::{Pallet, Origin}, diff --git a/pallets/attestation/src/tests.rs b/pallets/attestation/src/tests.rs index d830489339..e9be036e1d 100644 --- a/pallets/attestation/src/tests.rs +++ b/pallets/attestation/src/tests.rs @@ -20,15 +20,12 @@ use ctype::mock::get_ctype_hash; use frame_support::{assert_noop, assert_ok, traits::fungible::InspectHold}; use sp_runtime::{traits::Zero, DispatchError, TokenError}; -use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, - mock::mock_origin::DoubleOrigin, -}; +use kilt_support::{deposit::Deposit, mock::mock_origin::DoubleOrigin}; use crate::{ self as attestation, mock::{runtime::Balances, *}, - AttestationAccessControl, AttesterOf, Config, Error, + AttestationAccessControl, AttesterOf, Config, Error, HoldReason, }; // ############################################################################# @@ -187,7 +184,10 @@ fn test_revoke_remove() { assert!(stored_attestation.revoked); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); @@ -197,7 +197,11 @@ fn test_revoke_remove() { None )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); }); } @@ -226,7 +230,10 @@ fn test_authorized_revoke() { assert!(stored_attestation.revoked); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); }); @@ -385,7 +392,11 @@ fn test_remove_not_found() { .with_balances(vec![(ACCOUNT_00, ::Deposit::get() * 100)]) .with_ctypes(vec![(attestation.ctype_hash, attester.clone())]) .build_and_execute_with_sanity_tests(|| { - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_noop!( Attestation::remove(DoubleOrigin(ACCOUNT_00, attester.clone()).into(), claim_hash, None), attestation::Error::::NotFound @@ -410,7 +421,10 @@ fn test_reclaim_deposit() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); assert_ok!(Attestation::reclaim_deposit( @@ -422,7 +436,11 @@ fn test_reclaim_deposit() { claim_hash )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); }); } @@ -438,7 +456,10 @@ fn test_reclaim_deposit_authorization() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); assert_ok!(Attestation::reclaim_deposit( @@ -446,7 +467,11 @@ fn test_reclaim_deposit_authorization() { claim_hash )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); }); } @@ -505,7 +530,10 @@ fn test_change_deposit_owner() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); assert_ok!(Attestation::change_deposit_owner( @@ -521,9 +549,16 @@ fn test_change_deposit_owner() { amount: ::Deposit::get() } ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); }); @@ -543,7 +578,10 @@ fn test_change_deposit_owner_insufficient_balance() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); assert_noop!( @@ -606,7 +644,10 @@ fn test_update_deposit() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 2 ); assert_ok!(Attestation::update_deposit( @@ -625,7 +666,10 @@ fn test_update_deposit() { // old deposit was 2x Deposit::get(), new deposit should be the the default // deposit value. assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); }); @@ -648,7 +692,10 @@ fn test_update_deposit_unauthorized() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Attestation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 2 ); assert_noop!( diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index 2957be0053..0387180beb 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -100,7 +100,7 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, + deposit::Deposit, signature::{SignatureVerificationError, VerifySignature}, traits::CallSources, }; @@ -131,6 +131,11 @@ pub mod pallet { pub(crate) type CurrencyOf = ::Currency; + #[pallet::composite_enum] + pub enum HoldReason { + Deposit, + } + #[pallet::config] pub trait Config: frame_system::Config + ctype::Config { type Signature: Parameter; @@ -148,9 +153,10 @@ pub mod pallet { type OriginSuccess: CallSources, DelegatorIdOf>; type RuntimeEvent: From> + IsType<::RuntimeEvent>; type WeightInfo: WeightInfo; + type RuntimeHoldReason: From; /// The currency that is used to reserve funds for each delegation. - type Currency: MutateHold, Reason = HFIdentifier>; + type Currency: MutateHold, Reason = Self::RuntimeHoldReason>; /// The deposit that is required for storing a delegation. #[pallet::constant] @@ -675,7 +681,7 @@ pub mod pallet { DelegationDepositCollector::::change_deposit_owner( &delegation_id, source.sender(), - &HFIdentifier::Deposit(Pallets::Delegation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) } @@ -695,7 +701,7 @@ pub mod pallet { DelegationDepositCollector::::update_deposit( &delegation_id, - &HFIdentifier::Deposit(Pallets::Delegation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Ok(()) @@ -736,7 +742,7 @@ pub mod pallet { kilt_support::reserve_deposit::, CurrencyOf>( deposit_owner.clone(), ::Deposit::get(), - &HFIdentifier::Deposit(Pallets::Delegation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; let root_node = DelegationNode::new_root_node( @@ -767,7 +773,7 @@ pub mod pallet { kilt_support::reserve_deposit::, CurrencyOf>( deposit_owner, ::Deposit::get(), - &HFIdentifier::Deposit(Pallets::Delegation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; // Add the new node as a child of that node @@ -981,7 +987,7 @@ pub mod pallet { kilt_support::free_deposit::, CurrencyOf>( &delegation_node.deposit, - &HFIdentifier::Deposit(Pallets::Delegation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; consumed_weight = consumed_weight.saturating_add(T::DbWeight::get().reads_writes(1, 2)); diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index 31b413b9fc..cf9ad9a9ee 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -20,15 +20,12 @@ use frame_support::{ traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; -use kilt_support::{ - deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds, switch_reserved_to_hold}, -}; +use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Config, CurrencyOf, DelegationNode, DelegationNodes}; +use crate::{AccountIdOf, Config, CurrencyOf, DelegationNode, DelegationNodes, HoldReason}; pub struct BalanceMigration(PhantomData); @@ -55,7 +52,7 @@ where .map(|details: DelegationNode| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::Delegation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); @@ -77,7 +74,7 @@ where DelegationNodes::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( - &HFIdentifier::Deposit(Pallets::Delegation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), &details.deposit.owner, ) .saturated_into(); @@ -108,7 +105,7 @@ where .map(|details: DelegationNode| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::Delegation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user) @@ -123,7 +120,7 @@ where let deposit = delegation_detail.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &HFIdentifier::Deposit(Pallets::Delegation), + &T::RuntimeHoldReason::from(HoldReason::Deposit), deposit.amount.saturated_into(), ); diff --git a/pallets/delegation/src/mock.rs b/pallets/delegation/src/mock.rs index b93c2f8710..f293098dd2 100644 --- a/pallets/delegation/src/mock.rs +++ b/pallets/delegation/src/mock.rs @@ -191,7 +191,6 @@ pub(crate) mod runtime { use attestation::{mock::insert_attestation, AttestationDetails, ClaimHashOf}; use ctype::CtypeEntryOf; use kilt_support::{ - deposit::HFIdentifier, mock::{mock_origin, SubjectId}, signature::EqualVerify, }; @@ -267,8 +266,8 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; + type HoldIdentifier = RuntimeHoldReason; type MaxFreezes = MaxFreezes; type MaxHolds = MaxHolds; type Balance = Balance; @@ -313,6 +312,7 @@ pub(crate) mod runtime { impl attestation::Config for Test { type EnsureOrigin = mock_origin::EnsureDoubleOrigin>; type OriginSuccess = mock_origin::DoubleOrigin>; + type RuntimeHoldReason = RuntimeHoldReason; type RuntimeEvent = (); type WeightInfo = (); @@ -336,6 +336,7 @@ pub(crate) mod runtime { impl Config for Test { type Signature = (SubjectId, Vec); + type RuntimeHoldReason = RuntimeHoldReason; type DelegationSignatureVerification = EqualVerify>; type DelegationEntityId = SubjectId; type DelegationNodeId = Hash; diff --git a/pallets/delegation/src/tests.rs b/pallets/delegation/src/tests.rs index b5e298bb57..7486834845 100644 --- a/pallets/delegation/src/tests.rs +++ b/pallets/delegation/src/tests.rs @@ -20,15 +20,12 @@ use frame_support::{ assert_err, assert_noop, assert_ok, traits::fungible::{Inspect, InspectHold}, }; -use kilt_support::{ - deposit::{HFIdentifier, Pallets}, - mock::mock_origin::DoubleOrigin, -}; +use kilt_support::mock::mock_origin::DoubleOrigin; use crate::{ self as delegation, mock::{runtime::*, *}, - Config, Error, + Config, Error, HoldReason, }; use sp_runtime::{traits::Zero, TokenError}; @@ -58,7 +55,10 @@ fn create_root_delegation_successful() { // Check reserved balance assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); @@ -177,7 +177,10 @@ fn create_delegation_direct_root_successful() { // 1 Deposit should be reserved for hierarchy assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); @@ -193,7 +196,10 @@ fn create_delegation_direct_root_successful() { // 2 Deposits should be reserved for hierarchy and delegation to root assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 2 * ::Deposit::get() ); @@ -263,7 +269,10 @@ fn create_delegation_with_parent_successful() { // Should have deposited for hierarchy and parent delegation assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 2 * ::Deposit::get() ); @@ -279,10 +288,17 @@ fn create_delegation_with_parent_successful() { // Should have deposited for hierarchy, parent delegation and sub-delegation assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 3 * ::Deposit::get() ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); // Data in stored delegation and operation should match let stored_delegation = @@ -720,11 +736,17 @@ fn list_hierarchy_revoke_and_remove_root_successful() { .build_and_execute_with_sanity_tests(|| { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); @@ -767,8 +789,16 @@ fn list_hierarchy_revoke_and_remove_root_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); }); } @@ -836,11 +866,17 @@ fn tree_hierarchy_revoke_and_remove_root_successful() { ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); @@ -855,8 +891,16 @@ fn tree_hierarchy_revoke_and_remove_root_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation2_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); }); } @@ -920,11 +964,17 @@ fn max_max_revocations_revoke_and_remove_successful() { ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); @@ -939,8 +989,16 @@ fn max_max_revocations_revoke_and_remove_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); }); } @@ -1101,7 +1159,10 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { ]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); @@ -1146,11 +1207,17 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { // Should not remove root because tree traversal steps are insufficient assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), 3 * ::Deposit::get() ); // assert_err and not assert_noop because the storage is indeed changed, but @@ -1169,11 +1236,17 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { assert!(Delegation::delegation_nodes(delegation2_id).is_some()); assert!(Delegation::delegation_nodes(delegation3_id).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), 3 * ::Deposit::get() ); @@ -1186,8 +1259,16 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { assert!(Delegation::delegation_nodes(operation.id).is_none()); assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation3_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); }); } @@ -1256,11 +1337,17 @@ fn direct_owner_revoke_and_remove_delegation_successful() { ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); @@ -1276,10 +1363,17 @@ fn direct_owner_revoke_and_remove_delegation_successful() { assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); }); } @@ -1319,11 +1413,17 @@ fn parent_owner_revoke_delegation_successful() { .build_and_execute_with_sanity_tests(|| { // Parent should not be able to remove the child delegation directly assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); assert_noop!( @@ -1367,10 +1467,17 @@ fn parent_owner_revoke_delegation_successful() { assert!(Delegation::delegation_nodes(parent_id).is_some()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 2 * ::Deposit::get() ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); }); } @@ -1501,15 +1608,24 @@ fn parent_too_far_revoke_and_remove_delegation_error() { // removal assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_02), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_02 + ), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); @@ -1618,8 +1734,16 @@ fn direct_owner_reclaim_deposit_delegation_successful() { assert!(Delegation::delegation_nodes(delegation_id).is_none()); // We have released all the deposits by deleting the root node. - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); }); } @@ -1652,11 +1776,17 @@ fn parent_owner_reclaim_deposit_error() { // Parent should not be able to claim the deposit for the child delegation // directly assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); assert_noop!( @@ -2098,7 +2228,10 @@ fn remove_single_hierarchy() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_some()); assert!(Delegation::delegation_nodes(hierarchy_root_id).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); @@ -2118,7 +2251,11 @@ fn remove_single_hierarchy() { )); assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(hierarchy_root_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); }); } @@ -2169,15 +2306,24 @@ fn remove_children_gas_runs_out() { ]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), 3 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_02), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_02 + ), ::Deposit::get() ); @@ -2200,15 +2346,24 @@ fn remove_children_gas_runs_out() { assert!(Delegation::delegation_nodes(delegation3_id).is_some()); assert!(Delegation::delegation_nodes(delegation4_id).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), 3 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_02), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_02 + ), ::Deposit::get() ); @@ -2222,9 +2377,21 @@ fn remove_children_gas_runs_out() { assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation2_id).is_none()); assert!(Delegation::delegation_nodes(delegation3_id).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_02).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_02 + ) + .is_zero()); }); } @@ -2263,10 +2430,17 @@ fn test_change_deposit_owner() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 3 ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); assert_ok!(Delegation::change_deposit_owner( DoubleOrigin(ACCOUNT_01, delegate).into(), delegation_id @@ -2274,11 +2448,17 @@ fn test_change_deposit_owner() { // ACCOUNT_00 has still one deposit (there are two nodes) assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 2 ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); }); @@ -2309,10 +2489,17 @@ fn test_change_deposit_owner_insufficient_balance() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 3 ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ) + .is_zero()); assert_noop!( Delegation::change_deposit_owner(DoubleOrigin(ACCOUNT_01, delegate).into(), delegation_id), TokenError::CannotCreateHold @@ -2410,7 +2597,10 @@ fn test_update_deposit() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 3 ); assert_ok!(Delegation::update_deposit( @@ -2420,7 +2610,10 @@ fn test_update_deposit() { // ACCOUNT_00 has still one deposit (there are two nodes) assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 2 ); }); @@ -2451,7 +2644,10 @@ fn test_update_deposit_unauthorized() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Delegation), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 3 ); assert_noop!( diff --git a/pallets/did/src/did_details.rs b/pallets/did/src/did_details.rs index f0d1c4e708..f034c8f319 100644 --- a/pallets/did/src/did_details.rs +++ b/pallets/did/src/did_details.rs @@ -23,7 +23,7 @@ use frame_support::{ traits::Get, RuntimeDebug, }; -use kilt_support::deposit::{Deposit, HFIdentifier, Pallets}; +use kilt_support::deposit::Deposit; use parity_scale_codec::{Decode, Encode, MaxEncodedLen, WrapperTypeEncode}; use scale_info::TypeInfo; use sp_core::{ecdsa, ed25519, sr25519}; @@ -37,7 +37,7 @@ use crate::{ errors::{self, DidError}, service_endpoints::DidEndpoint, utils, AccountIdOf, BalanceOf, BlockNumberOf, Config, CurrencyOf, DidCallableOf, DidEndpointsCount, - DidIdentifierOf, KeyIdOf, Payload, + DidIdentifierOf, HoldReason, KeyIdOf, Payload, }; /// Types of verification keys a DID can control. @@ -348,7 +348,7 @@ impl DidDetails { kilt_support::reserve_deposit::, CurrencyOf>( self.deposit.owner.clone(), deposit_to_reserve, - &HFIdentifier::Deposit(Pallets::Did), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; self.deposit.amount = self.deposit.amount.saturating_add(deposit_to_reserve); } @@ -360,7 +360,7 @@ impl DidDetails { }; kilt_support::free_deposit::, CurrencyOf>( &deposit, - &HFIdentifier::Deposit(Pallets::Did), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; self.deposit.amount = self.deposit.amount.saturating_sub(deposit_to_release); } @@ -409,7 +409,7 @@ impl DidDetails { kilt_support::reserve_deposit::, CurrencyOf>( details.submitter, deposit_amount, - &HFIdentifier::Deposit(Pallets::Did), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Ok(new_did_details) diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index 16d9415467..76d6e1609c 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -146,7 +146,7 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, + deposit::Deposit, traits::{CallSources, StorageDepositCollector}, }; use sp_runtime::traits::BadOrigin; @@ -189,6 +189,11 @@ pub mod pallet { pub(crate) type CurrencyOf = ::Currency; pub(crate) type NegativeImbalanceOf = <::Currency as Currency>>::NegativeImbalance; + #[pallet::composite_enum] + pub enum HoldReason { + Deposit, + } + #[pallet::config] pub trait Config: frame_system::Config + Debug { /// Type for a dispatchable call that can be proxied through the DID @@ -219,8 +224,11 @@ pub mod pallet { /// Overarching event type. type RuntimeEvent: From> + IsType<::RuntimeEvent>; + type RuntimeHoldReason: From; + /// The currency that is used to reserve funds for each did. - type Currency: ReservableCurrency> + MutateHold, Reason = HFIdentifier>; + type Currency: ReservableCurrency> + + MutateHold, Reason = Self::RuntimeHoldReason>; /// The amount of balance that will be taken for each DID as a deposit /// to incentivise fair use of the on chain storage. The deposits @@ -1108,7 +1116,11 @@ pub mod pallet { let subject = source.subject(); let sender = source.sender(); - DidDepositCollector::::change_deposit_owner(&subject, sender, &HFIdentifier::Deposit(Pallets::Did))?; + DidDepositCollector::::change_deposit_owner( + &subject, + sender, + &T::RuntimeHoldReason::from(HoldReason::Deposit), + )?; Ok(()) } @@ -1250,7 +1262,7 @@ pub mod pallet { DidEndpointsCount::::remove(&did_subject); kilt_support::free_deposit::, CurrencyOf>( &did_entry.deposit, - &HFIdentifier::Deposit(Pallets::Did), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; // Mark as deleted to prevent potential replay-attacks of re-adding a previously // deleted DID. diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index 138a532f7b..1c19e51164 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -20,15 +20,12 @@ use frame_support::{ traits::{Get, OnRuntimeUpgrade}, weights::Weight, }; -use kilt_support::{ - deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds, switch_reserved_to_hold}, -}; +use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{did_details::DidDetails, AccountIdOf, Config, CurrencyOf, Did}; +use crate::{did_details::DidDetails, AccountIdOf, Config, CurrencyOf, Did, HoldReason}; pub struct BalanceMigration(PhantomData); @@ -52,7 +49,7 @@ impl OnRuntimeUpgrade for BalanceMigration { .map(|details: DidDetails| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::Did), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); @@ -69,9 +66,11 @@ impl OnRuntimeUpgrade for BalanceMigration { use kilt_support::test_utils::log_and_return_error_message; Did::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = - ::Currency::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &details.deposit.owner) - .saturated_into(); + let hold_balance: u128 = ::Currency::balance_on_hold( + &T::RuntimeHoldReason::from(HoldReason::Deposit), + &details.deposit.owner, + ) + .saturated_into(); ensure!( details.deposit.amount.saturated_into::() <= hold_balance, log_and_return_error_message(scale_info::prelude::format!( @@ -98,7 +97,7 @@ fn is_upgraded() -> bool { .map(|details: DidDetails| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::Did), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user) @@ -110,7 +109,7 @@ fn do_migration() -> Weight { let deposit = did_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &HFIdentifier::Deposit(Pallets::Did), + &T::RuntimeHoldReason::from(HoldReason::Deposit), deposit.amount.saturated_into(), ); diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index 9c51c2ed7d..0ccd5e2811 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -22,7 +22,6 @@ use frame_support::{ weights::constants::RocksDbWeight, }; use frame_system::EnsureSigned; -use kilt_support::deposit::{HFIdentifier, Pallets}; use pallet_balances::NegativeImbalance; use sp_core::{ecdsa, ed25519, sr25519, Pair}; use sp_runtime::{ @@ -41,7 +40,8 @@ use crate::{ RelationshipDeriveError, }, service_endpoints::DidEndpoint, - utils as crate_utils, AccountIdOf, Config, CurrencyOf, DidBlacklist, DidEndpointsCount, KeyIdOf, ServiceEndpoints, + utils as crate_utils, AccountIdOf, Config, CurrencyOf, DidBlacklist, DidEndpointsCount, HoldReason, KeyIdOf, + ServiceEndpoints, }; #[cfg(not(feature = "runtime-benchmarks"))] use crate::{DidRawOrigin, EnsureDidOrigin}; @@ -69,7 +69,7 @@ frame_support::construct_runtime!( NodeBlock = Block, UncheckedExtrinsic = UncheckedExtrinsic, { - Did: did::{Pallet, Call, Storage, Event, Origin}, + Did: did::{Pallet, Call, Storage, HoldReason, Event, Origin}, Ctype: ctype::{Pallet, Call, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Event}, System: frame_system::{Pallet, Call, Config, Storage, Event}, @@ -147,6 +147,7 @@ impl Config for Test { type RuntimeCall = RuntimeCall; type EnsureOrigin = EnsureSigned; type KeyDeposit = KeyDeposit; + type RuntimeHoldReason = RuntimeHoldReason; type ServiceEndpointDeposit = KeyDeposit; type OriginSuccess = AccountId; type RuntimeEvent = (); @@ -176,8 +177,8 @@ parameter_types! { } impl pallet_balances::Config for Test { - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; + type HoldIdentifier = RuntimeHoldReason; type MaxFreezes = MaxFreezes; type MaxHolds = MaxHolds; type Balance = Balance; @@ -498,7 +499,7 @@ impl ExtBuilder { for did in self.dids_stored.iter() { did::Did::::insert(&did.0, did.1.clone()); CurrencyOf::::hold( - &HFIdentifier::Deposit(Pallets::Did), + &::RuntimeHoldReason::from(HoldReason::Deposit), &did.1.deposit.owner, did.1.deposit.amount, ) diff --git a/pallets/did/src/tests.rs b/pallets/did/src/tests.rs index 38b5dfeec7..5675760669 100644 --- a/pallets/did/src/tests.rs +++ b/pallets/did/src/tests.rs @@ -20,7 +20,6 @@ use frame_support::{ assert_err, assert_noop, assert_ok, traits::fungible::{Inspect, InspectHold}, }; -use kilt_support::deposit::{HFIdentifier, Pallets}; use parity_scale_codec::Encode; use sp_core::{ed25519, Pair}; use sp_runtime::{ @@ -38,7 +37,7 @@ use crate::{ mock::*, mock_utils::*, service_endpoints::DidEndpoint, - Error, + Error, HoldReason, }; // create @@ -78,7 +77,10 @@ fn check_successful_simple_ed25519_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::BaseDeposit::get() ); @@ -121,7 +123,10 @@ fn check_successful_simple_sr25519_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::BaseDeposit::get() ); assert_eq!(Balances::balance(&ACCOUNT_FEE), ::Fee::get()); @@ -163,7 +168,10 @@ fn check_successful_simple_ecdsa_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::BaseDeposit::get() ); assert_eq!(Balances::balance(&ACCOUNT_FEE), ::Fee::get()); @@ -279,7 +287,10 @@ fn check_successful_complete_creation() { ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::BaseDeposit::get() + required_balance_for_endpoint + required_balance_for_key_agreement @@ -316,7 +327,10 @@ fn check_deposit_change_by_adding_service_endpoint() { )); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &alice_did), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &alice_did + ), ::ServiceEndpointDeposit::get() + ::BaseDeposit::get() ); @@ -2164,13 +2178,20 @@ fn check_successful_deletion_no_endpoints() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::BaseDeposit::get() ); assert_ok!(Did::delete(RuntimeOrigin::signed(alice_did.clone()), 0)); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); @@ -2211,13 +2232,20 @@ fn check_successful_deletion_with_endpoints() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 1); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::BaseDeposit::get() ); assert_ok!(Did::delete(RuntimeOrigin::signed(alice_did.clone()), 1)); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); @@ -2303,7 +2331,10 @@ fn check_successful_reclaiming() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 1); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::BaseDeposit::get() ); assert_ok!(Did::reclaim_deposit( @@ -2313,7 +2344,11 @@ fn check_successful_reclaiming() { )); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); // Re-adding the same DID identifier should fail. @@ -2349,7 +2384,10 @@ fn unauthorized_reclaiming() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::BaseDeposit::get() ); assert_noop!( @@ -3275,13 +3313,23 @@ fn test_change_deposit_owner() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::BaseDeposit::get() ); assert_ok!(Did::change_deposit_owner(RuntimeOrigin::signed(alice_did.clone()))); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &alice_did), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &alice_did + ), ::BaseDeposit::get() ); }); @@ -3369,7 +3417,10 @@ fn test_update_deposit() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &alice_did), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &alice_did + ), ::BaseDeposit::get() * 2 ); @@ -3379,7 +3430,10 @@ fn test_update_deposit() { )); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &alice_did), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &alice_did + ), ::BaseDeposit::get() ); @@ -3416,7 +3470,10 @@ fn test_update_deposit_unauthorized() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::Did), &alice_did), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &alice_did + ), ::BaseDeposit::get() * 2 ); assert_noop!( diff --git a/pallets/pallet-configuration/src/mock.rs b/pallets/pallet-configuration/src/mock.rs index 5196487496..775e5301e2 100644 --- a/pallets/pallet-configuration/src/mock.rs +++ b/pallets/pallet-configuration/src/mock.rs @@ -22,7 +22,6 @@ pub mod runtime { ord_parameter_types, parameter_types, traits::AsEnsureOriginWithArg, weights::constants::RocksDbWeight, }; use frame_system::EnsureSignedBy; - use kilt_support::deposit::HFIdentifier; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, @@ -96,8 +95,8 @@ pub mod runtime { } impl pallet_balances::Config for Test { - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = (); + type HoldIdentifier = (); type MaxFreezes = MaxFreezes; type MaxHolds = MaxHolds; type Balance = Balance; diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index 270d296e13..c987a407c4 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -57,7 +57,7 @@ pub mod pallet { use sp_std::{fmt::Debug, vec::Vec}; use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, + deposit::Deposit, traits::{CallSources, StorageDepositCollector}, }; @@ -98,6 +98,11 @@ pub mod pallet { #[pallet::getter(fn is_banned)] pub type Banned = StorageMap<_, Blake2_128Concat, Web3NameOf, ()>; + #[pallet::composite_enum] + pub enum HoldReason { + Deposit, + } + #[pallet::config] pub trait Config: frame_system::Config { /// The origin allowed to ban names. @@ -106,8 +111,10 @@ pub mod pallet { type OwnerOrigin: EnsureOrigin<::RuntimeOrigin, Success = Self::OriginSuccess>; /// The type of origin after a successful origin check. type OriginSuccess: CallSources, Web3NameOwnerOf>; + /// Aggregated hold reason. + type RuntimeHoldReason: From; /// The currency type to reserve and release deposits. - type Currency: MutateHold, Reason = HFIdentifier>; + type Currency: MutateHold, Reason = Self::RuntimeHoldReason>; /// The amount of KILT to deposit to claim a name. #[pallet::constant] type Deposit: Get>; @@ -357,7 +364,7 @@ pub mod pallet { Web3NameStorageDepositCollector::::change_deposit_owner( &name, source.sender(), - &HFIdentifier::Deposit(Pallets::W3n), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Ok(()) @@ -374,7 +381,10 @@ pub mod pallet { let w3n_entry = Owner::::get(&name).ok_or(Error::::NotFound)?; ensure!(w3n_entry.deposit.owner == source, Error::::NotAuthorized); - Web3NameStorageDepositCollector::::update_deposit(&name, &HFIdentifier::Deposit(Pallets::W3n))?; + Web3NameStorageDepositCollector::::update_deposit( + &name, + &T::RuntimeHoldReason::from(HoldReason::Deposit), + )?; Ok(()) } @@ -400,7 +410,7 @@ pub mod pallet { ensure!( >>::can_hold( - &HFIdentifier::Deposit(Pallets::W3n), + &T::RuntimeHoldReason::from(HoldReason::Deposit), deposit_payer, T::Deposit::get() ), @@ -429,7 +439,7 @@ pub mod pallet { kilt_support::reserve_deposit::, CurrencyOf>( deposit.owner.clone(), deposit.amount, - &HFIdentifier::Deposit(Pallets::W3n), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Names::::insert(&owner, name.clone()); @@ -481,7 +491,7 @@ pub mod pallet { // Should never fail since we checked in the preconditions kilt_support::free_deposit::, CurrencyOf>( &name_ownership.deposit, - &HFIdentifier::Deposit(Pallets::W3n), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Ok(name_ownership) diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index add9282274..9bf79d8244 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -20,14 +20,11 @@ use frame_support::{ traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; -use kilt_support::{ - deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds, switch_reserved_to_hold}, -}; +use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Config, CurrencyOf, Owner, Web3OwnershipOf}; +use crate::{AccountIdOf, Config, CurrencyOf, HoldReason, Owner, Web3OwnershipOf}; pub struct BalanceMigration(PhantomData); @@ -53,7 +50,7 @@ where .map(|details: Web3OwnershipOf| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::W3n), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); @@ -71,9 +68,11 @@ where use kilt_support::test_utils::log_and_return_error_message; Owner::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = - ::Currency::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &details.deposit.owner) - .saturated_into(); + let hold_balance: u128 = ::Currency::balance_on_hold( + &T::RuntimeHoldReason::from(HoldReason::Deposit), + &details.deposit.owner, + ) + .saturated_into(); ensure!( details.deposit.amount.saturated_into::() <= hold_balance, log_and_return_error_message(scale_info::prelude::format!( @@ -104,7 +103,7 @@ where .map(|details: Web3OwnershipOf| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::W3n), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user) @@ -119,7 +118,7 @@ where let deposit = w3n_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &HFIdentifier::Deposit(Pallets::W3n), + &T::RuntimeHoldReason::from(HoldReason::Deposit), deposit.amount.saturated_into(), ); diff --git a/pallets/pallet-web3-names/src/mock.rs b/pallets/pallet-web3-names/src/mock.rs index 908f9501e0..8989ebf864 100644 --- a/pallets/pallet-web3-names/src/mock.rs +++ b/pallets/pallet-web3-names/src/mock.rs @@ -16,9 +16,11 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::traits::fungible::MutateHold; -use kilt_support::deposit::{Deposit, HFIdentifier, Pallets}; +use kilt_support::deposit::Deposit; -use crate::{AccountIdOf, BalanceOf, Config, CurrencyOf, Names, Owner, Web3NameOf, Web3NameOwnerOf, Web3OwnershipOf}; +use crate::{ + AccountIdOf, BalanceOf, Config, CurrencyOf, HoldReason, Names, Owner, Web3NameOf, Web3NameOwnerOf, Web3OwnershipOf, +}; pub(crate) type BlockNumberOf = ::BlockNumber; @@ -29,7 +31,7 @@ pub(crate) fn insert_raw_w3n( block_number: BlockNumberOf, deposit: BalanceOf, ) { - CurrencyOf::::hold(&HFIdentifier::Deposit(Pallets::W3n), &payer, deposit) + CurrencyOf::::hold(&T::RuntimeHoldReason::from(HoldReason::Deposit), &payer, deposit) .expect("Payer should have enough funds for deposit"); Names::::insert(&owner, name.clone()); @@ -54,10 +56,7 @@ pub use crate::mock::runtime::*; pub(crate) mod runtime { use frame_support::parameter_types; use frame_system::EnsureRoot; - use kilt_support::{ - deposit::HFIdentifier, - mock::{mock_origin, SubjectId}, - }; + use kilt_support::mock::{mock_origin, SubjectId}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, @@ -86,7 +85,7 @@ pub(crate) mod runtime { { System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Event}, - Web3Names: pallet_web3_names::{Pallet, Storage, Call, Event}, + Web3Names: pallet_web3_names::{Pallet, Storage, Call, Event, HoldReason}, MockOrigin: mock_origin::{Pallet, Origin}, } ); @@ -132,8 +131,8 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; + type HoldIdentifier = RuntimeHoldReason; type MaxFreezes = MaxFreezes; type MaxHolds = MaxHolds; type Balance = Balance; @@ -166,6 +165,7 @@ pub(crate) mod runtime { type OwnerOrigin = TestOwnerOrigin; type OriginSuccess = TestOriginSuccess; type Currency = Balances; + type RuntimeHoldReason = RuntimeHoldReason; type Deposit = Web3NameDeposit; type RuntimeEvent = RuntimeEvent; type MaxNameLength = MaxNameLength; diff --git a/pallets/pallet-web3-names/src/tests.rs b/pallets/pallet-web3-names/src/tests.rs index d45075a19c..afcc90d714 100644 --- a/pallets/pallet-web3-names/src/tests.rs +++ b/pallets/pallet-web3-names/src/tests.rs @@ -23,13 +23,10 @@ use frame_support::{ }; use frame_system::RawOrigin; -use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, - mock::mock_origin, -}; +use kilt_support::{deposit::Deposit, mock::mock_origin}; use sp_runtime::{traits::Zero, DispatchError, TokenError}; -use crate::{mock::*, Banned, Config, Error, Names, Owner, Pallet, Web3OwnershipOf}; +use crate::{mock::*, Banned, Config, Error, HoldReason, Names, Owner, Pallet, Web3OwnershipOf}; // ############################################################################# // Name claiming @@ -43,7 +40,11 @@ fn claiming_successful() { .build_and_execute_with_sanity_tests(|| { assert!(Names::::get(&DID_00).is_none()); assert!(Owner::::get(&web3_name_00).is_none()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_ok!(Pallet::::claim( mock_origin::DoubleOrigin(ACCOUNT_00, DID_00).into(), @@ -68,7 +69,10 @@ fn claiming_successful() { ); // Test that the deposit was reserved correctly. assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), Web3NameDeposit::get() ); assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance - Web3NameDeposit::get(),); @@ -179,7 +183,11 @@ fn releasing_by_owner_successful() { assert!(Owner::::get(&web3_name_00).is_none()); // Test that the deposit was returned to the payer correctly. - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance); }) } @@ -200,7 +208,11 @@ fn releasing_by_payer_successful() { assert!(Names::::get(&DID_00).is_none()); assert!(Owner::::get(&web3_name_00).is_none()); // Test that the deposit was returned to the payer correctly. - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance); }) } @@ -271,7 +283,11 @@ fn banning_successful() { assert!(Owner::::get(&web3_name_00).is_none()); assert!(Banned::::get(&web3_name_00).is_some()); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance); // Ban an unclaimed name @@ -391,9 +407,16 @@ fn test_change_deposit_owner() { amount: ::Deposit::get() } ); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); }) @@ -444,7 +467,10 @@ fn test_update_deposit() { ::Deposit::get() * 2, ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 2 ); assert_ok!(Pallet::::update_deposit( @@ -461,7 +487,10 @@ fn test_update_deposit() { } ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); }) @@ -482,7 +511,10 @@ fn test_update_deposit_unauthorized() { ::Deposit::get() * 2, ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::W3n), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 2 ); assert_noop!( diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index adca534a60..9f7e272132 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -157,7 +157,6 @@ pub mod pallet { BoundedVec, }; use frame_system::pallet_prelude::*; - use kilt_support::deposit::HFIdentifier; use pallet_balances::{Freezes, IdAmount}; use pallet_session::ShouldEndSession; use scale_info::TypeInfo; @@ -187,6 +186,11 @@ pub mod pallet { #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(PhantomData); + #[pallet::composite_enum] + pub enum FreezeReason { + Staking, + } + /// Configuration trait of this pallet. #[pallet::config] pub trait Config: frame_system::Config + pallet_balances::Config + pallet_session::Config { @@ -199,11 +203,14 @@ pub mod pallet { /// Note: Declaration of Balance taken from pallet_gilt type Currency: Inspect + Unbalanced - + MutateFreeze - + LockableCurrency + + MutateFreeze< + Self::AccountId, + Balance = Self::CurrencyBalance, + Id = ::FreezeIdentifier, + > + LockableCurrency + Eq; - type Identifier: AsRef<::FreezeIdentifier> + From; + type FreezeIdentifier: From + PartialEq; /// Just the `Currency::Balance` type; we have this item to allow us to /// constrain it to `From`. @@ -2201,7 +2208,11 @@ pub mod pallet { // Either set a new lock or potentially extend the existing one if amount // exceeds the currently locked amount - T::Currency::extend_freeze(&HFIdentifier::Staking, who, amount)?; + T::Currency::extend_freeze( + &::FreezeIdentifier::from(FreezeReason::Staking), + who, + amount, + )?; Ok(unstaking_len) } @@ -2319,10 +2330,12 @@ pub mod pallet { // iterate balance freezes to retrieve amount of freezed balance let freezes = Freezes::::get(who); - total_freezed = if let Some(IdAmount { amount, .. }) = freezes - .iter() - .find(|l| &l.id == T::Identifier::from(HFIdentifier::Staking).as_ref()) - { + total_freezed = if let Some(IdAmount { amount, .. }) = + freezes + .iter() + .find(|l: IdAmount<::FreezeIdentifier, _>| { + l.id == ::FreezeIdentifier::from(FreezeReason::Staking) + }) { amount.saturating_sub(total_unfreezed.into()).into() } else { // should never fail to find the lock since we checked whether unstaking is not @@ -2331,10 +2344,17 @@ pub mod pallet { }; if total_freezed.is_zero() { - T::Currency::thaw(&HFIdentifier::Staking, who)?; + T::Currency::thaw( + &::FreezeIdentifier::from(FreezeReason::Staking), + who, + )?; Unstaking::::remove(who); } else { - T::Currency::set_freeze(&HFIdentifier::Staking, who, total_freezed)?; + T::Currency::set_freeze( + &::FreezeIdentifier::from(FreezeReason::Staking), + who, + total_freezed, + )?; Unstaking::::insert(who, unstaking); } diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index ff04c479df..e5ddf99e37 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -20,14 +20,13 @@ use frame_support::{ traits::{fungible::freeze::Mutate as MutateFreeze, Get, LockableCurrency, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; -use kilt_support::deposit::HFIdentifier; use pallet_balances::{BalanceLock, Freezes, IdAmount, Locks}; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; use crate::{ types::{AccountIdOf, CurrencyOf}, - Config, STAKING_ID, + Config, FreezeReason, STAKING_ID, }; pub struct BalanceMigration(PhantomData); @@ -111,7 +110,7 @@ fn update_or_create_freeze( let result = if let Some(IdAmount { amount, .. }) = freezes .iter() - .find(|freeze| &freeze.id == ::Identifier::from(HFIdentifier::Staking).as_ref()) + .find(|freeze| freeze.id == ::FreezeIdentifier::from(FreezeReason::Staking)) { let total_lock = lock .amount @@ -119,13 +118,13 @@ fn update_or_create_freeze( .saturating_add((*amount).saturated_into()); as MutateFreeze>>::extend_freeze( - &HFIdentifier::Staking, + &::FreezeIdentifier::from(FreezeReason::Staking), &user_id, total_lock.saturated_into(), ) } else { as MutateFreeze>>::set_freeze( - &HFIdentifier::Staking, + &::FreezeIdentifier::from(FreezeReason::Staking), &user_id, lock.amount.saturated_into(), ) diff --git a/pallets/parachain-staking/src/mock.rs b/pallets/parachain-staking/src/mock.rs index f605d09f49..86c7f329fc 100644 --- a/pallets/parachain-staking/src/mock.rs +++ b/pallets/parachain-staking/src/mock.rs @@ -25,7 +25,6 @@ use frame_support::{ assert_ok, construct_runtime, parameter_types, traits::{Currency, GenesisBuild, OnFinalize, OnInitialize, OnUnbalanced}, }; -use kilt_support::deposit::HFIdentifier; use pallet_authorship::EventHandler; use sp_consensus_aura::sr25519::AuthorityId; use sp_core::H256; @@ -60,7 +59,7 @@ construct_runtime!( Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Aura: pallet_aura::{Pallet, Storage}, Session: pallet_session::{Pallet, Call, Storage, Event, Config}, - StakePallet: stake::{Pallet, Call, Storage, Config, Event}, + StakePallet: stake::{Pallet, Call, Storage, Config, Event, FreezeReason}, Authorship: pallet_authorship::{Pallet, Storage}, } ); @@ -105,8 +104,8 @@ parameter_types! { } impl pallet_balances::Config for Test { - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; + type HoldIdentifier = RuntimeHoldReason; type MaxFreezes = MaxFreezes; type MaxHolds = MaxHolds; type MaxLocks = (); @@ -178,7 +177,7 @@ impl Config for Test { type NetworkRewardStart = NetworkRewardStart; type NetworkRewardBeneficiary = ToBeneficiary; type WeightInfo = (); - type Identifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; const BLOCKS_PER_YEAR: Self::BlockNumber = 5 * 60 * 24 * 36525 / 100; } diff --git a/pallets/parachain-staking/src/tests.rs b/pallets/parachain-staking/src/tests.rs index e49511069d..18fd62181f 100644 --- a/pallets/parachain-staking/src/tests.rs +++ b/pallets/parachain-staking/src/tests.rs @@ -27,7 +27,6 @@ use frame_support::{ BoundedVec, }; use kilt_runtime_api_staking::StakingRates; -use kilt_support::deposit::HFIdentifier; use pallet_authorship::EventHandler; use pallet_balances::{Error as BalancesError, Freezes, IdAmount}; use pallet_session::{SessionManager, ShouldEndSession}; @@ -42,7 +41,7 @@ use crate::{ types::{ BalanceOf, Candidate, CandidateStatus, DelegationCounter, Delegator, RoundInfo, Stake, StakeOf, TotalStake, }, - CandidatePool, Config, Error, Event, Event as StakeEvent, InflationInfo, RewardRate, StakingInfo, + CandidatePool, Config, Error, Event, Event as StakeEvent, FreezeReason, InflationInfo, RewardRate, StakingInfo, }; #[test] @@ -2128,7 +2127,7 @@ fn unlock_unstaked() { BoundedBTreeMap::new(); assert_ok!(unstaking.try_insert(3, 100)); let freeze = IdAmount { - id: HFIdentifier::Staking, + id: ::FreezeIdentifier::from(FreezeReason::Staking), amount: 100, }; @@ -2185,7 +2184,7 @@ fn unlock_unstaked() { BoundedBTreeMap::new(); assert_ok!(unstaking.try_insert(3, 10)); let mut lock = IdAmount { - id: HFIdentifier::Staking, + id: ::FreezeIdentifier::from(FreezeReason::Staking), amount: 10, }; assert_eq!(StakePallet::unstaking(2), unstaking); @@ -2243,7 +2242,7 @@ fn unlock_unstaked() { BoundedBTreeMap::new(); assert_ok!(unstaking.try_insert(3, 100)); let mut lock = IdAmount { - id: HFIdentifier::Staking, + id: ::FreezeIdentifier::from(FreezeReason::Staking), amount: 100, }; assert_eq!(StakePallet::unstaking(2), unstaking); @@ -2317,7 +2316,7 @@ fn unlock_unstaked() { BoundedBTreeMap::new(); assert_ok!(unstaking.try_insert(3, 60)); let mut lock = IdAmount { - id: HFIdentifier::Staking, + id: ::FreezeIdentifier::from(FreezeReason::Staking), amount: 200, }; assert_eq!(Freezes::::get(1), vec![lock.clone()]); diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index 1bff578a07..0e417051e0 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -69,7 +69,7 @@ pub mod pallet { pub use ctype::CtypeHashOf; use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, + deposit::Deposit, traits::{CallSources, StorageDepositCollector}, }; @@ -110,6 +110,11 @@ pub mod pallet { pub type InputCredentialOf = Credential, InputSubjectIdOf, InputClaimsContentOf, ::AccessControl>; + #[pallet::composite_enum] + pub enum HoldReason { + Deposit, + } + #[pallet::config] pub trait Config: frame_system::Config + ctype::Config { /// The access control logic. @@ -120,6 +125,8 @@ pub mod pallet { CtypeHashOf, CredentialIdOf, >; + + type RuntimeHoldReason: From; /// The identifier of the credential attester. type AttesterId: Parameter + MaxEncodedLen; /// The identifier of the authorization info to perform access control @@ -135,7 +142,7 @@ pub mod pallet { /// The type of a credential identifier. type CredentialId: Parameter + MaxEncodedLen; /// The currency that is used to reserve funds for each credential. - type Currency: MutateHold, Reason = HFIdentifier>; + type Currency: MutateHold, Reason = Self::RuntimeHoldReason>; /// The type of the origin when successfully converted from the outer /// origin. type OriginSuccess: CallSources>; @@ -302,7 +309,7 @@ pub mod pallet { let deposit = kilt_support::reserve_deposit::, CurrencyOf>( payer, deposit_amount, - &HFIdentifier::Deposit(Pallets::PublicCredentials), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) .map_err(|_| Error::::UnableToPayFees)?; @@ -521,7 +528,7 @@ pub mod pallet { PublicCredentialDepositCollector::::change_deposit_owner( &credential_id, source.sender(), - &HFIdentifier::Deposit(Pallets::PublicCredentials), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Ok(()) @@ -540,7 +547,7 @@ pub mod pallet { PublicCredentialDepositCollector::::update_deposit( &credential_id, - &HFIdentifier::Deposit(Pallets::PublicCredentials), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Ok(()) @@ -557,7 +564,7 @@ pub mod pallet { ) -> DispatchResult { kilt_support::free_deposit::>( &credential.deposit, - &HFIdentifier::Deposit(Pallets::PublicCredentials), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Credentials::::remove(&credential_subject, &credential_id); CredentialSubjects::::remove(&credential_id); diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index fa1a189fad..f9b0cf5959 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -20,14 +20,11 @@ use frame_support::{ traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; -use kilt_support::{ - deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds, switch_reserved_to_hold}, -}; +use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Config, CredentialEntryOf, Credentials, CurrencyOf}; +use crate::{AccountIdOf, Config, CredentialEntryOf, Credentials, CurrencyOf, HoldReason}; pub struct BalanceMigration(PhantomData); @@ -53,7 +50,7 @@ where .map(|details: CredentialEntryOf| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::PublicCredentials), + &&T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); @@ -75,7 +72,7 @@ where Credentials::::iter().try_for_each(|(key, key2, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( - &HFIdentifier::Deposit(Pallets::PublicCredentials), + &&T::RuntimeHoldReason::from(HoldReason::Deposit), &details.deposit.owner, ) .saturated_into(); @@ -107,7 +104,7 @@ where .map(|details: CredentialEntryOf| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::PublicCredentials), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user) @@ -122,7 +119,7 @@ where let deposit = pc_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &HFIdentifier::Deposit(Pallets::PublicCredentials), + &T::RuntimeHoldReason::from(HoldReason::Deposit), deposit.amount.saturated_into(), ); diff --git a/pallets/public-credentials/src/mock.rs b/pallets/public-credentials/src/mock.rs index 3c6c5ea4df..9d9c1bd632 100644 --- a/pallets/public-credentials/src/mock.rs +++ b/pallets/public-credentials/src/mock.rs @@ -20,11 +20,11 @@ use frame_support::traits::Get; use parity_scale_codec::Encode; use sp_runtime::traits::Hash; -use kilt_support::deposit::{Deposit, HFIdentifier, Pallets}; +use kilt_support::deposit::Deposit; use crate::{ AccountIdOf, AttesterOf, BalanceOf, Config, CredentialEntryOf, CredentialIdOf, CredentialSubjects, Credentials, - CtypeHashOf, CurrencyOf, InputClaimsContentOf, InputCredentialOf, InputSubjectIdOf, + CtypeHashOf, CurrencyOf, HoldReason, InputClaimsContentOf, InputCredentialOf, InputSubjectIdOf, }; // Generate a public credential using a many Default::default() as possible. @@ -79,7 +79,7 @@ pub(crate) fn insert_public_credentials( kilt_support::reserve_deposit::, CurrencyOf>( credential_entry.deposit.owner.clone(), credential_entry.deposit.amount, - &HFIdentifier::Deposit(Pallets::PublicCredentials), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) .expect("Attester should have enough balance"); @@ -110,10 +110,7 @@ pub(crate) mod runtime { DispatchError, MultiSignature, MultiSigner, }; - use kilt_support::{ - deposit::HFIdentifier, - mock::{mock_origin, SubjectId}, - }; + use kilt_support::mock::{mock_origin, SubjectId}; use ctype::{CtypeCreatorOf, CtypeEntryOf, CtypeHashOf}; @@ -284,7 +281,7 @@ pub(crate) mod runtime { Ctype: ctype::{Pallet, Call, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Event}, MockOrigin: mock_origin::{Pallet, Origin}, - PublicCredentials: crate::{Pallet, Call, Storage, Event}, + PublicCredentials: crate::{Pallet, Call, Storage,HoldReason, Event}, } ); @@ -323,8 +320,8 @@ pub(crate) mod runtime { } impl pallet_balances::Config for Test { - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; + type HoldIdentifier = RuntimeHoldReason; type MaxFreezes = ConstU32<10>; type MaxHolds = ConstU32<10>; type Balance = Balance; @@ -356,6 +353,7 @@ pub(crate) mod runtime { type AttesterId = SubjectId; type AuthorizationId = SubjectId; type CredentialId = Hash; + type RuntimeHoldReason = RuntimeHoldReason; type CredentialHash = BlakeTwo256; type Currency = Balances; type Deposit = ConstU128<{ 10 * MILLI_UNIT }>; diff --git a/pallets/public-credentials/src/tests.rs b/pallets/public-credentials/src/tests.rs index 146c3c1b1c..fb4f5f0773 100644 --- a/pallets/public-credentials/src/tests.rs +++ b/pallets/public-credentials/src/tests.rs @@ -23,12 +23,11 @@ use frame_support::{ use sp_runtime::traits::Zero; use ctype::mock::get_ctype_hash; -use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, - mock::mock_origin::DoubleOrigin, -}; +use kilt_support::{deposit::Deposit, mock::mock_origin::DoubleOrigin}; -use crate::{mock::*, Config, CredentialIdOf, CredentialSubjects, Credentials, Error, InputClaimsContentOf}; +use crate::{ + mock::*, Config, CredentialIdOf, CredentialSubjects, Credentials, Error, HoldReason, InputClaimsContentOf, +}; // add @@ -57,9 +56,11 @@ fn add_successful_without_authorization() { .with_ctypes(vec![(ctype_hash_1, attester.clone()), (ctype_hash_2, attester.clone())]) .build_and_execute_with_sanity_tests(|| { // Check for 0 reserved deposit - assert!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00).is_zero() - ); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_ok!(PublicCredentials::add( DoubleOrigin(ACCOUNT_00, attester.clone()).into(), @@ -78,7 +79,10 @@ fn add_successful_without_authorization() { // Check deposit reservation logic assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), deposit ); @@ -93,7 +97,10 @@ fn add_successful_without_authorization() { // Check deposit has not changed assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), deposit ); @@ -118,7 +125,10 @@ fn add_successful_without_authorization() { // Deposit is 2x now assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 2 * deposit ); }); @@ -586,9 +596,11 @@ fn remove_successful() { assert!(CredentialSubjects::::get(credential_id).is_none()); // Check deposit release logic - assert!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00).is_zero() - ); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); // Removing the same credential again will fail assert_noop!( @@ -720,9 +732,11 @@ fn reclaim_deposit_successful() { assert!(CredentialSubjects::::get(credential_id).is_none()); // Check deposit release logic - assert!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00).is_zero() - ); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); // Reclaiming the deposit for the same credential again will fail assert_noop!( @@ -816,12 +830,17 @@ fn test_change_deposit_owner() { ACCOUNT_01 ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); - assert!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00).is_zero() - ); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); }); } @@ -917,7 +936,10 @@ fn test_update_deposit() { ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::PublicCredentials), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); }); diff --git a/support/src/deposit.rs b/support/src/deposit.rs index 462a6bfd47..ffdbed7300 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -23,46 +23,6 @@ use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::DispatchError; -#[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen, Copy)] -pub enum HFIdentifier { - Deposit(Pallets), - Staking, - Misc, -} - -#[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen, Copy)] -pub enum Pallets { - Attestation, - Ctype, - Delegation, - Did, - DidLookup, - W3n, - Staking, - PublicCredentials, -} - -impl AsRef for HFIdentifier { - fn as_ref(&self) -> &HFIdentifier { - self - } -} - -impl From for HFIdentifier { - fn from(value: Pallets) -> Self { - match value { - Pallets::Attestation => HFIdentifier::Deposit(Pallets::Attestation), - Pallets::Ctype => HFIdentifier::Deposit(Pallets::Ctype), - Pallets::Delegation => HFIdentifier::Deposit(Pallets::Delegation), - Pallets::Did => HFIdentifier::Deposit(Pallets::Did), - Pallets::DidLookup => HFIdentifier::Deposit(Pallets::DidLookup), - Pallets::W3n => HFIdentifier::Deposit(Pallets::W3n), - Pallets::Staking => HFIdentifier::Deposit(Pallets::Staking), - Pallets::PublicCredentials => HFIdentifier::Deposit(Pallets::PublicCredentials), - } - } -} - /// An amount of balance reserved by the specified address. #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo, MaxEncodedLen)] @@ -71,43 +31,21 @@ pub struct Deposit { pub amount: Balance, } -pub fn reserve_deposit>( +pub fn reserve_deposit>( account: Account, deposit_amount: Currency::Balance, - reason: &HFIdentifier, + reason: &Currency::Reason, ) -> Result, DispatchError> { - let q = Currency::hold(reason, &account, deposit_amount); - q?; + Currency::hold(reason, &account, deposit_amount)?; Ok(Deposit { owner: account, amount: deposit_amount, }) } -pub fn reserve_deposit2>( - account: Account, - deposit_amount: Currency::Balance, - reason: &Reason, -) -> Result, DispatchError> { - let q = Currency::hold(reason, &account, deposit_amount); - q?; - Ok(Deposit { - owner: account, - amount: deposit_amount, - }) -} - -pub fn free_deposit>( - deposit: &Deposit, - reason: &HFIdentifier, -) -> DispatchResult { - Currency::release(reason, &deposit.owner, deposit.amount, Precision::Exact)?; - Ok(()) -} - -pub fn free_deposit2>( +pub fn free_deposit>( deposit: &Deposit, - reason: &Reason, + reason: &Currency::Reason, ) -> DispatchResult { Currency::release(reason, &deposit.owner, deposit.amount, Precision::Exact)?; Ok(()) diff --git a/support/src/lib.rs b/support/src/lib.rs index 99dd552ef0..6b1e3306a8 100644 --- a/support/src/lib.rs +++ b/support/src/lib.rs @@ -18,7 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] pub mod deposit; -pub use deposit::{free_deposit, free_deposit2, reserve_deposit, reserve_deposit2}; +pub use deposit::{free_deposit, reserve_deposit}; pub mod migration; #[cfg(any(feature = "runtime-benchmarks", feature = "mock"))] diff --git a/support/src/migration.rs b/support/src/migration.rs index 64a5e928c7..381b7d0790 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -22,26 +22,18 @@ use frame_support::{ }; use sp_runtime::SaturatedConversion; -use crate::deposit::HFIdentifier; - /// Checks some precondition of the migrations. -pub fn has_user_holds< - AccountId, - Currency: ReservableCurrency + MutateHold, ->( +pub fn has_user_holds + MutateHold>( owner: &AccountId, - reason: &HFIdentifier, + reason: &Currency::Reason, ) -> bool { Currency::balance_on_hold(reason, owner).saturated_into::() == 0 && Currency::reserved_balance(owner).saturated_into::() > 0 } -pub fn switch_reserved_to_hold< - AccountId, - Currency: ReservableCurrency + MutateHold, ->( +pub fn switch_reserved_to_hold + MutateHold>( owner: AccountId, - reason: &HFIdentifier, + reason: &Currency::Reason, amount: u128, ) -> DispatchResult { Currency::unreserve(&owner, amount.saturated_into()); diff --git a/support/src/traits.rs b/support/src/traits.rs index e0addc9011..9592620016 100644 --- a/support/src/traits.rs +++ b/support/src/traits.rs @@ -18,14 +18,11 @@ use frame_support::traits::{ fungible::hold::{Inspect as InspectHold, Mutate}, - tokens::fungible::Inspect, + tokens::fungible::{Inspect, MutateHold}, }; use sp_runtime::DispatchError; -use crate::{ - deposit::{Deposit, HFIdentifier}, - free_deposit, free_deposit2, -}; +use crate::deposit::{free_deposit, Deposit}; /// The sources of a call struct. /// @@ -93,8 +90,7 @@ pub trait ItemFilter { } pub trait StorageDepositCollector { - type Reason; - type Currency: Mutate + InspectHold; + type Currency: MutateHold; /// Returns the deposit of the storage entry that is stored behind the key. fn deposit(key: &Key) @@ -118,10 +114,14 @@ pub trait StorageDepositCollector { /// The deposit balance of the current owner will be freed, while the /// deposit balance of the new owner will get reserved. The deposit amount /// will not change even if the required byte and item fees were updated. - fn change_deposit_owner(key: &Key, new_owner: AccountId, reason: &Self::Reason) -> Result<(), DispatchError> { + fn change_deposit_owner( + key: &Key, + new_owner: AccountId, + reason: &>::Reason, + ) -> Result<(), DispatchError> { let deposit = Self::deposit(key)?; - free_deposit2::(&deposit, reason)?; + free_deposit::(&deposit, reason)?; let deposit = Deposit { owner: new_owner, @@ -140,10 +140,13 @@ pub trait StorageDepositCollector { /// updates the deposit amount. It either frees parts of the reserved /// balance in case the deposit was lowered or reserves more balance when /// the deposit was raised. - fn update_deposit(key: &Key, reason: &Self::Reason) -> Result<(), DispatchError> { + fn update_deposit( + key: &Key, + reason: &>::Reason, + ) -> Result<(), DispatchError> { let deposit = Self::deposit(key)?; - free_deposit2::(&deposit, reason)?; + free_deposit::(&deposit, reason)?; let deposit = Deposit { amount: Self::deposit_amount(key), From 41365fe70a19eba068d78d51eefdf59184a499db Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 15 Jun 2023 15:44:55 +0200 Subject: [PATCH 43/99] get rid of HFIdentifier --- pallets/did/src/benchmarking.rs | 10 +-- pallets/pallet-did-lookup/src/lib.rs | 27 ++++-- pallets/pallet-did-lookup/src/migrations.rs | 16 ++-- pallets/pallet-did-lookup/src/mock.rs | 18 ++-- pallets/pallet-did-lookup/src/tests.rs | 93 ++++++++++++++++----- pallets/parachain-staking/src/lib.rs | 16 ++-- pallets/parachain-staking/src/migrations.rs | 2 +- runtimes/common/Cargo.toml | 31 ++----- runtimes/common/src/xcm_config.rs | 71 +++++++++------- runtimes/peregrine/src/lib.rs | 24 ++++-- runtimes/spiritnet/src/lib.rs | 22 +++-- runtimes/standalone/src/lib.rs | 12 ++- support/Cargo.toml | 2 +- support/src/migration.rs | 5 +- 14 files changed, 208 insertions(+), 141 deletions(-) diff --git a/pallets/did/src/benchmarking.rs b/pallets/did/src/benchmarking.rs index d529c7a1ab..28825eb25f 100644 --- a/pallets/did/src/benchmarking.rs +++ b/pallets/did/src/benchmarking.rs @@ -29,10 +29,7 @@ use sp_io::crypto::{ecdsa_generate, ecdsa_sign, ed25519_generate, ed25519_sign, use sp_runtime::{traits::IdentifyAccount, AccountId32, MultiSigner}; use sp_std::{convert::TryInto, vec::Vec}; -use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, - signature::VerifySignature, -}; +use kilt_support::{deposit::Deposit, signature::VerifySignature}; use crate::{ did_details::{ @@ -44,6 +41,7 @@ use crate::{ }, service_endpoints::DidEndpoint, signature::DidSignatureVerify, + HoldReason, }; const DEFAULT_ACCOUNT_ID: &str = "tx_submitter"; @@ -1150,7 +1148,7 @@ benchmarks! { did_details.deposit.owner = did_account.clone(); make_free_for_did::(&did_account); - CurrencyOf::::hold(&HFIdentifier::Deposit(Pallets::Did), &did_account, did_details.deposit.amount).expect("should reserve currency"); + CurrencyOf::::hold(&T::RuntimeHoldReason::from(HoldReason::Deposit), &did_account, did_details.deposit.amount).expect("should reserve currency"); Did::::insert(&did_subject, did_details); let origin = RawOrigin::Signed(did_subject.clone()); @@ -1176,7 +1174,7 @@ benchmarks! { Did::::insert(&did_subject, did_details.clone()); make_free_for_did::(&did_account); - CurrencyOf::::hold(&HFIdentifier::Deposit(Pallets::Did), &did_account, did_details.deposit.amount).expect("should reserve currency"); + CurrencyOf::::hold(&T::RuntimeHoldReason::from(HoldReason::Deposit), &did_account, did_details.deposit.amount).expect("should reserve currency"); let origin = RawOrigin::Signed(did_subject.clone()); let did_to_update = did_subject.clone(); diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index 2841ac8a42..dfcfeb5d7c 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -64,7 +64,7 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, + deposit::Deposit, traits::{CallSources, StorageDepositCollector}, }; use runtime_common::Balance; @@ -88,6 +88,10 @@ pub mod pallet { pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(4); + #[pallet::composite_enum] + pub enum HoldReason { + Deposit, + } #[pallet::config] pub trait Config: frame_system::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -101,8 +105,10 @@ pub mod pallet { /// The identifier to which accounts can get associated. type DidIdentifier: Parameter + AsRef<[u8]> + MaxEncodedLen + MaybeSerializeDeserialize; + type RuntimeHoldReason: From; + /// The currency that is used to reserve funds for each did. - type Currency: MutateHold, Reason = HFIdentifier, Balance = Balance>; + type Currency: MutateHold, Reason = Self::RuntimeHoldReason, Balance = Balance>; /// The amount of balance that will be taken for each DID as a deposit /// to incentivise fair use of the on chain storage. The deposit can be @@ -249,7 +255,7 @@ pub mod pallet { ensure!( >>::can_hold( - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), &sender, ::Deposit::get() ), @@ -284,7 +290,7 @@ pub mod pallet { ensure!( >>::can_hold( - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), &source.sender(), ::Deposit::get() ), @@ -375,7 +381,7 @@ pub mod pallet { LinkableAccountDepositCollector::::change_deposit_owner( &account, source.sender(), - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) } @@ -390,7 +396,10 @@ pub mod pallet { let record = ConnectedDids::::get(&account).ok_or(Error::::NotFound)?; ensure!(record.deposit.owner == source, Error::::NotAuthorized); - LinkableAccountDepositCollector::::update_deposit(&account, &HFIdentifier::Deposit(Pallets::DidLookup)) + LinkableAccountDepositCollector::::update_deposit( + &account, + &T::RuntimeHoldReason::from(HoldReason::Deposit), + ) } // Old call that was used to migrate @@ -416,7 +425,7 @@ pub mod pallet { kilt_support::reserve_deposit::, CurrencyOf>( record.deposit.owner.clone(), record.deposit.amount, - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; ConnectedDids::::mutate(&account, |did_entry| -> DispatchResult { @@ -425,7 +434,7 @@ pub mod pallet { Self::deposit_event(Event::::AssociationRemoved(account.clone(), old_connection.did)); kilt_support::free_deposit::, CurrencyOf>( &old_connection.deposit, - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; } Ok(()) @@ -441,7 +450,7 @@ pub mod pallet { ConnectedAccounts::::remove(&connection.did, &account); kilt_support::free_deposit::, CurrencyOf>( &connection.deposit, - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), )?; Self::deposit_event(Event::AssociationRemoved(account, connection.did)); diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index b3a566a54f..3760c07fc3 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -22,17 +22,15 @@ use frame_support::{ traits::{Get, GetStorageVersion, OnRuntimeUpgrade, ReservableCurrency, StorageVersion}, weights::Weight, }; -use kilt_support::{ - deposit::{HFIdentifier, Pallets}, - migration::{has_user_holds, switch_reserved_to_hold}, -}; +use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::AccountId32; use sp_std::marker::PhantomData; use crate::{ - linkable_account::LinkableAccountId, AccountIdOf, Config, ConnectedDids, ConnectionRecordOf, CurrencyOf, Pallet, + linkable_account::LinkableAccountId, AccountIdOf, Config, ConnectedDids, ConnectionRecordOf, CurrencyOf, + HoldReason, Pallet, }; /// A unified log target for did-lookup-migration operations. @@ -146,7 +144,7 @@ where .map(|details| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); @@ -169,7 +167,7 @@ where ConnectedDids::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), &details.deposit.owner, ) .saturated_into(); @@ -200,7 +198,7 @@ where .map(|details: ConnectionRecordOf| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user) @@ -215,7 +213,7 @@ where let deposit = did_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), deposit.amount, ); diff --git a/pallets/pallet-did-lookup/src/mock.rs b/pallets/pallet-did-lookup/src/mock.rs index c07c171679..a43584d45f 100644 --- a/pallets/pallet-did-lookup/src/mock.rs +++ b/pallets/pallet-did-lookup/src/mock.rs @@ -18,7 +18,7 @@ use frame_support::parameter_types; use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, + deposit::Deposit, mock::{mock_origin, SubjectId}, }; use sp_runtime::{ @@ -29,7 +29,7 @@ use sp_runtime::{ use crate::{ self as pallet_did_lookup, linkable_account::LinkableAccountId, AccountIdOf, BalanceOf, Config, ConnectedAccounts, - ConnectedDids, ConnectionRecord, CurrencyOf, DidIdentifierOf, + ConnectedDids, ConnectionRecord, CurrencyOf, DidIdentifierOf, HoldReason, }; pub(crate) type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; @@ -50,7 +50,7 @@ frame_support::construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Event}, - DidLookup: pallet_did_lookup::{Pallet, Storage, Call, Event}, + DidLookup: pallet_did_lookup::{Pallet, Storage, Call, Event, HoldReason}, MockOrigin: mock_origin::{Pallet, Origin}, } ); @@ -96,8 +96,8 @@ parameter_types! { } impl pallet_balances::Config for Test { - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; + type HoldIdentifier = RuntimeHoldReason; type MaxFreezes = MaxFreezes; type MaxHolds = MaxHolds; type Balance = Balance; @@ -117,14 +117,12 @@ parameter_types! { impl pallet_did_lookup::Config for Test { type RuntimeEvent = RuntimeEvent; - + type RuntimeHoldReason = RuntimeHoldReason; type Currency = Balances; type Deposit = DidLookupDeposit; - type EnsureOrigin = mock_origin::EnsureDoubleOrigin; type OriginSuccess = mock_origin::DoubleOrigin; type DidIdentifier = SubjectId; - type WeightInfo = (); } @@ -158,7 +156,7 @@ pub(crate) fn insert_raw_connection( kilt_support::reserve_deposit::, CurrencyOf>( record.deposit.owner.clone(), record.deposit.amount, - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) .expect("Account should have enough balance"); @@ -167,7 +165,7 @@ pub(crate) fn insert_raw_connection( ConnectedAccounts::::remove(&old_connection.did, &account); kilt_support::free_deposit::, CurrencyOf>( &old_connection.deposit, - &HFIdentifier::Deposit(Pallets::DidLookup), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) .expect("Could not release deposit of account"); } diff --git a/pallets/pallet-did-lookup/src/tests.rs b/pallets/pallet-did-lookup/src/tests.rs index b9567a0403..e59e4bd459 100644 --- a/pallets/pallet-did-lookup/src/tests.rs +++ b/pallets/pallet-did-lookup/src/tests.rs @@ -17,10 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{assert_noop, assert_ok, crypto::ecdsa::ECDSAExt, traits::fungible::InspectHold}; -use kilt_support::{ - deposit::{Deposit, HFIdentifier, Pallets}, - mock::mock_origin, -}; +use kilt_support::{deposit::Deposit, mock::mock_origin}; use parity_scale_codec::Encode; use sha3::{Digest, Keccak256}; use sp_runtime::{ @@ -35,7 +32,7 @@ use crate::{ linkable_account::LinkableAccountId, mock::*, signature::get_wrapped_payload, - ConnectedAccounts, ConnectedDids, ConnectionRecord, Error, + ConnectedAccounts, ConnectedDids, ConnectionRecord, Error, HoldReason, }; #[test] @@ -60,7 +57,10 @@ fn test_add_association_sender() { ); assert!(ConnectedAccounts::::get(DID_00, LINKABLE_ACCOUNT_00).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); @@ -79,7 +79,10 @@ fn test_add_association_sender() { assert!(ConnectedAccounts::::get(DID_00, LINKABLE_ACCOUNT_00).is_none()); assert!(ConnectedAccounts::::get(DID_01, LINKABLE_ACCOUNT_00).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); }); @@ -124,7 +127,10 @@ fn test_add_association_account() { ConnectedAccounts::::get(DID_00, LinkableAccountId::from(account_hash_alice.clone())).is_some() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); @@ -155,7 +161,10 @@ fn test_add_association_account() { ConnectedAccounts::::get(DID_01, LinkableAccountId::from(account_hash_alice.clone())).is_some() ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); @@ -181,11 +190,17 @@ fn test_add_association_account() { ); assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(account_hash_alice)).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 0 ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); }); @@ -229,7 +244,10 @@ fn test_add_eth_association() { ); assert!(ConnectedAccounts::::get(DID_00, LinkableAccountId::from(eth_account)).is_some()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); }); @@ -301,7 +319,10 @@ fn test_remove_association_sender() { assert_eq!(ConnectedDids::::get(LinkableAccountId::from(ACCOUNT_00)), None); assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(ACCOUNT_00)).is_none()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), 0 ); }); @@ -339,7 +360,10 @@ fn test_remove_association_account() { assert_eq!(ConnectedDids::::get(LinkableAccountId::from(ACCOUNT_00)), None); assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(ACCOUNT_00)).is_none()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), 0 ); }); @@ -382,7 +406,10 @@ fn test_remove_association_account_not_authorized() { Error::::NotAuthorized ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); }); @@ -402,7 +429,10 @@ fn test_reclaim_deposit() { ACCOUNT_00.into() )); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), 0 ); }); @@ -422,7 +452,10 @@ fn test_reclaim_deposit_not_authorized() { Error::::NotAuthorized ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); }); @@ -444,9 +477,16 @@ fn test_change_deposit_owner() { mock_origin::DoubleOrigin(ACCOUNT_01, DID_00).into(), ACCOUNT_00.into() )); - assert!(Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ) + .is_zero()); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_01), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_01 + ), ::Deposit::get() ); }) @@ -514,7 +554,10 @@ fn test_update_deposit() { ::Deposit::get() * 2, ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 2 ); assert_ok!(DidLookup::update_deposit( @@ -522,7 +565,10 @@ fn test_update_deposit() { ACCOUNT_00.into() )); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() ); }) @@ -543,7 +589,10 @@ fn test_update_deposit_unauthorized() { ::Deposit::get() * 2, ); assert_eq!( - Balances::balance_on_hold(&HFIdentifier::Deposit(Pallets::DidLookup), &ACCOUNT_00), + Balances::balance_on_hold( + &::RuntimeHoldReason::from(HoldReason::Deposit), + &ACCOUNT_00 + ), ::Deposit::get() * 2 ); assert_noop!( diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 9f7e272132..57604fd522 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -210,7 +210,10 @@ pub mod pallet { > + LockableCurrency + Eq; - type FreezeIdentifier: From + PartialEq; + type FreezeIdentifier: From + + PartialEq + + Eq + + Into<::FreezeIdentifier>; /// Just the `Currency::Balance` type; we have this item to allow us to /// constrain it to `From`. @@ -2330,12 +2333,11 @@ pub mod pallet { // iterate balance freezes to retrieve amount of freezed balance let freezes = Freezes::::get(who); - total_freezed = if let Some(IdAmount { amount, .. }) = - freezes - .iter() - .find(|l: IdAmount<::FreezeIdentifier, _>| { - l.id == ::FreezeIdentifier::from(FreezeReason::Staking) - }) { + + total_freezed = if let Some(IdAmount { amount, .. }) = freezes + .iter() + .find(|l| l.id == ::FreezeIdentifier::from(FreezeReason::Staking).into()) + { amount.saturating_sub(total_unfreezed.into()).into() } else { // should never fail to find the lock since we checked whether unstaking is not diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index e5ddf99e37..ee92674bb6 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -110,7 +110,7 @@ fn update_or_create_freeze( let result = if let Some(IdAmount { amount, .. }) = freezes .iter() - .find(|freeze| freeze.id == ::FreezeIdentifier::from(FreezeReason::Staking)) + .find(|freeze| freeze.id == ::FreezeIdentifier::from(FreezeReason::Staking).into()) { let total_lock = lock .amount diff --git a/runtimes/common/Cargo.toml b/runtimes/common/Cargo.toml index 104e908114..463fa392d9 100644 --- a/runtimes/common/Cargo.toml +++ b/runtimes/common/Cargo.toml @@ -1,33 +1,27 @@ [package] authors.workspace = true +description = "Common interfaces, types, constants and functionality for all KILT runtimes." documentation.workspace = true edition.workspace = true homepage.workspace = true license-file.workspace = true +name = "runtime-common" readme.workspace = true repository.workspace = true version.workspace = true -name = "runtime-common" -description = "Common interfaces, types, constants and functionality for all KILT runtimes." [dev-dependencies] sp-io = {workspace = true, features = ["std"]} [dependencies] # External dependencies -parity-scale-codec = {workspace = true, features = ["derive"]} -log.workspace = true kilt-asset-dids.workspace = true +log.workspace = true +parity-scale-codec = {workspace = true, features = ["derive"]} scale-info = {workspace = true, features = ["derive"]} smallvec.workspace = true -# # Internal dependencies - attestation.workspace = true -# ctype.workspace = true -# delegation = {workspace = true, optional = true} -# did = {workspace = true, optional = true} -# pallet-did-lookup = {workspace = true, optional = true} -# pallet-inflation = {workspace = true, optional = true} +attestation.workspace = true kilt-support.workspace = true parachain-staking.workspace = true public-credentials.workspace = true @@ -51,22 +45,20 @@ cumulus-primitives-core.workspace = true # Polkadot dependencies polkadot-parachain.workspace = true -xcm.workspace = true xcm-builder.workspace = true xcm-executor.workspace = true +xcm.workspace = true [features] default = ["std"] fast-gov = [] runtime-benchmarks = [ - "attestation/runtime-benchmarks", - # "ctype/runtime-benchmarks", + "attestation/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "kilt-support/runtime-benchmarks", "pallet-balances/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - # "parachain-staking/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", "polkadot-parachain/runtime-benchmarks", "public-credentials/runtime-benchmarks", "sp-runtime/runtime-benchmarks", @@ -75,8 +67,7 @@ runtime-benchmarks = [ ] std = [ "attestation/std", - "parity-scale-codec/std", - # "ctype/std", + "parity-scale-codec/std", # "ctype/std", "cumulus-primitives-core/std", "frame-support/std", "frame-system/std", @@ -102,15 +93,11 @@ std = [ ] try-runtime = [ "attestation/try-runtime", - # "delegation", - # "did", "frame-support/try-runtime", "frame-system/try-runtime", "kilt-support/try-runtime", "pallet-authorship/try-runtime", "pallet-balances/try-runtime", - # "pallet-did-lookup", - # "pallet-inflation", "pallet-membership/try-runtime", "pallet-transaction-payment/try-runtime", "parachain-staking/try-runtime", diff --git a/runtimes/common/src/xcm_config.rs b/runtimes/common/src/xcm_config.rs index 2dc1a7ea1d..56399d4b86 100644 --- a/runtimes/common/src/xcm_config.rs +++ b/runtimes/common/src/xcm_config.rs @@ -16,7 +16,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use core::marker::PhantomData; +use core::{marker::PhantomData, ops::ControlFlow}; use frame_support::{log, match_types, parameter_types, traits::ProcessMessageError, weights::Weight}; use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; @@ -64,55 +64,62 @@ where /// Reserved funds to the relay chain can't return. See https://github.com/paritytech/polkadot/issues/5233 pub struct DenyReserveTransferToRelayChain; impl ShouldExecute for DenyReserveTransferToRelayChain { - fn should_execute( + fn should_execute( origin: &MultiLocation, - instructions: &mut [Instruction], + message: &mut [Instruction], _max_weight: Weight, _weight_credit: &mut Weight, ) -> Result<(), ProcessMessageError> { - if instructions.iter().any(|inst| { - matches!( - inst, + xcm_builder::MatchXcm::match_next_inst_while( + xcm_builder::CreateMatcher::matcher(message), + |_| true, + |inst| match inst { InitiateReserveWithdraw { reserve: MultiLocation { parents: 1, - interior: Here + interior: Here, }, .. - } | DepositReserveAsset { + } + | DepositReserveAsset { dest: MultiLocation { parents: 1, - interior: Here + interior: Here, }, .. - } | TransferReserveAsset { + } + | TransferReserveAsset { dest: MultiLocation { parents: 1, - interior: Here + interior: Here, }, .. + } => { + Err(ProcessMessageError::Unsupported) // Deny } - ) - }) { - return Err(ProcessMessageError::Corrupt); // Deny - } - - // Allow reserve transfers to arrive from relay chain - if matches!( - origin, - MultiLocation { - parents: 1, - interior: Here - } - ) && instructions - .iter() - .any(|inst| matches!(inst, ReserveAssetDeposited { .. })) - { - log::warn!( - target: "xcm::barriers", - "Unexpected ReserveAssetDeposited from the relay chain", - ); - } + + // An unexpected reserve transfer has arrived from the Relay Chain. Generally, + // `IsReserve` should not allow this, but we just log it here. + ReserveAssetDeposited { .. } + if matches!( + origin, + MultiLocation { + parents: 1, + interior: Here + } + ) => + { + log::warn!( + target: "xcm::barrier", + "Unexpected ReserveAssetDeposited from the Relay Chain", + ); + Ok(ControlFlow::Continue(())) + } + + _ => Ok(ControlFlow::Continue(())), + }, + )?; + // Permit everything else Ok(()) } diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 1fd7f7e794..96ef4aad6c 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -49,7 +49,7 @@ use sp_version::RuntimeVersion; use xcm_executor::XcmExecutor; use delegation::DelegationAc; -use kilt_support::{deposit::HFIdentifier, traits::ItemFilter}; +use kilt_support::traits::ItemFilter; use pallet_did_lookup::linkable_account::LinkableAccountId; pub use parachain_staking::InflationInfo; pub use public_credentials; @@ -198,13 +198,14 @@ impl pallet_indices::Config for Runtime { impl pallet_balances::Config for Runtime { /// The type for recording an account's balance. type Balance = Balance; - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; + type HoldIdentifier = RuntimeHoldReason; type MaxFreezes = MaxFreezes; type MaxHolds = MaxHolds; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; + // type DustRemoval = Treasury; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; @@ -437,6 +438,7 @@ parameter_types! { pub const SpendPeriod: BlockNumber = constants::governance::SPEND_PERIOD; pub const Burn: Permill = Permill::zero(); pub const MaxApprovals: u32 = 100; + pub MaxProposalWeight: Weight = Perbill::from_percent(50) * BlockWeights::get().max_block; } type ApproveOrigin = EitherOfDiverse< @@ -470,7 +472,7 @@ impl pallet_treasury::Config for Runtime { type CouncilCollective = pallet_collective::Instance1; impl pallet_collective::Config for Runtime { - type MaxProposalWeight = (); + type MaxProposalWeight = MaxProposalWeight; type RuntimeOrigin = RuntimeOrigin; type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; @@ -485,7 +487,7 @@ impl pallet_collective::Config for Runtime { type TechnicalCollective = pallet_collective::Instance2; impl pallet_collective::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; - type MaxProposalWeight = (); + type MaxProposalWeight = MaxProposalWeight; type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type MotionDuration = constants::governance::TechnicalMotionDuration; @@ -544,7 +546,7 @@ impl pallet_configuration::Config for Runtime { impl attestation::Config for Runtime { type EnsureOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; - + type RuntimeHoldReason = RuntimeHoldReason; type RuntimeEvent = RuntimeEvent; type WeightInfo = weights::attestation::WeightInfo; @@ -574,6 +576,7 @@ impl delegation::Config for Runtime { type DelegationSignatureVerification = AlwaysVerify, Self::Signature>; type RuntimeEvent = RuntimeEvent; + type RuntimeHoldReason = RuntimeHoldReason; type MaxSignatureByteLength = constants::delegation::MaxSignatureByteLength; type MaxParentChecks = constants::delegation::MaxParentChecks; type MaxRevocations = constants::delegation::MaxRevocations; @@ -602,6 +605,7 @@ impl did::Config for Runtime { type DidIdentifier = DidIdentifier; type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; + type RuntimeHoldReason = RuntimeHoldReason; type KeyDeposit = constants::did::KeyDeposit; type ServiceEndpointDeposit = constants::did::ServiceEndpointDeposit; type BaseDeposit = constants::did::DidBaseDeposit; @@ -634,6 +638,7 @@ impl did::Config for Runtime { } impl pallet_did_lookup::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; type RuntimeEvent = RuntimeEvent; type DidIdentifier = DidIdentifier; @@ -653,6 +658,7 @@ impl pallet_web3_names::Config for Runtime { type OriginSuccess = did::DidRawOrigin; type Currency = Balances; type Deposit = constants::web3_names::Web3NameDeposit; + type RuntimeHoldReason = RuntimeHoldReason; type RuntimeEvent = RuntimeEvent; type MaxNameLength = constants::web3_names::MaxNameLength; type MinNameLength = constants::web3_names::MinNameLength; @@ -673,8 +679,7 @@ impl parachain_staking::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Currency = Balances; type CurrencyBalance = Balance; - type Identifier = HFIdentifier; - + type FreezeIdentifier = RuntimeFreezeReason; type MinBlocksPerRound = constants::staking::MinBlocksPerRound; type DefaultBlocksPerRound = constants::staking::DefaultBlocksPerRound; type StakeDuration = constants::staking::StakeDuration; @@ -704,6 +709,7 @@ impl pallet_utility::Config for Runtime { } impl public_credentials::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; type AccessControl = PalletAuthorize>; type AttesterId = DidIdentifier; type AuthorizationId = AuthorizationId<::DelegationNodeId>; @@ -1098,8 +1104,8 @@ pub type Executive = frame_executive::Executive< did::migrations::BalanceMigration, pallet_did_lookup::migrations::BalanceMigration, pallet_web3_names::migrations::BalanceMigration, - public_credentials::migrations::BalanceMigration, parachain_staking::migrations::BalanceMigration, + public_credentials::migrations::BalanceMigration, ), >; diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 075a499635..5b28a430f0 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -50,7 +50,7 @@ use sp_version::RuntimeVersion; use xcm_executor::XcmExecutor; use delegation::DelegationAc; -use kilt_support::{deposit::HFIdentifier, traits::ItemFilter}; +use kilt_support::traits::ItemFilter; use pallet_did_lookup::linkable_account::LinkableAccountId; pub use parachain_staking::InflationInfo; pub use public_credentials; @@ -197,14 +197,15 @@ impl pallet_indices::Config for Runtime { } impl pallet_balances::Config for Runtime { - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; + type HoldIdentifier = RuntimeHoldReason; type MaxFreezes = MaxFreezes; type MaxHolds = MaxHolds; /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; + // type DustRemoval = Treasury; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; @@ -432,6 +433,7 @@ parameter_types! { pub const SpendPeriod: BlockNumber = constants::governance::SPEND_PERIOD; pub const Burn: Permill = Permill::zero(); pub const MaxApprovals: u32 = 100; + pub MaxProposalWeight: Weight = Perbill::from_percent(50) * BlockWeights::get().max_block; } type ApproveOrigin = EitherOfDiverse< @@ -468,7 +470,7 @@ impl pallet_collective::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type MaxProposalWeight = (); + type MaxProposalWeight = MaxProposalWeight; type MotionDuration = constants::governance::CouncilMotionDuration; type MaxProposals = constants::governance::CouncilMaxProposals; type MaxMembers = constants::governance::CouncilMaxMembers; @@ -480,7 +482,7 @@ impl pallet_collective::Config for Runtime { type TechnicalCollective = pallet_collective::Instance2; impl pallet_collective::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; - type MaxProposalWeight = (); + type MaxProposalWeight = MaxProposalWeight; type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type MotionDuration = constants::governance::TechnicalMotionDuration; @@ -531,6 +533,7 @@ impl pallet_tips::Config for Runtime { } impl attestation::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; type EnsureOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; @@ -547,6 +550,7 @@ impl attestation::Config for Runtime { impl delegation::Config for Runtime { type DelegationEntityId = DidIdentifier; + type RuntimeHoldReason = RuntimeHoldReason; type DelegationNodeId = Hash; type EnsureOrigin = did::EnsureDidOrigin; @@ -592,6 +596,7 @@ impl ctype::Config for Runtime { impl did::Config for Runtime { type DidIdentifier = DidIdentifier; type RuntimeEvent = RuntimeEvent; + type RuntimeHoldReason = RuntimeHoldReason; type RuntimeCall = RuntimeCall; type RuntimeOrigin = RuntimeOrigin; type Currency = Balances; @@ -625,6 +630,7 @@ impl did::Config for Runtime { } impl pallet_did_lookup::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; type RuntimeEvent = RuntimeEvent; type DidIdentifier = DidIdentifier; @@ -639,6 +645,7 @@ impl pallet_did_lookup::Config for Runtime { } impl pallet_web3_names::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; type BanOrigin = EnsureRoot; type OwnerOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; @@ -661,7 +668,7 @@ impl pallet_inflation::Config for Runtime { } impl parachain_staking::Config for Runtime { - type Identifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; type RuntimeEvent = RuntimeEvent; type Currency = Balances; type CurrencyBalance = Balance; @@ -696,6 +703,7 @@ impl pallet_utility::Config for Runtime { impl public_credentials::Config for Runtime { type AccessControl = PalletAuthorize>; + type RuntimeHoldReason = RuntimeHoldReason; type AttesterId = DidIdentifier; type AuthorizationId = AuthorizationId<::DelegationNodeId>; type CredentialId = Hash; @@ -1083,8 +1091,8 @@ pub type Executive = frame_executive::Executive< did::migrations::BalanceMigration, pallet_did_lookup::migrations::BalanceMigration, pallet_web3_names::migrations::BalanceMigration, - public_credentials::migrations::BalanceMigration, parachain_staking::migrations::BalanceMigration, + public_credentials::migrations::BalanceMigration, ), >; diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index 02b0b54098..8cd7af77d2 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -54,7 +54,7 @@ use sp_std::prelude::*; use sp_version::RuntimeVersion; use delegation::DelegationAc; -use kilt_support::{deposit::HFIdentifier, traits::ItemFilter}; +use kilt_support::traits::ItemFilter; use pallet_did_lookup::linkable_account::LinkableAccountId; use runtime_common::{ assets::{AssetDid, PublicCredentialsFilter}, @@ -250,8 +250,8 @@ parameter_types! { } impl pallet_balances::Config for Runtime { - type FreezeIdentifier = HFIdentifier; - type HoldIdentifier = HFIdentifier; + type FreezeIdentifier = RuntimeFreezeReason; + type HoldIdentifier = RuntimeHoldReason; type MaxFreezes = MaxFreezes; type MaxHolds = MaxHolds; type MaxLocks = MaxLocks; @@ -293,6 +293,7 @@ parameter_types! { } impl attestation::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; type EnsureOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; type RuntimeEvent = RuntimeEvent; @@ -316,6 +317,7 @@ parameter_types! { } impl delegation::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; #[cfg(not(feature = "runtime-benchmarks"))] type Signature = did::DidSignature; #[cfg(not(feature = "runtime-benchmarks"))] @@ -375,6 +377,7 @@ parameter_types! { } impl did::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; type DidIdentifier = DidIdentifier; type KeyDeposit = constants::did::KeyDeposit; type ServiceEndpointDeposit = constants::did::ServiceEndpointDeposit; @@ -410,6 +413,7 @@ impl did::Config for Runtime { } impl pallet_did_lookup::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; type RuntimeEvent = RuntimeEvent; type DidIdentifier = DidIdentifier; @@ -424,6 +428,7 @@ impl pallet_did_lookup::Config for Runtime { } impl pallet_web3_names::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; type BanOrigin = EnsureRoot; type OwnerOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; @@ -471,6 +476,7 @@ impl pallet_utility::Config for Runtime { } impl public_credentials::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; type AccessControl = PalletAuthorize>; type AttesterId = DidIdentifier; type AuthorizationId = AuthorizationId<::DelegationNodeId>; diff --git a/support/Cargo.toml b/support/Cargo.toml index d1fd2bbc2f..5a606fa9fb 100644 --- a/support/Cargo.toml +++ b/support/Cargo.toml @@ -13,7 +13,7 @@ version.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] -[dependencies] +[dependencies] # External dependencies parity-scale-codec = {workspace = true, features = ["derive"]} scale-info = {workspace = true, features = ["derive"]} diff --git a/support/src/migration.rs b/support/src/migration.rs index 381b7d0790..b2861ea947 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -20,15 +20,14 @@ use frame_support::{ pallet_prelude::DispatchResult, traits::{fungible::hold::Mutate as MutateHold, ReservableCurrency}, }; -use sp_runtime::SaturatedConversion; +use sp_runtime::{traits::Zero, SaturatedConversion}; /// Checks some precondition of the migrations. pub fn has_user_holds + MutateHold>( owner: &AccountId, reason: &Currency::Reason, ) -> bool { - Currency::balance_on_hold(reason, owner).saturated_into::() == 0 - && Currency::reserved_balance(owner).saturated_into::() > 0 + Currency::balance_on_hold(reason, owner) == Zero::zero() && Currency::reserved_balance(owner) > Zero::zero() } pub fn switch_reserved_to_hold + MutateHold>( From fc55e3b5d6eebfcfd0438d94e3282e3d4b8f8baa Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 15 Jun 2023 16:09:58 +0200 Subject: [PATCH 44/99] clippy --- pallets/public-credentials/src/migrations.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index f9b0cf5959..615e7d7119 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -50,7 +50,7 @@ where .map(|details: CredentialEntryOf| { has_user_holds::, CurrencyOf>( &details.deposit.owner, - &&T::RuntimeHoldReason::from(HoldReason::Deposit), + &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); @@ -72,7 +72,7 @@ where Credentials::::iter().try_for_each(|(key, key2, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( - &&T::RuntimeHoldReason::from(HoldReason::Deposit), + &T::RuntimeHoldReason::from(HoldReason::Deposit), &details.deposit.owner, ) .saturated_into(); From 1dbd9c8edebbf377970b15a47779490eb5f104c1 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 19 Jun 2023 16:01:01 +0200 Subject: [PATCH 45/99] with ctypes --- Cargo.lock | 1 + pallets/ctype/src/benchmarking.rs | 4 ++-- pallets/ctype/src/lib.rs | 35 ++++++++++++++++++------------- pallets/ctype/src/tests.rs | 4 ++-- runtimes/common/Cargo.toml | 5 +++-- runtimes/common/src/lib.rs | 14 ++++++++++++- runtimes/peregrine/src/lib.rs | 7 +++---- 7 files changed, 44 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f78af575ce..95babb91a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9284,6 +9284,7 @@ dependencies = [ "pallet-balances", "pallet-membership", "pallet-transaction-payment", + "pallet-treasury", "parachain-staking", "parity-scale-codec", "polkadot-parachain", diff --git a/pallets/ctype/src/benchmarking.rs b/pallets/ctype/src/benchmarking.rs index fdd177ac08..2d32987a98 100644 --- a/pallets/ctype/src/benchmarking.rs +++ b/pallets/ctype/src/benchmarking.rs @@ -53,7 +53,7 @@ benchmarks! { let ctype_hash = ::Hashing::hash(&ctype[..]); let initial_balance = ::Fee::get() * ctype.len().try_into().unwrap() + ::Currency::minimum_balance(); - ::Currency::make_free_balance_be(&caller, initial_balance); + ::Currency::set_balance(&caller, initial_balance); let origin = T::EnsureOrigin::generate_origin(caller, did.clone()); }: _(origin, ctype) @@ -73,7 +73,7 @@ benchmarks! { let new_block_number = 500u64.into(); let initial_balance = ::Fee::get() * ctype.len().try_into().unwrap() + ::Currency::minimum_balance(); - ::Currency::make_free_balance_be(&caller, initial_balance); + ::Currency::set_balance(&caller, initial_balance); let origin = T::EnsureOrigin::generate_origin(caller, did); Pallet::::add(origin, ctype).expect("CType creation should not fail."); let overarching_origin = T::OverarchingOrigin::try_successful_origin().expect("Successful origin creation should not fail."); diff --git a/pallets/ctype/src/lib.rs b/pallets/ctype/src/lib.rs index 1f55530ad8..a4c27d8f6d 100644 --- a/pallets/ctype/src/lib.rs +++ b/pallets/ctype/src/lib.rs @@ -63,11 +63,15 @@ pub mod pallet { use frame_support::{ pallet_prelude::*, sp_runtime::traits::Hash, - traits::{Currency, ExistenceRequirement, OnUnbalanced, StorageVersion, WithdrawReasons}, + traits::{ + fungible::{Balanced, Credit, Inspect}, + tokens::{Fortitude, Precision, Preservation}, + OnUnbalanced, StorageVersion, + }, }; use frame_system::pallet_prelude::*; use kilt_support::traits::CallSources; - use sp_runtime::{traits::Saturating, SaturatedConversion}; + use sp_runtime::SaturatedConversion; use sp_std::vec::Vec; use crate::ctype_entry::CtypeEntry; @@ -85,8 +89,8 @@ pub mod pallet { pub(crate) type AccountIdOf = ::AccountId; - pub(crate) type BalanceOf = <::Currency as Currency>>::Balance; - type NegativeImbalanceOf = <::Currency as Currency>>::NegativeImbalance; + pub(crate) type BalanceOf = <::Currency as Inspect>>::Balance; + type CreditOf = Credit<::AccountId, ::Currency>; #[pallet::config] pub trait Config: frame_system::Config { @@ -94,11 +98,11 @@ pub mod pallet { type OverarchingOrigin: EnsureOrigin<::RuntimeOrigin>; type OriginSuccess: CallSources, CtypeCreatorOf>; type RuntimeEvent: From> + IsType<::RuntimeEvent>; - type Currency: Currency>; + type Currency: Balanced>; type WeightInfo: WeightInfo; type CtypeCreatorId: Parameter + MaxEncodedLen; type Fee: Get>; - type FeeCollector: OnUnbalanced>; + type FeeCollector: OnUnbalanced>; } #[pallet::pallet] @@ -160,13 +164,13 @@ pub mod pallet { // Check the free balance before we do any heavy work (e.g. calculate the ctype // hash) - let balance = >>::free_balance(&payer); - >>::ensure_can_withdraw( + let balance = >>::reducible_balance( &payer, - T::Fee::get(), - WithdrawReasons::FEE, - balance.saturating_sub(T::Fee::get()), - )?; + Preservation::Preserve, + Fortitude::Polite, + ); + + ensure!(balance >= T::Fee::get(), Error::::UnableToPayFees); let hash = ::Hashing::hash(&ctype[..]); @@ -174,11 +178,12 @@ pub mod pallet { // Collect the fees. This should not fail since we checked the free balance in // the beginning. - let imbalance = >>::withdraw( + let imbalance = >>::withdraw( &payer, T::Fee::get(), - WithdrawReasons::FEE, - ExistenceRequirement::AllowDeath, + Precision::Exact, + Preservation::Protect, + Fortitude::Polite, ) .map_err(|_| Error::::UnableToPayFees)?; diff --git a/pallets/ctype/src/tests.rs b/pallets/ctype/src/tests.rs index 463164c301..5f5a922145 100644 --- a/pallets/ctype/src/tests.rs +++ b/pallets/ctype/src/tests.rs @@ -16,7 +16,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{assert_noop, assert_ok, sp_runtime::traits::Hash}; +use frame_support::{assert_noop, assert_ok, sp_runtime::traits::Hash, traits::fungible::Inspect}; use frame_system::RawOrigin; use sp_runtime::DispatchError; @@ -53,7 +53,7 @@ fn check_successful_ctype_creation() { } ); assert_eq!( - Balances::free_balance(deposit_owner), + Balances::balance(&deposit_owner), initial_balance.saturating_sub(::Fee::get()) ); }); diff --git a/runtimes/common/Cargo.toml b/runtimes/common/Cargo.toml index 463fa392d9..20e55bad63 100644 --- a/runtimes/common/Cargo.toml +++ b/runtimes/common/Cargo.toml @@ -34,6 +34,7 @@ pallet-authorship.workspace = true pallet-balances.workspace = true pallet-membership.workspace = true pallet-transaction-payment.workspace = true +pallet-treasury.workspace = true sp-consensus-aura.workspace = true sp-core.workspace = true sp-io.workspace = true @@ -53,12 +54,12 @@ xcm.workspace = true default = ["std"] fast-gov = [] runtime-benchmarks = [ - "attestation/runtime-benchmarks", + "attestation/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "kilt-support/runtime-benchmarks", "pallet-balances/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", "polkadot-parachain/runtime-benchmarks", "public-credentials/runtime-benchmarks", "sp-runtime/runtime-benchmarks", diff --git a/runtimes/common/src/lib.rs b/runtimes/common/src/lib.rs index d627b067a9..fe8bf4d80b 100644 --- a/runtimes/common/src/lib.rs +++ b/runtimes/common/src/lib.rs @@ -29,9 +29,10 @@ pub use frame_support::weights::constants::{BlockExecutionWeight, ExtrinsicBaseW use frame_support::{ dispatch::DispatchClass, parameter_types, - traits::{Contains, ContainsLengthBound, Currency, Get, SortedMembers}, + traits::{fungible::Credit, Contains, ContainsLengthBound, Currency, Get, Imbalance, OnUnbalanced, SortedMembers}, }; use frame_system::limits; +use pallet_balances::Pallet as PalletBalance; use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment}; use sp_runtime::{ generic, @@ -73,6 +74,8 @@ pub mod opaque { /// An index to a block. pub type BlockNumber = u64; +type CreditOf = Credit<::AccountId, PalletBalance>; + /// Alias to 512-bit hash when used in the context of a transaction signature on /// the chain. pub type Signature = MultiSignature; @@ -196,3 +199,12 @@ where }) } } + +pub struct DustAndFeeHandler(sp_std::marker::PhantomData); + +impl OnUnbalanced> for DustAndFeeHandler { + fn on_nonzero_unbalanced(amount: CreditOf) { + let treasury_account_id = pallet_treasury::Pallet::::account_id(); + let _ = pallet_balances::Pallet::::deposit_creating(&treasury_account_id, amount.peek()); + } +} diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 96ef4aad6c..ba855dae84 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -205,8 +205,7 @@ impl pallet_balances::Config for Runtime { /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; - // type DustRemoval = Treasury; - type DustRemoval = (); + type DustRemoval = runtime_common::DustAndFeeHandler; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = weights::pallet_balances::WeightInfo; @@ -591,7 +590,7 @@ impl ctype::Config for Runtime { type CtypeCreatorId = AccountId; type Currency = Balances; type Fee = constants::CtypeFee; - type FeeCollector = Treasury; + type FeeCollector = runtime_common::DustAndFeeHandler; type EnsureOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; @@ -612,7 +611,7 @@ impl did::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type Currency = Balances; type Fee = constants::did::DidFee; - type FeeCollector = Treasury; + type FeeCollector = runtime_common::DustAndFeeHandler; #[cfg(not(feature = "runtime-benchmarks"))] type EnsureOrigin = did::EnsureDidOrigin; From 3adc85c8f56bdebc038a82ed222b522894eb787e Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 19 Jun 2023 16:21:48 +0200 Subject: [PATCH 46/99] finished --- pallets/did/src/lib.rs | 29 +++++++++++++------------ pallets/did/src/migrations.rs | 17 +++++++++++---- pallets/did/src/mock.rs | 40 ++++++++++++++++++----------------- 3 files changed, 49 insertions(+), 37 deletions(-) diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index 76d6e1609c..cc29d515a5 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -119,7 +119,7 @@ use frame_support::{ dispatch::{DispatchError, DispatchResult, Dispatchable, GetDispatchInfo, PostDispatchInfo}, ensure, storage::types::StorageMap, - traits::{Get, OnUnbalanced, WithdrawReasons}, + traits::{Get, OnUnbalanced}, Parameter, }; use frame_system::ensure_signed; @@ -140,8 +140,9 @@ pub mod pallet { use frame_support::{ pallet_prelude::*, traits::{ - fungible::{Inspect, MutateHold}, - Currency, ExistenceRequirement, Imbalance, ReservableCurrency, StorageVersion, + fungible::{Balanced, Credit, Inspect, MutateHold}, + tokens::{Fortitude, Precision, Preservation}, + StorageVersion, }, }; use frame_system::pallet_prelude::*; @@ -187,7 +188,7 @@ pub mod pallet { pub type BalanceOf = as Inspect>>::Balance; pub(crate) type CurrencyOf = ::Currency; - pub(crate) type NegativeImbalanceOf = <::Currency as Currency>>::NegativeImbalance; + pub(crate) type CreditOf = Credit<::AccountId, ::Currency>; #[pallet::composite_enum] pub enum HoldReason { @@ -227,8 +228,7 @@ pub mod pallet { type RuntimeHoldReason: From; /// The currency that is used to reserve funds for each did. - type Currency: ReservableCurrency> - + MutateHold, Reason = Self::RuntimeHoldReason>; + type Currency: Balanced> + MutateHold, Reason = Self::RuntimeHoldReason>; /// The amount of balance that will be taken for each DID as a deposit /// to incentivise fair use of the on chain storage. The deposits @@ -256,7 +256,7 @@ pub mod pallet { type Fee: Get>; /// The logic for handling the fee. - type FeeCollector: OnUnbalanced>; + type FeeCollector: OnUnbalanced>; /// Maximum number of total public keys which can be stored per DID key /// identifier. This includes the ones currently used for @@ -593,15 +593,16 @@ pub mod pallet { Did::::insert(&did_identifier, did_entry.clone()); // Withdraw the fee. We made sure that enough balance is available. But if this - // fails, we don't withdraw anything. - - let imbalance = >>::withdraw( + // fails, we don't withdraw anything. Since we do the best effort we can unwrap + // the result. + let imbalance: CreditOf = >>::withdraw( &did_entry.deposit.owner, - T::Fee::get().saturated_into::().saturated_into(), - WithdrawReasons::FEE, - ExistenceRequirement::AllowDeath, + T::Fee::get(), + Precision::BestEffort, + Preservation::Protect, + Fortitude::Polite, ) - .unwrap_or_else(|_| NegativeImbalanceOf::::zero()); + .unwrap(); T::FeeCollector::on_unbalanced(imbalance); Self::deposit_event(Event::DidCreated(sender, did_identifier)); diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index 1c19e51164..a41afd60a9 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade}, + traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, weights::Weight, }; use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; @@ -29,7 +29,10 @@ use crate::{did_details::DidDetails, AccountIdOf, Config, CurrencyOf, Did, HoldR pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration { +impl OnRuntimeUpgrade for BalanceMigration +where + ::Currency: ReservableCurrency, +{ fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Did: Initiating migration"); if is_upgraded::() { @@ -92,7 +95,10 @@ impl OnRuntimeUpgrade for BalanceMigration { /// Checks if there is an user, who has still reserved balance and no holds. If /// yes, the migration is not executed yet. -fn is_upgraded() -> bool { +fn is_upgraded() -> bool +where + ::Currency: ReservableCurrency, +{ Did::::iter_values() .map(|details: DidDetails| { has_user_holds::, CurrencyOf>( @@ -103,7 +109,10 @@ fn is_upgraded() -> bool { .all(|user| user) } -fn do_migration() -> Weight { +fn do_migration() -> Weight +where + ::Currency: ReservableCurrency, +{ Did::::iter() .map(|(key, did_details)| -> Weight { let deposit = did_details.deposit; diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index 0ccd5e2811..cd24c89f5f 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -16,21 +16,6 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{ - parameter_types, - traits::{fungible::MutateHold, Currency, OnUnbalanced}, - weights::constants::RocksDbWeight, -}; -use frame_system::EnsureSigned; -use pallet_balances::NegativeImbalance; -use sp_core::{ecdsa, ed25519, sr25519, Pair}; -use sp_runtime::{ - testing::{Header, H256}, - traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, - MultiSignature, MultiSigner, SaturatedConversion, -}; -use sp_std::vec::Vec; - use crate::{ self as did, did_details::{ @@ -45,6 +30,23 @@ use crate::{ }; #[cfg(not(feature = "runtime-benchmarks"))] use crate::{DidRawOrigin, EnsureDidOrigin}; +use frame_support::{ + parameter_types, + traits::{ + fungible::{Credit, MutateHold}, + Currency, Imbalance, OnUnbalanced, + }, + weights::constants::RocksDbWeight, +}; +use frame_system::EnsureSigned; +use pallet_balances::Pallet as PalletBalance; +use sp_core::{ecdsa, ed25519, sr25519, Pair}; +use sp_runtime::{ + testing::{Header, H256}, + traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, + MultiSignature, MultiSigner, SaturatedConversion, +}; +use sp_std::vec::Vec; pub(crate) type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; pub(crate) type Block = frame_system::mocking::MockBlock; @@ -55,7 +57,7 @@ pub(crate) type AccountPublic = ::Signer; pub(crate) type AccountId = ::AccountId; pub(crate) type Index = u64; pub(crate) type BlockNumber = u64; - +type CreditOf = Credit<::AccountId, PalletBalance>; pub(crate) type DidIdentifier = AccountId; pub(crate) type CtypeHash = Hash; @@ -131,13 +133,13 @@ parameter_types! { pub struct ToAccount(sp_std::marker::PhantomData); -impl OnUnbalanced> for ToAccount +impl OnUnbalanced> for ToAccount where R: pallet_balances::Config, ::AccountId: From, { - fn on_nonzero_unbalanced(amount: NegativeImbalance) { - pallet_balances::Pallet::::resolve_creating(&ACCOUNT_FEE.into(), amount); + fn on_nonzero_unbalanced(amount: CreditOf) { + let _ = pallet_balances::Pallet::::deposit_creating(&ACCOUNT_FEE.into(), amount.peek()); } } From 93404ba50a4d60e8dfa5d6954e732ce1459fcc4c Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 19 Jun 2023 16:27:32 +0200 Subject: [PATCH 47/99] improved --- pallets/did/src/mock.rs | 6 +++--- runtimes/common/src/lib.rs | 13 ++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index cd24c89f5f..0b26dfcdd3 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -33,8 +33,8 @@ use crate::{DidRawOrigin, EnsureDidOrigin}; use frame_support::{ parameter_types, traits::{ - fungible::{Credit, MutateHold}, - Currency, Imbalance, OnUnbalanced, + fungible::{Balanced, Credit, MutateHold}, + OnUnbalanced, }, weights::constants::RocksDbWeight, }; @@ -139,7 +139,7 @@ where ::AccountId: From, { fn on_nonzero_unbalanced(amount: CreditOf) { - let _ = pallet_balances::Pallet::::deposit_creating(&ACCOUNT_FEE.into(), amount.peek()); + let _ = pallet_balances::Pallet::::resolve(&ACCOUNT_FEE.into(), amount); } } diff --git a/runtimes/common/src/lib.rs b/runtimes/common/src/lib.rs index fe8bf4d80b..2a17b870f3 100644 --- a/runtimes/common/src/lib.rs +++ b/runtimes/common/src/lib.rs @@ -29,7 +29,10 @@ pub use frame_support::weights::constants::{BlockExecutionWeight, ExtrinsicBaseW use frame_support::{ dispatch::DispatchClass, parameter_types, - traits::{fungible::Credit, Contains, ContainsLengthBound, Currency, Get, Imbalance, OnUnbalanced, SortedMembers}, + traits::{ + fungible::{Balanced, Credit}, + Contains, ContainsLengthBound, Currency, Get, OnUnbalanced, SortedMembers, + }, }; use frame_system::limits; use pallet_balances::Pallet as PalletBalance; @@ -202,9 +205,13 @@ where pub struct DustAndFeeHandler(sp_std::marker::PhantomData); -impl OnUnbalanced> for DustAndFeeHandler { +impl OnUnbalanced> for DustAndFeeHandler +where + T: pallet_balances::Config, + T: pallet_treasury::Config, +{ fn on_nonzero_unbalanced(amount: CreditOf) { let treasury_account_id = pallet_treasury::Pallet::::account_id(); - let _ = pallet_balances::Pallet::::deposit_creating(&treasury_account_id, amount.peek()); + let _ = pallet_balances::Pallet::::resolve(&treasury_account_id, amount); } } From 2291665ba354ff47899747f96d23f7f2e890da3b Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 19 Jun 2023 16:54:19 +0200 Subject: [PATCH 48/99] tests --- runtimes/common/src/fees.rs | 24 ++++++++++++------------ runtimes/common/src/lib.rs | 2 +- runtimes/spiritnet/src/lib.rs | 7 +++---- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/runtimes/common/src/fees.rs b/runtimes/common/src/fees.rs index 5b058f9e59..e71a9c5fb7 100644 --- a/runtimes/common/src/fees.rs +++ b/runtimes/common/src/fees.rs @@ -18,7 +18,7 @@ use frame_support::{ dispatch::DispatchClass, - traits::{Currency, Get, Imbalance, OnUnbalanced}, + traits::{fungible::Balanced, Get, Imbalance, OnUnbalanced}, weights::{ Weight, WeightToFee as WeightToFeeT, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, @@ -28,7 +28,7 @@ use pallet_transaction_payment::OnChargeTransaction; use smallvec::smallvec; use sp_runtime::Perbill; -use crate::{constants::MILLI_KILT, AccountId, Balance, NegativeImbalanceOf}; +use crate::{constants::MILLI_KILT, AccountId, Balance, CreditOf}; /// Split two Imbalances between two unbalanced handlers. /// The first Imbalance will be split according to the given ratio. The second @@ -39,15 +39,15 @@ use crate::{constants::MILLI_KILT, AccountId, Balance, NegativeImbalanceOf}; pub struct SplitFeesByRatio( sp_std::marker::PhantomData<(R, Ratio, Beneficiary1, Beneficiary2)>, ); -impl OnUnbalanced> +impl OnUnbalanced> for SplitFeesByRatio where R: pallet_balances::Config, - Beneficiary1: OnUnbalanced>, - Beneficiary2: OnUnbalanced>, + Beneficiary1: OnUnbalanced>, + Beneficiary2: OnUnbalanced>, Ratio: Get<(u32, u32)>, { - fn on_unbalanceds(mut fees_then_tips: impl Iterator>) { + fn on_unbalanceds(mut fees_then_tips: impl Iterator>) { let ratio = Ratio::get(); if let Some(fees) = fees_then_tips.next() { let mut split = fees.ration(ratio.0, ratio.1); @@ -64,16 +64,16 @@ where /// Logic for the author to get a portion of fees. pub struct ToAuthor(sp_std::marker::PhantomData); -impl OnUnbalanced> for ToAuthor +impl OnUnbalanced> for ToAuthor where R: pallet_balances::Config + pallet_authorship::Config, ::AccountId: From, ::AccountId: Into, ::Balance: Into, { - fn on_nonzero_unbalanced(amount: NegativeImbalanceOf) { + fn on_nonzero_unbalanced(amount: CreditOf) { if let Some(author) = >::author() { - >::resolve_creating(&author, amount); + let _ = >::resolve(&author, amount); } } } @@ -233,10 +233,10 @@ mod tests { const AUTHOR_ACC: AccountId = AccountId::new([2; 32]); pub struct ToBeneficiary(); - impl OnUnbalanced> for ToBeneficiary { - fn on_nonzero_unbalanced(amount: NegativeImbalanceOf) { + impl OnUnbalanced> for ToBeneficiary { + fn on_nonzero_unbalanced(amount: CreditOf) { // Must resolve into existing but better to be safe. - >::resolve_creating(&TREASURY_ACC, amount); + let _ = >::resolve(&TREASURY_ACC, amount); } } diff --git a/runtimes/common/src/lib.rs b/runtimes/common/src/lib.rs index 2a17b870f3..5c502a7a59 100644 --- a/runtimes/common/src/lib.rs +++ b/runtimes/common/src/lib.rs @@ -77,7 +77,7 @@ pub mod opaque { /// An index to a block. pub type BlockNumber = u64; -type CreditOf = Credit<::AccountId, PalletBalance>; +pub(crate) type CreditOf = Credit<::AccountId, PalletBalance>; /// Alias to 512-bit hash when used in the context of a transaction signature on /// the chain. diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 5b28a430f0..01aab7e5ee 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -205,8 +205,7 @@ impl pallet_balances::Config for Runtime { type Balance = Balance; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; - // type DustRemoval = Treasury; - type DustRemoval = (); + type DustRemoval = runtime_common::DustAndFeeHandler; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = weights::pallet_balances::WeightInfo; @@ -581,7 +580,7 @@ impl ctype::Config for Runtime { type CtypeCreatorId = AccountId; type Currency = Balances; type Fee = constants::CtypeFee; - type FeeCollector = Treasury; + type FeeCollector = runtime_common::DustAndFeeHandler; type EnsureOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; @@ -604,7 +603,7 @@ impl did::Config for Runtime { type ServiceEndpointDeposit = constants::did::ServiceEndpointDeposit; type BaseDeposit = constants::did::DidBaseDeposit; type Fee = constants::did::DidFee; - type FeeCollector = Treasury; + type FeeCollector = runtime_common::DustAndFeeHandler; #[cfg(not(feature = "runtime-benchmarks"))] type EnsureOrigin = did::EnsureDidOrigin; From 3fb0f4853bea2bd4d87d6e32081ced4bf391da1a Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 20 Jun 2023 10:20:03 +0200 Subject: [PATCH 49/99] inflation --- pallets/ctype/src/benchmarking.rs | 10 +++++-- pallets/pallet-inflation/src/lib.rs | 13 +++++---- pallets/pallet-inflation/src/mock.rs | 10 +++---- runtimes/common/src/fees.rs | 41 +++++++++++++++++++--------- runtimes/peregrine/src/lib.rs | 2 +- runtimes/spiritnet/src/lib.rs | 2 +- runtimes/standalone/src/lib.rs | 10 ++----- 7 files changed, 53 insertions(+), 35 deletions(-) diff --git a/pallets/ctype/src/benchmarking.rs b/pallets/ctype/src/benchmarking.rs index 2d32987a98..6f99496214 100644 --- a/pallets/ctype/src/benchmarking.rs +++ b/pallets/ctype/src/benchmarking.rs @@ -19,7 +19,10 @@ use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite}; use frame_support::{ sp_runtime::traits::Hash, - traits::{Currency, EnsureOrigin, Get}, + traits::{ + fungible::{Inspect, Mutate}, + EnsureOrigin, Get, + }, }; use sp_std::{ convert::{TryFrom, TryInto}, @@ -37,8 +40,9 @@ const MAX_CTYPE_SIZE: u32 = 5 * 1024 * 1024; benchmarks! { where_clause { where - <::Currency as Currency>>::Balance: TryFrom, - <<::Currency as Currency<::AccountId>>::Balance as TryFrom>::Error: Debug, + <::Currency as Inspect>>::Balance: TryFrom, + ::Currency: Mutate, + <<::Currency as Inspect<::AccountId>>::Balance as TryFrom>::Error: Debug, T::EnsureOrigin: GenerateBenchmarkOrigin, T::BlockNumber: From, } diff --git a/pallets/pallet-inflation/src/lib.rs b/pallets/pallet-inflation/src/lib.rs index a744722489..3ef4d72939 100644 --- a/pallets/pallet-inflation/src/lib.rs +++ b/pallets/pallet-inflation/src/lib.rs @@ -47,20 +47,23 @@ pub mod pallet { use super::WeightInfo; use frame_support::{ pallet_prelude::*, - traits::{Currency, OnUnbalanced, StorageVersion}, + traits::{ + fungible::{Balanced, Credit, Inspect}, + OnUnbalanced, StorageVersion, + }, }; use frame_system::pallet_prelude::*; pub(crate) type AccountIdOf = ::AccountId; - pub(crate) type BalanceOf = <::Currency as Currency>>::Balance; - pub(crate) type NegativeImbalanceOf = <::Currency as Currency>>::NegativeImbalance; + pub(crate) type BalanceOf = <::Currency as Inspect>>::Balance; + pub(crate) type CreditOf = Credit<::AccountId, ::Currency>; pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); #[pallet::config] pub trait Config: frame_system::Config { /// Currency type. - type Currency: Currency>; + type Currency: Balanced>; /// The length of the initial period in which the constant reward is /// minted. Once the current block exceeds this, rewards are no further @@ -74,7 +77,7 @@ pub mod pallet { type InitialPeriodReward: Get>; /// The beneficiary to receive the rewards. - type Beneficiary: OnUnbalanced>; + type Beneficiary: OnUnbalanced>; /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; diff --git a/pallets/pallet-inflation/src/mock.rs b/pallets/pallet-inflation/src/mock.rs index 2a3faa010f..b6aa97dbf8 100644 --- a/pallets/pallet-inflation/src/mock.rs +++ b/pallets/pallet-inflation/src/mock.rs @@ -17,10 +17,10 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use crate as pallet_inflation; -use crate::NegativeImbalanceOf; +use crate::CreditOf; use frame_support::{ parameter_types, - traits::{Currency, OnFinalize, OnInitialize, OnUnbalanced}, + traits::{fungible::Balanced, OnFinalize, OnInitialize, OnUnbalanced}, }; use sp_runtime::{ @@ -114,10 +114,10 @@ impl pallet_balances::Config for Test { } pub struct ToBeneficiary(); -impl OnUnbalanced> for ToBeneficiary { - fn on_nonzero_unbalanced(amount: NegativeImbalanceOf) { +impl OnUnbalanced> for ToBeneficiary { + fn on_nonzero_unbalanced(amount: CreditOf) { // Must resolve into existing but better to be safe. - ::Currency::resolve_creating(&TREASURY_ACC, amount); + let _ = ::Currency::resolve(&TREASURY_ACC, amount); } } diff --git a/runtimes/common/src/fees.rs b/runtimes/common/src/fees.rs index e71a9c5fb7..dc4522b4e2 100644 --- a/runtimes/common/src/fees.rs +++ b/runtimes/common/src/fees.rs @@ -18,7 +18,7 @@ use frame_support::{ dispatch::DispatchClass, - traits::{fungible::Balanced, Get, Imbalance, OnUnbalanced}, + traits::{fungible::Balanced, Currency, Get, Imbalance, OnUnbalanced}, weights::{ Weight, WeightToFee as WeightToFeeT, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, @@ -28,7 +28,7 @@ use pallet_transaction_payment::OnChargeTransaction; use smallvec::smallvec; use sp_runtime::Perbill; -use crate::{constants::MILLI_KILT, AccountId, Balance, CreditOf}; +use crate::{constants::MILLI_KILT, AccountId, Balance, CreditOf, NegativeImbalanceOf}; /// Split two Imbalances between two unbalanced handlers. /// The first Imbalance will be split according to the given ratio. The second @@ -39,15 +39,15 @@ use crate::{constants::MILLI_KILT, AccountId, Balance, CreditOf}; pub struct SplitFeesByRatio( sp_std::marker::PhantomData<(R, Ratio, Beneficiary1, Beneficiary2)>, ); -impl OnUnbalanced> +impl OnUnbalanced> for SplitFeesByRatio where R: pallet_balances::Config, - Beneficiary1: OnUnbalanced>, - Beneficiary2: OnUnbalanced>, + Beneficiary1: OnUnbalanced>, + Beneficiary2: OnUnbalanced>, Ratio: Get<(u32, u32)>, { - fn on_unbalanceds(mut fees_then_tips: impl Iterator>) { + fn on_unbalanceds(mut fees_then_tips: impl Iterator>) { let ratio = Ratio::get(); if let Some(fees) = fees_then_tips.next() { let mut split = fees.ration(ratio.0, ratio.1); @@ -64,7 +64,22 @@ where /// Logic for the author to get a portion of fees. pub struct ToAuthor(sp_std::marker::PhantomData); -impl OnUnbalanced> for ToAuthor +impl OnUnbalanced> for ToAuthor +where + R: pallet_balances::Config + pallet_authorship::Config, + ::AccountId: From, + ::AccountId: Into, + ::Balance: Into, +{ + fn on_nonzero_unbalanced(amount: NegativeImbalanceOf) { + if let Some(author) = >::author() { + >::resolve_creating(&author, amount); + } + } +} + +pub struct ToAuthorCredit(sp_std::marker::PhantomData); +impl OnUnbalanced> for ToAuthorCredit where R: pallet_balances::Config + pallet_authorship::Config, ::AccountId: From, @@ -214,11 +229,11 @@ mod tests { } impl pallet_balances::Config for Test { + type Balance = u64; type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); type MaxHolds = (); - type Balance = u64; type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ConstU64<1>; @@ -233,10 +248,10 @@ mod tests { const AUTHOR_ACC: AccountId = AccountId::new([2; 32]); pub struct ToBeneficiary(); - impl OnUnbalanced> for ToBeneficiary { - fn on_nonzero_unbalanced(amount: CreditOf) { + impl OnUnbalanced> for ToBeneficiary { + fn on_nonzero_unbalanced(amount: NegativeImbalanceOf) { // Must resolve into existing but better to be safe. - let _ = >::resolve(&TREASURY_ACC, amount); + >::resolve_creating(&TREASURY_ACC, amount); } } @@ -270,8 +285,8 @@ mod tests { #[test] fn test_fees_and_tip_split() { new_test_ext().execute_with(|| { - let fee = Balances::issue(10); - let tip = Balances::issue(20); + let fee = ::AccountId>>::issue(10); + let tip = ::AccountId>>::issue(20); assert_eq!(Balances::free_balance(TREASURY_ACC), 0); assert_eq!(Balances::free_balance(AUTHOR_ACC), 0); diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index ba855dae84..17a5f61c53 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -670,7 +670,7 @@ impl pallet_inflation::Config for Runtime { type Currency = Balances; type InitialPeriodLength = constants::treasury::InitialPeriodLength; type InitialPeriodReward = constants::treasury::InitialPeriodReward; - type Beneficiary = Treasury; + type Beneficiary = runtime_common::DustAndFeeHandler; type WeightInfo = weights::pallet_inflation::WeightInfo; } diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 01aab7e5ee..65ef776650 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -662,7 +662,7 @@ impl pallet_inflation::Config for Runtime { type Currency = Balances; type InitialPeriodLength = constants::treasury::InitialPeriodLength; type InitialPeriodReward = constants::treasury::InitialPeriodReward; - type Beneficiary = Treasury; + type Beneficiary = runtime_common::DustAndFeeHandler; type WeightInfo = weights::pallet_inflation::WeightInfo; } diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index 8cd7af77d2..bb7885e112 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -29,7 +29,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); use frame_support::{ construct_runtime, parameter_types, - traits::{Currency, Everything, InstanceFilter}, + traits::{Everything, InstanceFilter}, weights::{constants::RocksDbWeight, ConstantMultiplier, IdentityFee, Weight}, }; pub use frame_system::Call as SystemCall; @@ -61,7 +61,6 @@ use runtime_common::{ authorization::{AuthorizationId, PalletAuthorize}, constants::{self, EXISTENTIAL_DEPOSIT, KILT}, errors::PublicCredentialsApiError, - fees::ToAuthor, AccountId, Balance, BlockNumber, DidIdentifier, Hash, Index, Signature, SlowAdjustingFeeUpdate, }; @@ -87,9 +86,6 @@ pub use sp_runtime::BuildStorage; /// Digest item type. pub type DigestItem = generic::DigestItem; -pub type NegativeImbalance = - as Currency<::AccountId>>::NegativeImbalance; - /// Opaque types. These are used by the CLI to instantiate machinery that don't /// need to know the specifics of the runtime. They can then be made to be /// agnostic over specific formats of data like extrinsics, allowing for them to @@ -350,7 +346,7 @@ parameter_types! { impl ctype::Config for Runtime { type Currency = Balances; type Fee = Fee; - type FeeCollector = runtime_common::fees::ToAuthor; + type FeeCollector = runtime_common::fees::ToAuthorCredit; type CtypeCreatorId = DidIdentifier; type EnsureOrigin = did::EnsureDidOrigin; @@ -387,7 +383,7 @@ impl did::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type Currency = Balances; type Fee = DidFee; - type FeeCollector = ToAuthor; + type FeeCollector = runtime_common::fees::ToAuthorCredit; #[cfg(not(feature = "runtime-benchmarks"))] type EnsureOrigin = did::EnsureDidOrigin; From 49dabb3207ac8de0bf37660ada25fa7854b72ec0 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 20 Jun 2023 10:44:12 +0200 Subject: [PATCH 50/99] staking --- pallets/pallet-inflation/src/benchmarking.rs | 2 +- pallets/parachain-staking/src/api.rs | 2 +- pallets/parachain-staking/src/lib.rs | 17 ++++++++--------- pallets/parachain-staking/src/migrations.rs | 7 ++++++- pallets/parachain-staking/src/mock.rs | 10 +++++----- pallets/parachain-staking/src/types.rs | 9 ++++++--- runtimes/peregrine/src/lib.rs | 2 +- runtimes/spiritnet/src/lib.rs | 2 +- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/pallets/pallet-inflation/src/benchmarking.rs b/pallets/pallet-inflation/src/benchmarking.rs index 13613a46a1..a3f9eedade 100644 --- a/pallets/pallet-inflation/src/benchmarking.rs +++ b/pallets/pallet-inflation/src/benchmarking.rs @@ -23,7 +23,7 @@ use super::*; use crate::Pallet as Inflation; use frame_benchmarking::{benchmarks, impl_benchmark_test_suite}; -use frame_support::traits::{Currency, Get, OnInitialize}; +use frame_support::traits::{fungible::Inspect, Get, OnInitialize}; use sp_runtime::traits::{One, Saturating}; benchmarks! { diff --git a/pallets/parachain-staking/src/api.rs b/pallets/parachain-staking/src/api.rs index 310d9721a5..2e2631d096 100644 --- a/pallets/parachain-staking/src/api.rs +++ b/pallets/parachain-staking/src/api.rs @@ -20,7 +20,7 @@ use crate::{ types::BalanceOf, BlocksAuthored, BlocksRewarded, CandidatePool, Config, DelegatorState, InflationConfig, Pallet, Rewards, TotalCollatorStake, }; -use frame_support::traits::Currency; +use frame_support::traits::fungible::Inspect; use sp_runtime::{ traits::{Saturating, Zero}, Perquintill, diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 57604fd522..3526108345 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -148,11 +148,12 @@ pub mod pallet { pallet_prelude::*, storage::bounded_btree_map::BoundedBTreeMap, traits::{ + fungible::Balanced, tokens::{ fungible::{Inspect, MutateFreeze, Unbalanced}, Fortitude, Precision, Preservation, }, - Currency, EstimateNextSessionRotation, Get, LockIdentifier, LockableCurrency, OnUnbalanced, StorageVersion, + EstimateNextSessionRotation, Get, LockIdentifier, OnUnbalanced, StorageVersion, }, BoundedVec, }; @@ -171,8 +172,8 @@ pub mod pallet { use crate::{ set::OrderedSet, types::{ - BalanceOf, Candidate, CandidateOf, CandidateStatus, DelegationCounter, Delegator, NegativeImbalanceOf, - RoundInfo, Stake, StakeOf, TotalStake, + BalanceOf, Candidate, CandidateOf, CandidateStatus, CreditOf, DelegationCounter, Delegator, RoundInfo, + Stake, StakeOf, TotalStake, }, }; use sp_std::{convert::TryInto, fmt::Debug}; @@ -201,14 +202,12 @@ pub mod pallet { // multiplication /// The currency type /// Note: Declaration of Balance taken from pallet_gilt - type Currency: Inspect - + Unbalanced + type Currency: Balanced + MutateFreeze< Self::AccountId, Balance = Self::CurrencyBalance, Id = ::FreezeIdentifier, - > + LockableCurrency - + Eq; + > + Eq; type FreezeIdentifier: From + PartialEq @@ -316,7 +315,7 @@ pub mod pallet { type NetworkRewardRate: Get; /// The beneficiary to receive the network rewards. - type NetworkRewardBeneficiary: OnUnbalanced>; + type NetworkRewardBeneficiary: OnUnbalanced>; /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; @@ -2405,7 +2404,7 @@ pub mod pallet { /// /// `col_reward_rate_per_block * col_max_stake * max_num_of_collators * /// NetworkRewardRate` - fn issue_network_reward() -> NegativeImbalanceOf { + fn issue_network_reward() -> CreditOf { // Multiplication with Perquintill cannot overflow let max_col_rewards = InflationConfig::::get().collator.reward_rate.per_block * MaxCollatorCandidateStake::::get() diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index ee92674bb6..78994fa2ec 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -34,6 +34,7 @@ pub struct BalanceMigration(PhantomData); impl OnRuntimeUpgrade for BalanceMigration where ::Currency: ReservableCurrency, + ::Currency: LockableCurrency, { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Staking: Initiating migration"); @@ -85,6 +86,7 @@ where fn do_migration() -> Weight where ::Currency: ReservableCurrency, + ::Currency: LockableCurrency, { Locks::::iter() .map(|(user_id, locks)| { @@ -105,7 +107,10 @@ where fn update_or_create_freeze( user_id: T::AccountId, lock: &BalanceLock<::Balance>, -) -> Weight { +) -> Weight +where + CurrencyOf: LockableCurrency>, +{ let freezes = Freezes::::get(&user_id); let result = if let Some(IdAmount { amount, .. }) = freezes diff --git a/pallets/parachain-staking/src/mock.rs b/pallets/parachain-staking/src/mock.rs index 86c7f329fc..2838b8efaf 100644 --- a/pallets/parachain-staking/src/mock.rs +++ b/pallets/parachain-staking/src/mock.rs @@ -20,10 +20,10 @@ #![allow(clippy::from_over_into)] use super::*; -use crate::{self as stake, types::NegativeImbalanceOf}; +use crate::{self as stake, types::CreditOf}; use frame_support::{ assert_ok, construct_runtime, parameter_types, - traits::{Currency, GenesisBuild, OnFinalize, OnInitialize, OnUnbalanced}, + traits::{fungible::Balanced, GenesisBuild, OnFinalize, OnInitialize, OnUnbalanced}, }; use pallet_authorship::EventHandler; use sp_consensus_aura::sr25519::AuthorityId; @@ -149,10 +149,10 @@ parameter_types! { } pub struct ToBeneficiary(); -impl OnUnbalanced> for ToBeneficiary { - fn on_nonzero_unbalanced(amount: NegativeImbalanceOf) { +impl OnUnbalanced> for ToBeneficiary { + fn on_nonzero_unbalanced(amount: CreditOf) { // Must resolve into existing but better to be safe. - ::Currency::resolve_creating(&TREASURY_ACC, amount); + let _ = ::Currency::resolve(&TREASURY_ACC, amount); } } diff --git a/pallets/parachain-staking/src/types.rs b/pallets/parachain-staking/src/types.rs index db04b91b44..f73198a789 100644 --- a/pallets/parachain-staking/src/types.rs +++ b/pallets/parachain-staking/src/types.rs @@ -16,7 +16,10 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::traits::{Currency, Get}; +use frame_support::traits::{ + fungible::{Credit, Inspect}, + Get, +}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::{ @@ -311,7 +314,7 @@ pub struct DelegationCounter { pub type CurrencyOf = ::Currency; pub type AccountIdOf = ::AccountId; -pub type BalanceOf = <::Currency as Currency>>::Balance; +pub type BalanceOf = <::Currency as Inspect>>::Balance; pub type CandidateOf = Candidate, BalanceOf, S>; pub type StakeOf = Stake, BalanceOf>; -pub type NegativeImbalanceOf = <::Currency as Currency>>::NegativeImbalance; +pub(crate) type CreditOf = Credit<::AccountId, ::Currency>; diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 17a5f61c53..f3c7464096 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -694,7 +694,7 @@ impl parachain_staking::Config for Runtime { type MaxUnstakeRequests = constants::staking::MaxUnstakeRequests; type NetworkRewardRate = constants::staking::NetworkRewardRate; type NetworkRewardStart = constants::staking::NetworkRewardStart; - type NetworkRewardBeneficiary = Treasury; + type NetworkRewardBeneficiary = runtime_common::DustAndFeeHandler; type WeightInfo = weights::parachain_staking::WeightInfo; const BLOCKS_PER_YEAR: Self::BlockNumber = constants::BLOCKS_PER_YEAR; diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 65ef776650..2d839b6ae0 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -687,7 +687,7 @@ impl parachain_staking::Config for Runtime { type MaxUnstakeRequests = constants::staking::MaxUnstakeRequests; type NetworkRewardRate = constants::staking::NetworkRewardRate; type NetworkRewardStart = constants::staking::NetworkRewardStart; - type NetworkRewardBeneficiary = Treasury; + type NetworkRewardBeneficiary = runtime_common::DustAndFeeHandler; type WeightInfo = weights::parachain_staking::WeightInfo; const BLOCKS_PER_YEAR: Self::BlockNumber = constants::BLOCKS_PER_YEAR; From 4eaab78bc5b583d1da588b6098b7b3b2219d19ff Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 20 Jun 2023 11:15:13 +0200 Subject: [PATCH 51/99] debug log --- support/src/deposit.rs | 16 ++++++++++++---- support/src/test_utils.rs | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/support/src/deposit.rs b/support/src/deposit.rs index ffdbed7300..f3acb678ce 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -16,9 +16,10 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{pallet_prelude::DispatchResult, traits::fungible::hold::Mutate}; - -use frame_support::traits::tokens::Precision; +use frame_support::{ + pallet_prelude::DispatchResult, + traits::{fungible::hold::Mutate, tokens::Precision}, +}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::DispatchError; @@ -47,6 +48,13 @@ pub fn free_deposit>( deposit: &Deposit, reason: &Currency::Reason, ) -> DispatchResult { - Currency::release(reason, &deposit.owner, deposit.amount, Precision::Exact)?; + let result = Currency::release(reason, &deposit.owner, deposit.amount, Precision::Exact); + debug_assert!( + result.is_err(), + "Released deposit amount does not match with expected amount. Expected: {:?}, Error: {:?}", + deposit.amount, + result.err(), + ); + result?; Ok(()) } diff --git a/support/src/test_utils.rs b/support/src/test_utils.rs index d0bfffed66..37ea78cad2 100644 --- a/support/src/test_utils.rs +++ b/support/src/test_utils.rs @@ -21,5 +21,5 @@ use scale_info::prelude::string::String; /// Logs the error message and returns "Sanity test error" pub fn log_and_return_error_message(error_message: String) -> &'static str { log::error!("{}", error_message); - "Sanity test error" + "Test error" } From eed5bd0619738112ed02b5e1d8030d7932f9ea51 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 20 Jun 2023 11:20:55 +0200 Subject: [PATCH 52/99] remove result --- support/src/deposit.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/support/src/deposit.rs b/support/src/deposit.rs index f3acb678ce..d27c968009 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -55,6 +55,5 @@ pub fn free_deposit>( deposit.amount, result.err(), ); - result?; Ok(()) } From a76654aaae654a46a1908c1bd635f4f76ef64a70 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 20 Jun 2023 14:18:14 +0200 Subject: [PATCH 53/99] tests --- support/src/deposit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/src/deposit.rs b/support/src/deposit.rs index d27c968009..0caac423de 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -50,7 +50,7 @@ pub fn free_deposit>( ) -> DispatchResult { let result = Currency::release(reason, &deposit.owner, deposit.amount, Precision::Exact); debug_assert!( - result.is_err(), + result.is_ok(), "Released deposit amount does not match with expected amount. Expected: {:?}, Error: {:?}", deposit.amount, result.err(), From fc4b4015e9f6d1c0caa2ade33b61fdc183cb6fad Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 21 Jun 2023 15:48:51 +0200 Subject: [PATCH 54/99] updated support without traits --- support/src/deposit.rs | 4 ++-- support/src/migration.rs | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/support/src/deposit.rs b/support/src/deposit.rs index 0caac423de..66ddf18cab 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -48,9 +48,9 @@ pub fn free_deposit>( deposit: &Deposit, reason: &Currency::Reason, ) -> DispatchResult { - let result = Currency::release(reason, &deposit.owner, deposit.amount, Precision::Exact); + let result = Currency::release(reason, &deposit.owner, deposit.amount, Precision::BestEffort); debug_assert!( - result.is_ok(), + result.is_ok() && result.unwrap() == deposit.amount, "Released deposit amount does not match with expected amount. Expected: {:?}, Error: {:?}", deposit.amount, result.err(), diff --git a/support/src/migration.rs b/support/src/migration.rs index b2861ea947..5e23b3b21b 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -27,7 +27,7 @@ pub fn has_user_holds + Mutat owner: &AccountId, reason: &Currency::Reason, ) -> bool { - Currency::balance_on_hold(reason, owner) == Zero::zero() && Currency::reserved_balance(owner) > Zero::zero() + Currency::balance_on_hold(reason, owner).is_zero() && Currency::reserved_balance(owner) > Zero::zero() } pub fn switch_reserved_to_hold + MutateHold>( @@ -35,6 +35,10 @@ pub fn switch_reserved_to_hold DispatchResult { - Currency::unreserve(&owner, amount.saturated_into()); - Currency::hold(reason, &owner, amount.saturated_into()) + let unreserved_balance = Currency::unreserve(&owner, amount.saturated_into()); + Currency::hold( + reason, + &owner, + unreserved_balance.saturated_into::().saturated_into(), + ) } From 1bcf94f0842ebca746609a5e96743e3e555b4705 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 21 Jun 2023 17:43:01 +0200 Subject: [PATCH 55/99] unreserve does not return the unreserve balance --- support/src/migration.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/support/src/migration.rs b/support/src/migration.rs index 5e23b3b21b..a842a7e904 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -35,10 +35,6 @@ pub fn switch_reserved_to_hold DispatchResult { - let unreserved_balance = Currency::unreserve(&owner, amount.saturated_into()); - Currency::hold( - reason, - &owner, - unreserved_balance.saturated_into::().saturated_into(), - ) + Currency::unreserve(&owner, amount.saturated_into()); + Currency::hold(reason, &owner, amount.saturated_into()) } From 9eb6c81b87a488dc550032bd0f43d6ffbb26dfa1 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 21 Jun 2023 18:51:05 +0200 Subject: [PATCH 56/99] changed migration with storageversion --- pallets/attestation/src/lib.rs | 2 +- pallets/attestation/src/migrations.rs | 61 ++++++++------------ pallets/delegation/src/lib.rs | 2 +- pallets/delegation/src/migrations.rs | 57 +++++++----------- pallets/did/src/lib.rs | 2 +- pallets/did/src/migrations.rs | 53 +++++++---------- pallets/pallet-web3-names/src/lib.rs | 2 +- pallets/pallet-web3-names/src/migrations.rs | 56 +++++++----------- pallets/parachain-staking/src/lib.rs | 2 +- pallets/parachain-staking/src/migrations.rs | 35 ++++++----- pallets/public-credentials/src/migrations.rs | 60 ++++++++----------- 11 files changed, 137 insertions(+), 195 deletions(-) diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 36e991de98..098ec284ea 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -103,7 +103,7 @@ pub mod pallet { }; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); /// Type of a claim hash. pub type ClaimHashOf = ::Hash; diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index e0df255d8b..d960005cc2 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -17,15 +17,15 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, + traits::{Get, GetStorageVersion, OnRuntimeUpgrade, ReservableCurrency, StorageVersion}, weights::Weight, }; -use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; +use kilt_support::migration::switch_reserved_to_hold; use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, AttestationDetails, Attestations, Config, CurrencyOf, HoldReason}; +use crate::{AccountIdOf, Attestations, Config, CurrencyOf, HoldReason, Pallet}; pub struct BalanceMigration(PhantomData); @@ -35,7 +35,11 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Attestation: Initiating migration"); - if is_upgraded::() { + + let onchain_storage_version = Pallet::::on_chain_storage_version(); + if onchain_storage_version.eq(&StorageVersion::new(1)) { + onchain_storage_version.put::>(); + StorageVersion::new(2).put::>(); return do_migration::(); } @@ -45,23 +49,24 @@ where #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, &'static str> { - use frame_support::ensure; use sp_std::vec; let has_all_user_no_holds = Attestations::::iter_values() - .map(|details: AttestationDetails| { - has_user_holds::, CurrencyOf>( + .map(|details: crate::AttestationDetails| { + kilt_support::migration::has_user_holds::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); - ensure!( + assert!( has_all_user_no_holds, "Pre Upgrade Attestation: there are users with holds!" ); + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(1)); + log::info!("Attestation: Pre migration checks successful"); Ok(vec![]) @@ -69,8 +74,7 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::{ensure, traits::fungible::InspectHold}; - use kilt_support::test_utils::log_and_return_error_message; + use frame_support::traits::fungible::InspectHold; Attestations::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( @@ -78,40 +82,24 @@ where &details.deposit.owner, ) .saturated_into(); - ensure!( + assert!( details.deposit.amount.saturated_into::() <= hold_balance, - log_and_return_error_message(scale_info::prelude::format!( - "Attestation: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", - key, details.deposit.amount, hold_balance - )) + "Attestation: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", + key, + details.deposit.amount, + hold_balance ); - ensure!(!is_upgraded::(), "Attestation Post: Users have still no holds"); - Ok(()) })?; + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(2)); + log::info!("Attestation: Post migration checks successful"); Ok(()) } } -/// Checks if there is an user, who has still reserved balance and no holds. If -/// yes, the migration is not executed yet. -fn is_upgraded() -> bool -where - ::Currency: ReservableCurrency, -{ - Attestations::::iter_values() - .map(|details: AttestationDetails| { - has_user_holds::, CurrencyOf>( - &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) - }) - .all(|user| user) -} - fn do_migration() -> Weight where ::Currency: ReservableCurrency, @@ -129,11 +117,10 @@ where return ::DbWeight::get().reads_writes(1, 1); } - log::error!("{:?}", error); - log::error!( - " Attestation: Could not convert reserves to hold from attestation: {:?} ", - key + " Attestation: Could not convert reserves to hold from attestation: {:?} error: {:?}", + key, + error ); ::DbWeight::get().reads_writes(0, 0) diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index 0387180beb..11f6d21c00 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -107,7 +107,7 @@ pub mod pallet { use scale_info::TypeInfo; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(3); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(4); /// Type of a delegation node identifier. pub type DelegationNodeIdOf = ::DelegationNodeId; diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index cf9ad9a9ee..60ae3eb884 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -17,15 +17,15 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, + traits::{Get, GetStorageVersion, OnRuntimeUpgrade, ReservableCurrency, StorageVersion}, weights::Weight, }; -use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; +use kilt_support::migration::switch_reserved_to_hold; use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Config, CurrencyOf, DelegationNode, DelegationNodes, HoldReason}; +use crate::{AccountIdOf, Config, CurrencyOf, DelegationNodes, HoldReason, Pallet}; pub struct BalanceMigration(PhantomData); @@ -35,7 +35,11 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Delegation: Initiating migration"); - if is_upgraded::() { + + let onchain_storage_version = Pallet::::on_chain_storage_version(); + if onchain_storage_version.eq(&StorageVersion::new(3)) { + onchain_storage_version.put::>(); + StorageVersion::new(4).put::>(); return do_migration::(); } @@ -45,23 +49,23 @@ where #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, &'static str> { - use frame_support::ensure; use sp_std::vec; let has_all_user_no_holds = DelegationNodes::::iter_values() - .map(|details: DelegationNode| { - has_user_holds::, CurrencyOf>( + .map(|details: crate::DelegationNode| { + kilt_support::migration::has_user_holds::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); - ensure!( + assert!( has_all_user_no_holds, "Pre Upgrade Delegation: there are users with holds!" ); + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(3)); log::info!("Delegation: Pre migration checks successful"); Ok(vec![]) @@ -69,8 +73,7 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::{ensure, traits::fungible::InspectHold}; - use kilt_support::test_utils::log_and_return_error_message; + use frame_support::traits::fungible::InspectHold; DelegationNodes::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( @@ -78,39 +81,22 @@ where &details.deposit.owner, ) .saturated_into(); - ensure!( + assert!( details.deposit.amount.saturated_into::() <= hold_balance, - log_and_return_error_message(scale_info::prelude::format!( - "Delegation: Hold balance is not matching for delegation node {:?}. Expected hold: {:?}. Real hold: {:?}", - key, details.deposit.amount, hold_balance - )) + "Delegation: Hold balance is not matching for delegation node {:?}. Expected hold: {:?}. Real hold: {:?}", + key, details.deposit.amount, hold_balance ); - ensure!(!is_upgraded::(), "Delegation: Users have still no holds"); - Ok(()) })?; + + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(4)); + log::info!("Delegation: Post migration checks successful"); Ok(()) } } -/// Checks if there is an user, who has still reserved balance and no holds. If -/// yes, the migration is not executed yet. -fn is_upgraded() -> bool -where - ::Currency: ReservableCurrency, -{ - DelegationNodes::::iter_values() - .map(|details: DelegationNode| { - has_user_holds::, CurrencyOf>( - &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) - }) - .all(|user| user) -} - fn do_migration() -> Weight where ::Currency: ReservableCurrency, @@ -129,8 +115,9 @@ where } log::error!( - " Delegation: Could not convert reserves to hold from delegation: {:?} ", - key + " Delegation: Could not convert reserves to hold from delegation: {:?}, error: {:?}", + key, + error ); ::DbWeight::get().reads_writes(0, 0) diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index cc29d515a5..5641ce28af 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -162,7 +162,7 @@ pub mod pallet { }; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(4); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(5); /// Reference to a payload of data of variable size. pub type Payload = [u8]; diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index a41afd60a9..f7e3ed7574 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -17,15 +17,15 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, + traits::{Get, GetStorageVersion, OnRuntimeUpgrade, ReservableCurrency, StorageVersion}, weights::Weight, }; -use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; +use kilt_support::migration::switch_reserved_to_hold; use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{did_details::DidDetails, AccountIdOf, Config, CurrencyOf, Did, HoldReason}; +use crate::{AccountIdOf, Config, CurrencyOf, Did, HoldReason, Pallet}; pub struct BalanceMigration(PhantomData); @@ -35,7 +35,11 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Did: Initiating migration"); - if is_upgraded::() { + + let onchain_storage_version = Pallet::::on_chain_storage_version(); + if onchain_storage_version.eq(&StorageVersion::new(4)) { + onchain_storage_version.put::>(); + StorageVersion::new(5).put::>(); return do_migration::(); } @@ -49,8 +53,8 @@ where use sp_std::vec; let has_all_user_no_holds = Did::::iter_values() - .map(|details: DidDetails| { - has_user_holds::, CurrencyOf>( + .map(|details: crate::did_details::DidDetails| { + kilt_support::migration::has_user_holds::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) @@ -58,6 +62,9 @@ where .all(|user| user); ensure!(has_all_user_no_holds, "Pre Upgrade Did: there are users with holds!"); + + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(4)); + log::info!("Did: Pre migration checks successful"); Ok(vec![]) @@ -65,8 +72,7 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::{ensure, traits::fungible::InspectHold}; - use kilt_support::test_utils::log_and_return_error_message; + use frame_support::traits::fungible::InspectHold; Did::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( @@ -74,41 +80,24 @@ where &details.deposit.owner, ) .saturated_into(); - ensure!( + assert!( details.deposit.amount.saturated_into::() <= hold_balance, - log_and_return_error_message(scale_info::prelude::format!( - "Did: Hold balance is not matching for Did {:?}. Expected hold: {:?}. Real hold: {:?}", - key, - details.deposit.amount, - hold_balance - )) + "Did: Hold balance is not matching for Did {:?}. Expected hold: {:?}. Real hold: {:?}", + key, + details.deposit.amount, + hold_balance ); - ensure!(!is_upgraded::(), "Did: Users have still no holds"); Ok(()) })?; + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(5)); + log::info!("Did: Post migration checks successful"); Ok(()) } } -/// Checks if there is an user, who has still reserved balance and no holds. If -/// yes, the migration is not executed yet. -fn is_upgraded() -> bool -where - ::Currency: ReservableCurrency, -{ - Did::::iter_values() - .map(|details: DidDetails| { - has_user_holds::, CurrencyOf>( - &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) - }) - .all(|user| user) -} - fn do_migration() -> Weight where ::Currency: ReservableCurrency, diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index c987a407c4..0ef3185fbf 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -64,7 +64,7 @@ pub mod pallet { use super::WeightInfo; use crate::web3_name::Web3NameOwnership; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); pub type AccountIdOf = ::AccountId; pub type BlockNumberFor = ::BlockNumber; diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index 9bf79d8244..cef767ce16 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -17,14 +17,14 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, + traits::{Get, GetStorageVersion, OnRuntimeUpgrade, ReservableCurrency, StorageVersion}, weights::Weight, }; -use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; +use kilt_support::migration::switch_reserved_to_hold; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Config, CurrencyOf, HoldReason, Owner, Web3OwnershipOf}; +use crate::{AccountIdOf, Config, CurrencyOf, HoldReason, Owner, Pallet}; pub struct BalanceMigration(PhantomData); @@ -34,28 +34,34 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("W3n: Initiating migration"); - if is_upgraded::() { + + let onchain_storage_version = Pallet::::on_chain_storage_version(); + if onchain_storage_version.eq(&StorageVersion::new(1)) { + onchain_storage_version.put::>(); + StorageVersion::new(2).put::>(); return do_migration::(); } + log::info!("W3n: No migration needed. This file should be deleted."); ::DbWeight::get().reads_writes(0, 0) } #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, &'static str> { - use frame_support::ensure; use sp_std::vec; let has_all_user_no_holds = Owner::::iter_values() - .map(|details: Web3OwnershipOf| { - has_user_holds::, CurrencyOf>( + .map(|details: crate::Web3OwnershipOf| { + kilt_support::migration::has_user_holds::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); - ensure!(has_all_user_no_holds, "Pre Upgrade W3n: there are users with holds!"); + assert!(has_all_user_no_holds, "Pre Upgrade W3n: there are users with holds!"); + + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(1)); log::info!("W3n: Pre migration checks successful"); @@ -64,8 +70,7 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::{ensure, traits::fungible::InspectHold}; - use kilt_support::test_utils::log_and_return_error_message; + use frame_support::traits::fungible::InspectHold; Owner::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( @@ -73,42 +78,23 @@ where &details.deposit.owner, ) .saturated_into(); - ensure!( + assert!( details.deposit.amount.saturated_into::() <= hold_balance, - log_and_return_error_message(scale_info::prelude::format!( - "W3n: Hold balance is not matching for w3n {:?}. Expected hold: {:?}. Real hold: {:?}", - key, - details.deposit.amount, - hold_balance - )) + "W3n: Hold balance is not matching for w3n {:?}. Expected hold: {:?}. Real hold: {:?}", + key, + details.deposit.amount, + hold_balance ); - ensure!(!is_upgraded::(), "Users have still no holds"); - Ok(()) })?; + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(2)); log::info!("W3n: Post migration checks successful"); Ok(()) } } -/// Checks if there is an user, who has still reserved balance and no holds. If -/// yes, the migration is not executed yet. -fn is_upgraded() -> bool -where - ::Currency: ReservableCurrency, -{ - Owner::::iter_values() - .map(|details: Web3OwnershipOf| { - has_user_holds::, CurrencyOf>( - &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) - }) - .all(|user| user) -} - fn do_migration() -> Weight where ::Currency: ReservableCurrency, diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 3526108345..cbfecdca11 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -180,7 +180,7 @@ pub mod pallet { pub(crate) const STAKING_ID: LockIdentifier = *b"kiltpstk"; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(8); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(9); /// Pallet for parachain staking. #[pallet::pallet] diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index 78994fa2ec..ab179b3fd9 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -17,7 +17,10 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{fungible::freeze::Mutate as MutateFreeze, Get, LockableCurrency, OnRuntimeUpgrade, ReservableCurrency}, + traits::{ + fungible::freeze::Mutate as MutateFreeze, Get, GetStorageVersion, LockableCurrency, OnRuntimeUpgrade, + ReservableCurrency, StorageVersion, + }, weights::Weight, }; use pallet_balances::{BalanceLock, Freezes, IdAmount, Locks}; @@ -26,7 +29,7 @@ use sp_std::marker::PhantomData; use crate::{ types::{AccountIdOf, CurrencyOf}, - Config, FreezeReason, STAKING_ID, + Config, FreezeReason, Pallet, STAKING_ID, }; pub struct BalanceMigration(PhantomData); @@ -38,7 +41,11 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Staking: Initiating migration"); - if is_upgraded::() { + + let onchain_storage_version = Pallet::::on_chain_storage_version(); + if onchain_storage_version.eq(&StorageVersion::new(8)) { + onchain_storage_version.put::>(); + StorageVersion::new(9).put::>(); return do_migration::(); } @@ -49,9 +56,13 @@ where #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, &'static str> { use frame_support::ensure; + use sp_runtime::traits::Zero; use sp_std::vec; + let count_freezes = pallet_balances::Freezes::::iter().count(); - ensure!(count_freezes == 0, "Staking Pre: There are already freezes."); + ensure!(count_freezes.is_zero(), "Staking Pre: There are already freezes."); + + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(8)); log::info!("Staking: Pre migration checks successful"); @@ -61,10 +72,13 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { use frame_support::ensure; + use sp_runtime::traits::Zero; let count_freezes = pallet_balances::Freezes::::iter().count(); - ensure!(count_freezes > 0, "Staking: There are still no freezes."); + ensure!(!count_freezes.is_zero(), "Staking: There are still no freezes."); + + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(9)); log::info!("Staking: Post migration checks successful"); @@ -72,17 +86,6 @@ where } } -/// If there exists one user with locks -> the migration has to be executed. -fn is_upgraded() -> bool -where - ::Currency: ReservableCurrency, -{ - Locks::::iter_values() - .flatten() - .map(|lock: BalanceLock<_>| lock.id == STAKING_ID) - .any(|is_staking| is_staking) -} - fn do_migration() -> Weight where ::Currency: ReservableCurrency, diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index 615e7d7119..3f15b53b99 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -17,14 +17,14 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{ - traits::{Get, OnRuntimeUpgrade, ReservableCurrency}, + traits::{Get, GetStorageVersion, OnRuntimeUpgrade, ReservableCurrency, StorageVersion}, weights::Weight, }; -use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; +use kilt_support::migration::switch_reserved_to_hold; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Config, CredentialEntryOf, Credentials, CurrencyOf, HoldReason}; +use crate::{AccountIdOf, Config, Credentials, CurrencyOf, HoldReason, Pallet}; pub struct BalanceMigration(PhantomData); @@ -34,32 +34,39 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Public Credentials: Initiating migration"); - if is_upgraded::() { + + let onchain_storage_version = Pallet::::on_chain_storage_version(); + + if onchain_storage_version.eq(&StorageVersion::new(1)) { + onchain_storage_version.put::>(); + StorageVersion::new(2).put::>(); return do_migration::(); } + log::info!("Public Credentials: No migration needed. This file should be deleted."); ::DbWeight::get().reads_writes(0, 0) } #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, &'static str> { - use frame_support::ensure; use sp_std::vec; let has_all_user_no_holds = Credentials::::iter_values() - .map(|details: CredentialEntryOf| { - has_user_holds::, CurrencyOf>( + .map(|details: crate::CredentialEntryOf| { + kilt_support::migration::has_user_holds::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); - ensure!( + assert!( has_all_user_no_holds, "Pre Upgrade Public Credentials: there are users with holds!" ); + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(1)); + log::info!("Public Credentials: Pre migration checks successful"); Ok(vec![]) @@ -67,8 +74,7 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::{ensure, traits::fungible::InspectHold}; - use kilt_support::test_utils::log_and_return_error_message; + use frame_support::traits::fungible::InspectHold; Credentials::::iter().try_for_each(|(key, key2, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( @@ -76,40 +82,23 @@ where &details.deposit.owner, ) .saturated_into(); - ensure!( + assert!( details.deposit.amount.saturated_into::() <= hold_balance, - log_and_return_error_message(scale_info::prelude::format!( - "Public Credentails: Hold balance is not matching for credential {:?} {:?}. Expected hold: {:?}. Real hold: {:?}", - key, key2, details.deposit.amount, hold_balance - )) + "Public Credentails: Hold balance is not matching for credential {:?} {:?}. Expected hold: {:?}. Real hold: {:?}", + key, key2, details.deposit.amount, hold_balance + ); - ensure!(!is_upgraded::(), "Users have still no holds"); - Ok(()) })?; + assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(2)); + log::info!("Public Credentials: Post migration checks successful"); Ok(()) } } -/// Checks if there is an user, who has still reserved balance and no holds. If -/// yes, the migration is not executed yet. -fn is_upgraded() -> bool -where - ::Currency: ReservableCurrency, -{ - Credentials::::iter_values() - .map(|details: CredentialEntryOf| { - has_user_holds::, CurrencyOf>( - &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) - }) - .all(|user| user) -} - fn do_migration() -> Weight where ::Currency: ReservableCurrency, @@ -128,9 +117,10 @@ where } log::error!( - " Public Credential: Could not convert reserves to hold from credential: {:?} {:?} ", + " Public Credential: Could not convert reserves to hold from credential: {:?} {:?}, error: {:?}", key, - key2 + key2, + error ); ::DbWeight::get().reads_writes(0, 0) From 10d94148d24e423d574f1afd776cc79faccb9e09 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 21 Jun 2023 19:33:33 +0200 Subject: [PATCH 57/99] removed comments from cargo toml --- runtimes/common/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtimes/common/Cargo.toml b/runtimes/common/Cargo.toml index 20e55bad63..ae09f583fe 100644 --- a/runtimes/common/Cargo.toml +++ b/runtimes/common/Cargo.toml @@ -25,7 +25,7 @@ attestation.workspace = true kilt-support.workspace = true parachain-staking.workspace = true public-credentials.workspace = true -# pallet-web3-names.workspace = true + # Substrate dependencies frame-support.workspace = true @@ -68,7 +68,7 @@ runtime-benchmarks = [ ] std = [ "attestation/std", - "parity-scale-codec/std", # "ctype/std", + "parity-scale-codec/std", "cumulus-primitives-core/std", "frame-support/std", "frame-system/std", From 37bd50da10c41d2e6cb7a724521a8b9195ac1c17 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 21 Jun 2023 19:52:55 +0200 Subject: [PATCH 58/99] updated switch reserves to hold --- support/src/migration.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/support/src/migration.rs b/support/src/migration.rs index a842a7e904..365f6adbc9 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -35,6 +35,7 @@ pub fn switch_reserved_to_hold DispatchResult { - Currency::unreserve(&owner, amount.saturated_into()); - Currency::hold(reason, &owner, amount.saturated_into()) + let remaining_balance = Currency::unreserve(&owner, amount.saturated_into()); + let to_hold_balance = amount.saturating_sub(remaining_balance.saturated_into()); + Currency::hold(reason, &owner, to_hold_balance.saturated_into()) } From 08d31e5c17b3d9ecb7787c875c48303c9381a4dd Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 21 Jun 2023 19:57:18 +0200 Subject: [PATCH 59/99] improved error message --- pallets/public-credentials/src/migrations.rs | 1 - support/src/deposit.rs | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index 3f15b53b99..398b6434b3 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -86,7 +86,6 @@ where details.deposit.amount.saturated_into::() <= hold_balance, "Public Credentails: Hold balance is not matching for credential {:?} {:?}. Expected hold: {:?}. Real hold: {:?}", key, key2, details.deposit.amount, hold_balance - ); Ok(()) diff --git a/support/src/deposit.rs b/support/src/deposit.rs index 66ddf18cab..272efcc4f5 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -51,8 +51,9 @@ pub fn free_deposit>( let result = Currency::release(reason, &deposit.owner, deposit.amount, Precision::BestEffort); debug_assert!( result.is_ok() && result.unwrap() == deposit.amount, - "Released deposit amount does not match with expected amount. Expected: {:?}, Error: {:?}", + "Released deposit amount does not match with expected amount. Expected: {:?}, Released amount: {:?} Error: {:?}", deposit.amount, + result.unwrap(), result.err(), ); Ok(()) From cd051b569a03071d16c68847e2bb1b36c74c1679 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 22 Jun 2023 11:01:38 +0200 Subject: [PATCH 60/99] Make the attestation pallet compile --- pallets/attestation/src/lib.rs | 20 ++++++++++---------- support/src/traits.rs | 34 ++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 098ec284ea..d7579f1483 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -460,11 +460,7 @@ pub mod pallet { let attestation = Attestations::::get(claim_hash).ok_or(Error::::NotFound)?; ensure!(attestation.attester == subject, Error::::NotAuthorized); - AttestationStorageDepositCollector::::change_deposit_owner( - &claim_hash, - sender, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + AttestationStorageDepositCollector::::change_deposit_owner(&claim_hash, sender)?; Ok(()) } @@ -480,10 +476,7 @@ pub mod pallet { let attestation = Attestations::::get(claim_hash).ok_or(Error::::NotFound)?; ensure!(attestation.deposit.owner == sender, Error::::NotAuthorized); - AttestationStorageDepositCollector::::update_deposit( - &claim_hash, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + AttestationStorageDepositCollector::::update_deposit(&claim_hash)?; Ok(()) } @@ -504,8 +497,15 @@ pub mod pallet { } struct AttestationStorageDepositCollector(PhantomData); - impl StorageDepositCollector, ClaimHashOf> for AttestationStorageDepositCollector { + impl StorageDepositCollector, ClaimHashOf, T::RuntimeHoldReason> + for AttestationStorageDepositCollector + { type Currency = ::Currency; + type Reason = HoldReason; + + fn reason() -> Self::Reason { + HoldReason::Deposit + } fn deposit( key: &ClaimHashOf, diff --git a/support/src/traits.rs b/support/src/traits.rs index 9592620016..0aefa92cfc 100644 --- a/support/src/traits.rs +++ b/support/src/traits.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::traits::{ - fungible::hold::{Inspect as InspectHold, Mutate}, + fungible::hold::Mutate, tokens::fungible::{Inspect, MutateHold}, }; use sp_runtime::DispatchError; @@ -89,8 +89,15 @@ pub trait ItemFilter { fn should_include(&self, credential: &Item) -> bool; } -pub trait StorageDepositCollector { - type Currency: MutateHold; +pub trait StorageDepositCollector { + type Currency: MutateHold; + // TODO: This could also be replaced with a `Borrow` or an + // `AsRef`, but not sure what trait the runtime composite + // enum implements. + type Reason: Into + Clone; + + /// Returns the hold reason for deposits taken by the deposit collector; + fn reason() -> Self::Reason; /// Returns the deposit of the storage entry that is stored behind the key. fn deposit(key: &Key) @@ -114,20 +121,17 @@ pub trait StorageDepositCollector { /// The deposit balance of the current owner will be freed, while the /// deposit balance of the new owner will get reserved. The deposit amount /// will not change even if the required byte and item fees were updated. - fn change_deposit_owner( - key: &Key, - new_owner: AccountId, - reason: &>::Reason, - ) -> Result<(), DispatchError> { + fn change_deposit_owner(key: &Key, new_owner: AccountId) -> Result<(), DispatchError> { let deposit = Self::deposit(key)?; + let reason = Self::reason(); - free_deposit::(&deposit, reason)?; + free_deposit::(&deposit, &reason.clone().into())?; let deposit = Deposit { owner: new_owner, ..deposit }; - Self::Currency::hold(reason, &deposit.owner, deposit.amount)?; + Self::Currency::hold(&reason.into(), &deposit.owner, deposit.amount)?; Self::store_deposit(key, deposit)?; @@ -140,19 +144,17 @@ pub trait StorageDepositCollector { /// updates the deposit amount. It either frees parts of the reserved /// balance in case the deposit was lowered or reserves more balance when /// the deposit was raised. - fn update_deposit( - key: &Key, - reason: &>::Reason, - ) -> Result<(), DispatchError> { + fn update_deposit(key: &Key) -> Result<(), DispatchError> { let deposit = Self::deposit(key)?; + let reason = Self::reason(); - free_deposit::(&deposit, reason)?; + free_deposit::(&deposit, &reason.clone().into())?; let deposit = Deposit { amount: Self::deposit_amount(key), ..deposit }; - Self::Currency::hold(reason, &deposit.owner, deposit.amount)?; + Self::Currency::hold(&reason.into(), &deposit.owner, deposit.amount)?; Self::store_deposit(key, deposit)?; From 39b82dfccf7b23172ff6013551eabe5b5ef90214 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 22 Jun 2023 13:52:47 +0200 Subject: [PATCH 61/99] update StorageDepositCollector --- pallets/delegation/src/lib.rs | 20 ++++++++++---------- pallets/did/src/lib.rs | 17 ++++++++++------- pallets/pallet-did-lookup/src/lib.rs | 20 ++++++++++---------- pallets/pallet-web3-names/src/lib.rs | 19 +++++++++---------- pallets/public-credentials/src/lib.rs | 20 ++++++++++---------- 5 files changed, 49 insertions(+), 47 deletions(-) diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index 11f6d21c00..f519988f83 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -678,11 +678,7 @@ pub mod pallet { // parent or another ancestor. ensure!(delegation.details.owner == source.subject(), Error::::AccessDenied); - DelegationDepositCollector::::change_deposit_owner( - &delegation_id, - source.sender(), - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) + DelegationDepositCollector::::change_deposit_owner(&delegation_id, source.sender()) } /// Updates the deposit amount to the current deposit rate. @@ -699,10 +695,7 @@ pub mod pallet { // parent or another ancestor. ensure!(delegation.deposit.owner == sender, Error::::AccessDenied); - DelegationDepositCollector::::update_deposit( - &delegation_id, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + DelegationDepositCollector::::update_deposit(&delegation_id)?; Ok(()) } @@ -1000,8 +993,15 @@ pub mod pallet { } struct DelegationDepositCollector(PhantomData); - impl StorageDepositCollector, DelegationNodeIdOf> for DelegationDepositCollector { + impl StorageDepositCollector, DelegationNodeIdOf, T::RuntimeHoldReason> + for DelegationDepositCollector + { type Currency = ::Currency; + type Reason = HoldReason; + + fn reason() -> Self::Reason { + HoldReason::Deposit + } fn deposit( key: &DelegationNodeIdOf, diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index 5641ce28af..714798742a 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -1117,11 +1117,7 @@ pub mod pallet { let subject = source.subject(); let sender = source.sender(); - DidDepositCollector::::change_deposit_owner( - &subject, - sender, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + DidDepositCollector::::change_deposit_owner(&subject, sender)?; Ok(()) } @@ -1278,8 +1274,15 @@ pub mod pallet { } struct DidDepositCollector(PhantomData); - impl StorageDepositCollector, DidIdentifierOf> for DidDepositCollector { - type Currency = T::Currency; + impl StorageDepositCollector, DidIdentifierOf, T::RuntimeHoldReason> + for DidDepositCollector + { + type Currency = ::Currency; + type Reason = HoldReason; + + fn reason() -> Self::Reason { + HoldReason::Deposit + } fn deposit( key: &DidIdentifierOf, diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index dfcfeb5d7c..57e4f50d5a 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -378,11 +378,7 @@ pub mod pallet { let record = ConnectedDids::::get(&account).ok_or(Error::::NotFound)?; ensure!(record.did == subject, Error::::NotAuthorized); - LinkableAccountDepositCollector::::change_deposit_owner( - &account, - source.sender(), - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) + LinkableAccountDepositCollector::::change_deposit_owner(&account, source.sender()) } /// Updates the deposit amount to the current deposit rate. @@ -396,10 +392,7 @@ pub mod pallet { let record = ConnectedDids::::get(&account).ok_or(Error::::NotFound)?; ensure!(record.deposit.owner == source, Error::::NotAuthorized); - LinkableAccountDepositCollector::::update_deposit( - &account, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) + LinkableAccountDepositCollector::::update_deposit(&account) } // Old call that was used to migrate @@ -462,8 +455,15 @@ pub mod pallet { } struct LinkableAccountDepositCollector(PhantomData); - impl StorageDepositCollector, LinkableAccountId> for LinkableAccountDepositCollector { + impl StorageDepositCollector, LinkableAccountId, T::RuntimeHoldReason> + for LinkableAccountDepositCollector + { type Currency = T::Currency; + type Reason = HoldReason; + + fn reason() -> Self::Reason { + HoldReason::Deposit + } fn deposit( key: &LinkableAccountId, diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index 0ef3185fbf..087aa9a1dd 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -361,11 +361,7 @@ pub mod pallet { let source = ::OwnerOrigin::ensure_origin(origin)?; let w3n_owner = source.subject(); let name = Names::::get(&w3n_owner).ok_or(Error::::NotFound)?; - Web3NameStorageDepositCollector::::change_deposit_owner( - &name, - source.sender(), - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + Web3NameStorageDepositCollector::::change_deposit_owner(&name, source.sender())?; Ok(()) } @@ -381,10 +377,7 @@ pub mod pallet { let w3n_entry = Owner::::get(&name).ok_or(Error::::NotFound)?; ensure!(w3n_entry.deposit.owner == source, Error::::NotAuthorized); - Web3NameStorageDepositCollector::::update_deposit( - &name, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + Web3NameStorageDepositCollector::::update_deposit(&name)?; Ok(()) } @@ -543,9 +536,15 @@ pub mod pallet { } struct Web3NameStorageDepositCollector(PhantomData); - impl StorageDepositCollector, T::Web3Name> for Web3NameStorageDepositCollector { + impl StorageDepositCollector, T::Web3Name, T::RuntimeHoldReason> + for Web3NameStorageDepositCollector + { type Currency = T::Currency; + type Reason = HoldReason; + fn reason() -> Self::Reason { + HoldReason::Deposit + } fn deposit( key: &T::Web3Name, ) -> Result, >>::Balance>, DispatchError> { diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index 0e417051e0..cf0e5086d8 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -525,11 +525,7 @@ pub mod pallet { ensure!(subject == credential_entry.attester, Error::::NotAuthorized); - PublicCredentialDepositCollector::::change_deposit_owner( - &credential_id, - source.sender(), - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + PublicCredentialDepositCollector::::change_deposit_owner(&credential_id, source.sender())?; Ok(()) } @@ -545,10 +541,7 @@ pub mod pallet { ensure!(source == credential_entry.deposit.owner, Error::::NotAuthorized); - PublicCredentialDepositCollector::::update_deposit( - &credential_id, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + PublicCredentialDepositCollector::::update_deposit(&credential_id)?; Ok(()) } @@ -624,8 +617,15 @@ pub mod pallet { } struct PublicCredentialDepositCollector(PhantomData); - impl StorageDepositCollector, CredentialIdOf> for PublicCredentialDepositCollector { + impl StorageDepositCollector, CredentialIdOf, T::RuntimeHoldReason> + for PublicCredentialDepositCollector + { type Currency = ::Currency; + type Reason = HoldReason; + + fn reason() -> Self::Reason { + HoldReason::Deposit + } fn deposit( credential_id: &CredentialIdOf, From 5abb95b54ab65ee280e8ecf1986e80321351cee5 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 22 Jun 2023 14:02:28 +0200 Subject: [PATCH 62/99] add comment for new xcm matcher --- runtimes/common/src/xcm_config.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtimes/common/src/xcm_config.rs b/runtimes/common/src/xcm_config.rs index 56399d4b86..dfd2b48b1f 100644 --- a/runtimes/common/src/xcm_config.rs +++ b/runtimes/common/src/xcm_config.rs @@ -62,6 +62,7 @@ where } /// Reserved funds to the relay chain can't return. See https://github.com/paritytech/polkadot/issues/5233 +/// Usage of the new xcm matcher. See https://github.com/paritytech/polkadot/pull/7098 pub struct DenyReserveTransferToRelayChain; impl ShouldExecute for DenyReserveTransferToRelayChain { fn should_execute( From 88c48f03133171f42a2a2ed71cec226c92d68d80 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 23 Jun 2023 10:20:13 +0200 Subject: [PATCH 63/99] remove unnecessary storage put line --- pallets/attestation/src/migrations.rs | 1 - pallets/delegation/src/migrations.rs | 1 - pallets/did/src/migrations.rs | 1 - pallets/pallet-web3-names/src/migrations.rs | 1 - pallets/parachain-staking/src/migrations.rs | 1 - pallets/public-credentials/src/migrations.rs | 1 - 6 files changed, 6 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index d960005cc2..83daa045ed 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -38,7 +38,6 @@ where let onchain_storage_version = Pallet::::on_chain_storage_version(); if onchain_storage_version.eq(&StorageVersion::new(1)) { - onchain_storage_version.put::>(); StorageVersion::new(2).put::>(); return do_migration::(); } diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index 60ae3eb884..e59324ee81 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -38,7 +38,6 @@ where let onchain_storage_version = Pallet::::on_chain_storage_version(); if onchain_storage_version.eq(&StorageVersion::new(3)) { - onchain_storage_version.put::>(); StorageVersion::new(4).put::>(); return do_migration::(); } diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index f7e3ed7574..51c7e1769a 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -38,7 +38,6 @@ where let onchain_storage_version = Pallet::::on_chain_storage_version(); if onchain_storage_version.eq(&StorageVersion::new(4)) { - onchain_storage_version.put::>(); StorageVersion::new(5).put::>(); return do_migration::(); } diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index cef767ce16..8821035913 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -37,7 +37,6 @@ where let onchain_storage_version = Pallet::::on_chain_storage_version(); if onchain_storage_version.eq(&StorageVersion::new(1)) { - onchain_storage_version.put::>(); StorageVersion::new(2).put::>(); return do_migration::(); } diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index ab179b3fd9..c1428701d2 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -44,7 +44,6 @@ where let onchain_storage_version = Pallet::::on_chain_storage_version(); if onchain_storage_version.eq(&StorageVersion::new(8)) { - onchain_storage_version.put::>(); StorageVersion::new(9).put::>(); return do_migration::(); } diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index 398b6434b3..a8b274356a 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -38,7 +38,6 @@ where let onchain_storage_version = Pallet::::on_chain_storage_version(); if onchain_storage_version.eq(&StorageVersion::new(1)) { - onchain_storage_version.put::>(); StorageVersion::new(2).put::>(); return do_migration::(); } From f46eb0c67c54ba242710cba7da5ad5d49f6cdef4 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 23 Jun 2023 11:18:16 +0200 Subject: [PATCH 64/99] improved log message for no migration --- pallets/attestation/src/migrations.rs | 7 ++++++- pallets/delegation/src/migrations.rs | 7 ++++++- pallets/did/src/migrations.rs | 6 +++++- pallets/pallet-web3-names/src/migrations.rs | 7 +++++-- pallets/parachain-staking/src/migrations.rs | 6 +++++- pallets/public-credentials/src/migrations.rs | 6 +++++- 6 files changed, 32 insertions(+), 7 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 83daa045ed..a739e3ec72 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -42,7 +42,12 @@ where return do_migration::(); } - log::info!("Attestation: No migration needed. This file should be deleted."); + log::info!( + "Attestation: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", + onchain_storage_version, + StorageVersion::new(1) + ); + ::DbWeight::get().reads_writes(0, 0) } diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index e59324ee81..a20a37f5f5 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -42,7 +42,12 @@ where return do_migration::(); } - log::info!("Delegation: No migration needed. This file should be deleted."); + log::info!( + "Delegation: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", + onchain_storage_version, + StorageVersion::new(3) + ); + ::DbWeight::get().reads_writes(0, 0) } diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index 51c7e1769a..2b6c5ff69c 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -42,7 +42,11 @@ where return do_migration::(); } - log::info!("Did: No migration needed. This file should be deleted."); + log::info!( + "Did: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", + onchain_storage_version, + StorageVersion::new(4) + ); ::DbWeight::get().reads_writes(0, 0) } diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index 8821035913..5b334254a7 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -40,8 +40,11 @@ where StorageVersion::new(2).put::>(); return do_migration::(); } - - log::info!("W3n: No migration needed. This file should be deleted."); + log::info!( + "W3N: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", + onchain_storage_version, + StorageVersion::new(1) + ); ::DbWeight::get().reads_writes(0, 0) } diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index c1428701d2..14e43c0151 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -48,7 +48,11 @@ where return do_migration::(); } - log::info!("Staking: No migration needed. This file should be deleted."); + log::info!( + "Staking: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", + onchain_storage_version, + StorageVersion::new(8) + ); ::DbWeight::get().reads_writes(0, 0) } diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index a8b274356a..513c12f40f 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -42,7 +42,11 @@ where return do_migration::(); } - log::info!("Public Credentials: No migration needed. This file should be deleted."); + log::info!( + "Public Credential: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", + onchain_storage_version, + StorageVersion::new(1) + ); ::DbWeight::get().reads_writes(0, 0) } From 65601c06b0739136f857e61a88afc6b41c1dab7a Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 23 Jun 2023 11:52:22 +0200 Subject: [PATCH 65/99] removed crate from migration --- pallets/attestation/src/migrations.rs | 4 ++-- pallets/delegation/src/migrations.rs | 4 ++-- pallets/did/src/migrations.rs | 4 ++-- pallets/pallet-web3-names/src/migrations.rs | 4 ++-- pallets/parachain-staking/src/migrations.rs | 4 ++-- pallets/public-credentials/src/migrations.rs | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index a739e3ec72..63b7023abc 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -69,7 +69,7 @@ where "Pre Upgrade Attestation: there are users with holds!" ); - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(1)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(1)); log::info!("Attestation: Pre migration checks successful"); @@ -97,7 +97,7 @@ where Ok(()) })?; - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(2)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(2)); log::info!("Attestation: Post migration checks successful"); Ok(()) diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index a20a37f5f5..a440221494 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -69,7 +69,7 @@ where "Pre Upgrade Delegation: there are users with holds!" ); - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(3)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(3)); log::info!("Delegation: Pre migration checks successful"); Ok(vec![]) @@ -94,7 +94,7 @@ where Ok(()) })?; - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(4)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(4)); log::info!("Delegation: Post migration checks successful"); Ok(()) diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index 2b6c5ff69c..b994eadff8 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -66,7 +66,7 @@ where ensure!(has_all_user_no_holds, "Pre Upgrade Did: there are users with holds!"); - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(4)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(4)); log::info!("Did: Pre migration checks successful"); @@ -94,7 +94,7 @@ where Ok(()) })?; - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(5)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(5)); log::info!("Did: Post migration checks successful"); Ok(()) diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index 5b334254a7..adec36895a 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -63,7 +63,7 @@ where assert!(has_all_user_no_holds, "Pre Upgrade W3n: there are users with holds!"); - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(1)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(1)); log::info!("W3n: Pre migration checks successful"); @@ -90,7 +90,7 @@ where Ok(()) })?; - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(2)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(2)); log::info!("W3n: Post migration checks successful"); Ok(()) diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index 14e43c0151..d1df52fa23 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -65,7 +65,7 @@ where let count_freezes = pallet_balances::Freezes::::iter().count(); ensure!(count_freezes.is_zero(), "Staking Pre: There are already freezes."); - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(8)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(8)); log::info!("Staking: Pre migration checks successful"); @@ -81,7 +81,7 @@ where ensure!(!count_freezes.is_zero(), "Staking: There are still no freezes."); - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(9)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(9)); log::info!("Staking: Post migration checks successful"); diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index 513c12f40f..bc1e2da46e 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -68,7 +68,7 @@ where "Pre Upgrade Public Credentials: there are users with holds!" ); - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(1)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(1)); log::info!("Public Credentials: Pre migration checks successful"); @@ -94,7 +94,7 @@ where Ok(()) })?; - assert_eq!(crate::Pallet::::on_chain_storage_version(), StorageVersion::new(2)); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(2)); log::info!("Public Credentials: Post migration checks successful"); Ok(()) From bce5342bc353aa9748a83040152f301d800813d7 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 23 Jun 2023 11:52:42 +0200 Subject: [PATCH 66/99] updated did lookup --- pallets/pallet-did-lookup/src/lib.rs | 2 +- pallets/pallet-did-lookup/src/migrations.rs | 67 +++++++++------------ 2 files changed, 29 insertions(+), 40 deletions(-) diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index 57e4f50d5a..ff74bcb39f 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -86,7 +86,7 @@ pub mod pallet { /// The connection record type. pub(crate) type ConnectionRecordOf = ConnectionRecord, AccountIdOf, BalanceOf>; - pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(4); + pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(5); #[pallet::composite_enum] pub enum HoldReason { diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index 3760c07fc3..dae4d458a0 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -22,16 +22,13 @@ use frame_support::{ traits::{Get, GetStorageVersion, OnRuntimeUpgrade, ReservableCurrency, StorageVersion}, weights::Weight, }; -use kilt_support::migration::{has_user_holds, switch_reserved_to_hold}; +use kilt_support::migration::switch_reserved_to_hold; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; -use sp_runtime::AccountId32; +use sp_runtime::{AccountId32, SaturatedConversion}; use sp_std::marker::PhantomData; -use crate::{ - linkable_account::LinkableAccountId, AccountIdOf, Config, ConnectedDids, ConnectionRecordOf, CurrencyOf, - HoldReason, Pallet, -}; +use crate::{linkable_account::LinkableAccountId, AccountIdOf, Config, ConnectedDids, CurrencyOf, HoldReason, Pallet}; /// A unified log target for did-lookup-migration operations. pub const LOG_TARGET: &str = "runtime::pallet-did-lookup::migrations"; @@ -76,7 +73,7 @@ impl OnRuntimeUpgrade for CleanupMigration { if Pallet::::on_chain_storage_version() == StorageVersion::new(3) { log::info!("🔎 DidLookup: Initiating migration"); MigrationStateStore::::kill(); - Pallet::::current_storage_version().put::>(); + StorageVersion::new(4).put::>(); T::DbWeight::get().reads_writes(1, 2) } else { @@ -128,32 +125,41 @@ where { fn on_runtime_upgrade() -> frame_support::weights::Weight { log::info!("Did lookup: Initiating migration"); - if is_upgraded::() { + + let onchain_storage_version = Pallet::::on_chain_storage_version(); + if onchain_storage_version.eq(&StorageVersion::new(4)) { + StorageVersion::new(5).put::>(); return do_migration::(); } - log::info!("Did lookup: No migration needed. This file should be deleted."); + log::info!( + "Did lookup: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", + onchain_storage_version, + StorageVersion::new(3) + ); + ::DbWeight::get().reads_writes(0, 0) } #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, &'static str> { - use frame_support::ensure; use sp_std::vec; let has_all_user_no_holds = ConnectedDids::::iter_values() .map(|details| { - has_user_holds::, CurrencyOf>( + kilt_support::migration::has_user_holds::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) }) .all(|user| user); - ensure!( + assert!( has_all_user_no_holds, "Pre Upgrade Did lookup: there are users with holds!" ); + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(4)); + log::info!("Did: Pre migration checks successful"); Ok(vec![]) @@ -161,9 +167,7 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::{ensure, traits::fungible::InspectHold}; - use kilt_support::test_utils::log_and_return_error_message; - use sp_runtime::SaturatedConversion; + use frame_support::traits::fungible::InspectHold; ConnectedDids::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { let hold_balance: u128 = ::Currency::balance_on_hold( @@ -171,39 +175,24 @@ where &details.deposit.owner, ) .saturated_into(); - ensure!( + assert!( details.deposit.amount.saturated_into::() <= hold_balance, - log_and_return_error_message(scale_info::prelude::format!( - "Did lookup: Hold balance is not matching for connected did {:?}. Expected hold: {:?}. Real hold: {:?}", - key, details.deposit.amount, hold_balance - )) + "Did lookup: Hold balance is not matching for connected did {:?}. Expected hold: {:?}. Real hold: {:?}", + key, + details.deposit.amount, + hold_balance ); - ensure!(!is_upgraded::(), "Did lookup: Users have still no holds"); - Ok(()) })?; + + assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(5)); + log::info!("Did lookup: Post migration checks successful"); Ok(()) } } -/// Checks if there is an user, who has still reserved balance and no holds. If -/// yes, the migration is not executed yet. -fn is_upgraded() -> bool -where - ::Currency: ReservableCurrency, -{ - ConnectedDids::::iter_values() - .map(|details: ConnectionRecordOf| { - has_user_holds::, CurrencyOf>( - &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) - }) - .all(|user| user) -} - fn do_migration() -> Weight where ::Currency: ReservableCurrency, @@ -214,7 +203,7 @@ where let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), - deposit.amount, + deposit.amount.saturated_into(), ); if error.is_ok() { From 06dea8899c33d1d39b8988deb6260df441dbd2df Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 23 Jun 2023 11:54:12 +0200 Subject: [PATCH 67/99] no unwrap --- support/src/deposit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/src/deposit.rs b/support/src/deposit.rs index 272efcc4f5..d1438ecb43 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -50,7 +50,7 @@ pub fn free_deposit>( ) -> DispatchResult { let result = Currency::release(reason, &deposit.owner, deposit.amount, Precision::BestEffort); debug_assert!( - result.is_ok() && result.unwrap() == deposit.amount, + result.is_ok() && result == Ok(deposit.amount), "Released deposit amount does not match with expected amount. Expected: {:?}, Released amount: {:?} Error: {:?}", deposit.amount, result.unwrap(), From 16a126382babf92b6bdcfb79406c3afe15f36d4e Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 23 Jun 2023 12:18:09 +0200 Subject: [PATCH 68/99] refactor: renamed function has_user_holds --- pallets/attestation/src/migrations.rs | 2 +- pallets/delegation/src/migrations.rs | 2 +- pallets/did/src/migrations.rs | 2 +- pallets/pallet-did-lookup/src/migrations.rs | 2 +- pallets/pallet-web3-names/src/migrations.rs | 2 +- pallets/public-credentials/src/migrations.rs | 2 +- support/src/migration.rs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 63b7023abc..92503bbfb4 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -57,7 +57,7 @@ where let has_all_user_no_holds = Attestations::::iter_values() .map(|details: crate::AttestationDetails| { - kilt_support::migration::has_user_holds::, CurrencyOf>( + kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index a440221494..eda71ec684 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -57,7 +57,7 @@ where let has_all_user_no_holds = DelegationNodes::::iter_values() .map(|details: crate::DelegationNode| { - kilt_support::migration::has_user_holds::, CurrencyOf>( + kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index b994eadff8..ae3f408f96 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -57,7 +57,7 @@ where let has_all_user_no_holds = Did::::iter_values() .map(|details: crate::did_details::DidDetails| { - kilt_support::migration::has_user_holds::, CurrencyOf>( + kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index dae4d458a0..3e80a6fc1d 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -146,7 +146,7 @@ where let has_all_user_no_holds = ConnectedDids::::iter_values() .map(|details| { - kilt_support::migration::has_user_holds::, CurrencyOf>( + kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index adec36895a..ab5ba946ca 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -54,7 +54,7 @@ where let has_all_user_no_holds = Owner::::iter_values() .map(|details: crate::Web3OwnershipOf| { - kilt_support::migration::has_user_holds::, CurrencyOf>( + kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index bc1e2da46e..2b2489c8ac 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -56,7 +56,7 @@ where let has_all_user_no_holds = Credentials::::iter_values() .map(|details: crate::CredentialEntryOf| { - kilt_support::migration::has_user_holds::, CurrencyOf>( + kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, &T::RuntimeHoldReason::from(HoldReason::Deposit), ) diff --git a/support/src/migration.rs b/support/src/migration.rs index 365f6adbc9..cc565d66e7 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -23,7 +23,7 @@ use frame_support::{ use sp_runtime::{traits::Zero, SaturatedConversion}; /// Checks some precondition of the migrations. -pub fn has_user_holds + MutateHold>( +pub fn has_user_reserved_balance + MutateHold>( owner: &AccountId, reason: &Currency::Reason, ) -> bool { From 1f612ed1d92b38482b6ab582f6736bdf7ae3a037 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 23 Jun 2023 12:44:39 +0200 Subject: [PATCH 69/99] moved staking id to migration file --- pallets/parachain-staking/src/lib.rs | 3 +-- pallets/parachain-staking/src/migrations.rs | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index cbfecdca11..ef22bdf246 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -153,7 +153,7 @@ pub mod pallet { fungible::{Inspect, MutateFreeze, Unbalanced}, Fortitude, Precision, Preservation, }, - EstimateNextSessionRotation, Get, LockIdentifier, OnUnbalanced, StorageVersion, + EstimateNextSessionRotation, Get, OnUnbalanced, StorageVersion, }, BoundedVec, }; @@ -178,7 +178,6 @@ pub mod pallet { }; use sp_std::{convert::TryInto, fmt::Debug}; - pub(crate) const STAKING_ID: LockIdentifier = *b"kiltpstk"; /// The current storage version. const STORAGE_VERSION: StorageVersion = StorageVersion::new(9); diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index d1df52fa23..d40fe1c7d7 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -18,8 +18,8 @@ use frame_support::{ traits::{ - fungible::freeze::Mutate as MutateFreeze, Get, GetStorageVersion, LockableCurrency, OnRuntimeUpgrade, - ReservableCurrency, StorageVersion, + fungible::freeze::Mutate as MutateFreeze, Get, GetStorageVersion, LockIdentifier, LockableCurrency, + OnRuntimeUpgrade, ReservableCurrency, StorageVersion, }, weights::Weight, }; @@ -29,9 +29,11 @@ use sp_std::marker::PhantomData; use crate::{ types::{AccountIdOf, CurrencyOf}, - Config, FreezeReason, Pallet, STAKING_ID, + Config, FreezeReason, Pallet, }; +const STAKING_ID: LockIdentifier = *b"kiltpstk"; + pub struct BalanceMigration(PhantomData); impl OnRuntimeUpgrade for BalanceMigration From 7576f9059a80a78f3fb2be25baac5f9deeef8a3a Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 23 Jun 2023 12:49:43 +0200 Subject: [PATCH 70/99] replace ensure with assert --- pallets/parachain-staking/src/migrations.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index d40fe1c7d7..687d52aac2 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -60,12 +60,11 @@ where #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, &'static str> { - use frame_support::ensure; use sp_runtime::traits::Zero; use sp_std::vec; let count_freezes = pallet_balances::Freezes::::iter().count(); - ensure!(count_freezes.is_zero(), "Staking Pre: There are already freezes."); + assert!(count_freezes.is_zero(), "Staking Pre: There are already freezes."); assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(8)); From cbc649d692c77ff50554f45212a71797b160d292 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Fri, 23 Jun 2023 14:45:45 +0200 Subject: [PATCH 71/99] remove ensure for assert --- pallets/parachain-staking/src/migrations.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index 687d52aac2..4f85f2efa8 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -75,12 +75,11 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { - use frame_support::ensure; use sp_runtime::traits::Zero; let count_freezes = pallet_balances::Freezes::::iter().count(); - ensure!(!count_freezes.is_zero(), "Staking: There are still no freezes."); + assert!(!count_freezes.is_zero(), "Staking: There are still no freezes."); assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(9)); From ed0fc93380326ddaf001af7dc603c15ff552ae12 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 12:28:50 +0200 Subject: [PATCH 72/99] let trait handle all deposit actions --- pallets/attestation/src/attestations.rs | 2 +- pallets/attestation/src/benchmarking.rs | 8 +++--- pallets/attestation/src/lib.rs | 15 +++-------- pallets/attestation/src/mock.rs | 7 +++-- pallets/attestation/src/tests.rs | 2 +- pallets/delegation/src/access_control.rs | 2 +- .../delegation/src/delegation_hierarchy.rs | 2 +- pallets/delegation/src/lib.rs | 20 +++----------- pallets/delegation/src/mock.rs | 2 +- pallets/did/src/benchmarking.rs | 2 +- pallets/did/src/did_details.rs | 27 ++++++------------- pallets/did/src/lib.rs | 9 +++---- pallets/did/src/mock_utils.rs | 2 +- pallets/did/src/tests.rs | 2 +- pallets/pallet-did-lookup/src/benchmarking.rs | 2 +- .../src/connection_record.rs | 2 +- pallets/pallet-did-lookup/src/lib.rs | 22 ++++----------- pallets/pallet-did-lookup/src/mock.rs | 25 +++++------------ pallets/pallet-did-lookup/src/tests.rs | 2 +- pallets/pallet-web3-names/src/benchmarking.rs | 2 +- pallets/pallet-web3-names/src/lib.rs | 21 +++------------ pallets/pallet-web3-names/src/mock.rs | 2 +- pallets/pallet-web3-names/src/tests.rs | 2 +- .../public-credentials/src/benchmarking.rs | 2 +- pallets/public-credentials/src/credentials.rs | 2 +- pallets/public-credentials/src/lib.rs | 17 ++++-------- pallets/public-credentials/src/mock.rs | 9 +++---- pallets/public-credentials/src/tests.rs | 2 +- runtime-api/did/src/did_details.rs | 2 +- support/src/deposit.rs | 6 ++--- support/src/lib.rs | 4 +-- support/src/traits.rs | 21 ++++++++++++++- 32 files changed, 94 insertions(+), 153 deletions(-) diff --git a/pallets/attestation/src/attestations.rs b/pallets/attestation/src/attestations.rs index 5093d6ba7e..6a22ce4ca0 100644 --- a/pallets/attestation/src/attestations.rs +++ b/pallets/attestation/src/attestations.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use ctype::CtypeHashOf; -use kilt_support::deposit::Deposit; +use kilt_support::Deposit; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; diff --git a/pallets/attestation/src/benchmarking.rs b/pallets/attestation/src/benchmarking.rs index 89e4a0a117..fb362f1ac8 100644 --- a/pallets/attestation/src/benchmarking.rs +++ b/pallets/attestation/src/benchmarking.rs @@ -59,7 +59,7 @@ benchmarks! { attester, authorization_id: None, revoked: false, - deposit: kilt_support::deposit::Deposit { + deposit: kilt_support::Deposit { owner: sender, amount: ::Deposit::get(), } @@ -88,7 +88,7 @@ benchmarks! { attester, authorization_id: None, revoked: true, - deposit: kilt_support::deposit::Deposit { + deposit: kilt_support::Deposit { owner: sender, amount: ::Deposit::get(), } @@ -159,7 +159,7 @@ benchmarks! { attester, authorization_id: None, revoked: false, - deposit: kilt_support::deposit::Deposit { + deposit: kilt_support::Deposit { owner: deposit_owner_new, amount: ::Deposit::get(), } @@ -189,7 +189,7 @@ benchmarks! { attester, authorization_id: None, revoked: false, - deposit: kilt_support::deposit::Deposit { + deposit: kilt_support::Deposit { owner: deposit_owner, amount: ::Deposit::get(), } diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index d7579f1483..59993b78f3 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -98,8 +98,8 @@ pub mod pallet { use ctype::CtypeHashOf; use kilt_support::{ - deposit::Deposit, traits::{CallSources, StorageDepositCollector}, + Deposit, }; /// The current storage version. @@ -283,11 +283,7 @@ pub mod pallet { .transpose()?; let authorization_id = authorization.as_ref().map(|ac| ac.authorization_id()); - let deposit = kilt_support::reserve_deposit::, CurrencyOf>( - payer, - deposit_amount, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + let deposit = AttestationStorageDepositCollector::::create_deposit(payer, deposit_amount)?; log::debug!("insert Attestation"); @@ -484,11 +480,8 @@ pub mod pallet { impl Pallet { fn remove_attestation(attestation: AttestationDetails, claim_hash: ClaimHashOf) -> DispatchResult { - kilt_support::free_deposit::, CurrencyOf>( - &attestation.deposit, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; Attestations::::remove(claim_hash); + AttestationStorageDepositCollector::::free_deposit(attestation.deposit)?; if let Some(authorization_id) = &attestation.authorization_id { ExternalAttestations::::remove(authorization_id, claim_hash); } @@ -496,7 +489,7 @@ pub mod pallet { } } - struct AttestationStorageDepositCollector(PhantomData); + pub(crate) struct AttestationStorageDepositCollector(PhantomData); impl StorageDepositCollector, ClaimHashOf, T::RuntimeHoldReason> for AttestationStorageDepositCollector { diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index c33421774e..ae5438b1ec 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -30,11 +30,11 @@ use sp_core::H256; use sp_runtime::DispatchError; use ctype::CtypeHashOf; -use kilt_support::deposit::Deposit; +use kilt_support::{traits::StorageDepositCollector, Deposit}; use crate::{ pallet::AuthorizationIdOf, AccountIdOf, AttestationAccessControl, AttestationDetails, AttesterOf, BalanceOf, - ClaimHashOf, Config, CurrencyOf, HoldReason, + ClaimHashOf, Config, }; #[cfg(test)] @@ -153,10 +153,9 @@ where } pub fn insert_attestation(claim_hash: ClaimHashOf, details: AttestationDetails) { - kilt_support::reserve_deposit::, CurrencyOf>( + crate::AttestationStorageDepositCollector::::create_deposit( details.deposit.owner.clone(), details.deposit.amount, - &T::RuntimeHoldReason::from(HoldReason::Deposit), ) .expect("Should have balance"); diff --git a/pallets/attestation/src/tests.rs b/pallets/attestation/src/tests.rs index e9be036e1d..e8840c0ec4 100644 --- a/pallets/attestation/src/tests.rs +++ b/pallets/attestation/src/tests.rs @@ -20,7 +20,7 @@ use ctype::mock::get_ctype_hash; use frame_support::{assert_noop, assert_ok, traits::fungible::InspectHold}; use sp_runtime::{traits::Zero, DispatchError, TokenError}; -use kilt_support::{deposit::Deposit, mock::mock_origin::DoubleOrigin}; +use kilt_support::{mock::mock_origin::DoubleOrigin, Deposit}; use crate::{ self as attestation, diff --git a/pallets/delegation/src/access_control.rs b/pallets/delegation/src/access_control.rs index a57d83f088..2bc9524f7d 100644 --- a/pallets/delegation/src/access_control.rs +++ b/pallets/delegation/src/access_control.rs @@ -221,7 +221,7 @@ mod tests { use attestation::{mock::generate_base_attestation, AttestationAccessControl}; use ctype::mock::get_ctype_hash; - use kilt_support::{deposit::Deposit, mock::mock_origin::DoubleOrigin}; + use kilt_support::{mock::mock_origin::DoubleOrigin, Deposit}; use super::*; use crate::{mock::*, DelegationDetails, DelegationNode}; diff --git a/pallets/delegation/src/delegation_hierarchy.rs b/pallets/delegation/src/delegation_hierarchy.rs index dc6fd8a331..30298c9a87 100644 --- a/pallets/delegation/src/delegation_hierarchy.rs +++ b/pallets/delegation/src/delegation_hierarchy.rs @@ -20,7 +20,7 @@ use crate::{AccountIdOf, BalanceOf, Config, DelegationNodeIdOf, DelegatorIdOf, E use bitflags::bitflags; use ctype::CtypeHashOf; use frame_support::{dispatch::DispatchResult, storage::bounded_btree_set::BoundedBTreeSet}; -use kilt_support::deposit::Deposit; +use kilt_support::Deposit; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index f519988f83..c9af628ffb 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -100,9 +100,9 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::Deposit, signature::{SignatureVerificationError, VerifySignature}, traits::CallSources, + Deposit, }; use scale_info::TypeInfo; @@ -732,11 +732,7 @@ pub mod pallet { hierarchy_owner: DelegatorIdOf, deposit_owner: AccountIdOf, ) -> DispatchResult { - kilt_support::reserve_deposit::, CurrencyOf>( - deposit_owner.clone(), - ::Deposit::get(), - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + DelegationDepositCollector::::create_deposit(deposit_owner.clone(), ::Deposit::get())?; let root_node = DelegationNode::new_root_node( root_id, @@ -763,11 +759,7 @@ pub mod pallet { mut parent_node: DelegationNode, deposit_owner: AccountIdOf, ) -> DispatchResult { - kilt_support::reserve_deposit::, CurrencyOf>( - deposit_owner, - ::Deposit::get(), - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + DelegationDepositCollector::::create_deposit(deposit_owner, ::Deposit::get())?; // Add the new node as a child of that node parent_node.try_add_child(delegation_id)?; @@ -978,11 +970,7 @@ pub mod pallet { // We can clear storage now that all children have been removed DelegationNodes::::remove(*delegation); - kilt_support::free_deposit::, CurrencyOf>( - &delegation_node.deposit, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; - + DelegationDepositCollector::::free_deposit(delegation_node.clone().deposit)?; consumed_weight = consumed_weight.saturating_add(T::DbWeight::get().reads_writes(1, 2)); // Deposit event that the delegation has been removed diff --git a/pallets/delegation/src/mock.rs b/pallets/delegation/src/mock.rs index f293098dd2..186108fafe 100644 --- a/pallets/delegation/src/mock.rs +++ b/pallets/delegation/src/mock.rs @@ -26,7 +26,7 @@ use frame_support::{ use sp_core::H256; use ctype::{mock as ctype_mock, CtypeHashOf}; -use kilt_support::deposit::Deposit; +use kilt_support::Deposit; use crate::{ self as delegation, AccountIdOf, Config, CurrencyOf, DelegationDetails, DelegationHierarchyDetails, DelegationNode, diff --git a/pallets/did/src/benchmarking.rs b/pallets/did/src/benchmarking.rs index 28825eb25f..2d4375e3b1 100644 --- a/pallets/did/src/benchmarking.rs +++ b/pallets/did/src/benchmarking.rs @@ -29,7 +29,7 @@ use sp_io::crypto::{ecdsa_generate, ecdsa_sign, ed25519_generate, ed25519_sign, use sp_runtime::{traits::IdentifyAccount, AccountId32, MultiSigner}; use sp_std::{convert::TryInto, vec::Vec}; -use kilt_support::{deposit::Deposit, signature::VerifySignature}; +use kilt_support::{signature::VerifySignature, Deposit}; use crate::{ did_details::{ diff --git a/pallets/did/src/did_details.rs b/pallets/did/src/did_details.rs index f034c8f319..6cafb7f286 100644 --- a/pallets/did/src/did_details.rs +++ b/pallets/did/src/did_details.rs @@ -23,7 +23,7 @@ use frame_support::{ traits::Get, RuntimeDebug, }; -use kilt_support::deposit::Deposit; +use kilt_support::{traits::StorageDepositCollector, Deposit}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen, WrapperTypeEncode}; use scale_info::TypeInfo; use sp_core::{ecdsa, ed25519, sr25519}; @@ -36,8 +36,8 @@ use sp_std::{convert::TryInto, vec::Vec}; use crate::{ errors::{self, DidError}, service_endpoints::DidEndpoint, - utils, AccountIdOf, BalanceOf, BlockNumberOf, Config, CurrencyOf, DidCallableOf, DidEndpointsCount, - DidIdentifierOf, HoldReason, KeyIdOf, Payload, + utils, AccountIdOf, BalanceOf, BlockNumberOf, Config, DidCallableOf, DidDepositCollector, DidEndpointsCount, + DidIdentifierOf, KeyIdOf, Payload, }; /// Types of verification keys a DID can control. @@ -345,23 +345,16 @@ impl DidDetails { match new_required_deposit.cmp(&self.deposit.amount) { Ordering::Greater => { let deposit_to_reserve = new_required_deposit.saturating_sub(self.deposit.amount); - kilt_support::reserve_deposit::, CurrencyOf>( - self.deposit.owner.clone(), - deposit_to_reserve, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + DidDepositCollector::::create_deposit(self.deposit.clone().owner, deposit_to_reserve)?; self.deposit.amount = self.deposit.amount.saturating_add(deposit_to_reserve); } Ordering::Less => { let deposit_to_release = self.deposit.amount.saturating_sub(new_required_deposit); - let deposit = Deposit { + + DidDepositCollector::::free_deposit(Deposit { owner: self.deposit.owner.clone(), amount: deposit_to_release, - }; - kilt_support::free_deposit::, CurrencyOf>( - &deposit, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + })?; self.deposit.amount = self.deposit.amount.saturating_sub(deposit_to_release); } _ => (), @@ -406,11 +399,7 @@ impl DidDetails { let deposit_amount = new_did_details.calculate_deposit(did_subject); new_did_details.deposit.amount = deposit_amount; - kilt_support::reserve_deposit::, CurrencyOf>( - details.submitter, - deposit_amount, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + DidDepositCollector::::create_deposit(details.submitter, deposit_amount)?; Ok(new_did_details) } diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index 714798742a..3ac548097e 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -147,8 +147,8 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::Deposit, traits::{CallSources, StorageDepositCollector}, + Deposit, }; use sp_runtime::traits::BadOrigin; @@ -1257,10 +1257,7 @@ pub mod pallet { let did_entry = Did::::take(&did_subject).ok_or(Error::::NotFound)?; DidEndpointsCount::::remove(&did_subject); - kilt_support::free_deposit::, CurrencyOf>( - &did_entry.deposit, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + DidDepositCollector::::free_deposit(did_entry.deposit)?; // Mark as deleted to prevent potential replay-attacks of re-adding a previously // deleted DID. DidBlacklist::::insert(&did_subject, ()); @@ -1273,7 +1270,7 @@ pub mod pallet { } } - struct DidDepositCollector(PhantomData); + pub(crate) struct DidDepositCollector(PhantomData); impl StorageDepositCollector, DidIdentifierOf, T::RuntimeHoldReason> for DidDepositCollector { diff --git a/pallets/did/src/mock_utils.rs b/pallets/did/src/mock_utils.rs index 4132fec309..8537a3b814 100644 --- a/pallets/did/src/mock_utils.rs +++ b/pallets/did/src/mock_utils.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::storage::bounded_btree_set::BoundedBTreeSet; -use kilt_support::deposit::Deposit; +use kilt_support::Deposit; use sp_runtime::{traits::Zero, AccountId32, SaturatedConversion}; use sp_std::{ collections::btree_set::BTreeSet, diff --git a/pallets/did/src/tests.rs b/pallets/did/src/tests.rs index 5675760669..bebe07dedf 100644 --- a/pallets/did/src/tests.rs +++ b/pallets/did/src/tests.rs @@ -3441,7 +3441,7 @@ fn test_update_deposit() { Did::get_did(&alice_did) .expect("DID should be present on chain.") .deposit, - kilt_support::deposit::Deposit { + kilt_support::Deposit { owner: alice_did, amount: ::BaseDeposit::get(), } diff --git a/pallets/pallet-did-lookup/src/benchmarking.rs b/pallets/pallet-did-lookup/src/benchmarking.rs index 25fb58e018..885248a8db 100644 --- a/pallets/pallet-did-lookup/src/benchmarking.rs +++ b/pallets/pallet-did-lookup/src/benchmarking.rs @@ -36,7 +36,7 @@ use sp_runtime::{ AccountId32, KeyTypeId, }; -use kilt_support::{deposit::Deposit, traits::GenerateBenchmarkOrigin}; +use kilt_support::{traits::GenerateBenchmarkOrigin, Deposit}; use crate::{ account::AccountId20, diff --git a/pallets/pallet-did-lookup/src/connection_record.rs b/pallets/pallet-did-lookup/src/connection_record.rs index bcfee9e72d..d94b892cff 100644 --- a/pallets/pallet-did-lookup/src/connection_record.rs +++ b/pallets/pallet-did-lookup/src/connection_record.rs @@ -16,7 +16,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use kilt_support::deposit::Deposit; +use kilt_support::Deposit; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index ff74bcb39f..fdc09a6d96 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -64,8 +64,8 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use kilt_support::{ - deposit::Deposit, traits::{CallSources, StorageDepositCollector}, + Deposit, }; use runtime_common::Balance; @@ -415,20 +415,13 @@ pub mod pallet { did: did_identifier.clone(), }; - kilt_support::reserve_deposit::, CurrencyOf>( - record.deposit.owner.clone(), - record.deposit.amount, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + LinkableAccountDepositCollector::::create_deposit(record.clone().deposit.owner, record.deposit.amount)?; ConnectedDids::::mutate(&account, |did_entry| -> DispatchResult { if let Some(old_connection) = did_entry.replace(record) { ConnectedAccounts::::remove(&old_connection.did, &account); Self::deposit_event(Event::::AssociationRemoved(account.clone(), old_connection.did)); - kilt_support::free_deposit::, CurrencyOf>( - &old_connection.deposit, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + LinkableAccountDepositCollector::::free_deposit(old_connection.deposit)?; } Ok(()) })?; @@ -440,13 +433,9 @@ pub mod pallet { pub(crate) fn remove_association(account: LinkableAccountId) -> DispatchResult { if let Some(connection) = ConnectedDids::::take(&account) { + LinkableAccountDepositCollector::::free_deposit(connection.deposit)?; ConnectedAccounts::::remove(&connection.did, &account); - kilt_support::free_deposit::, CurrencyOf>( - &connection.deposit, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; Self::deposit_event(Event::AssociationRemoved(account, connection.did)); - Ok(()) } else { Err(Error::::NotFound.into()) @@ -454,7 +443,7 @@ pub mod pallet { } } - struct LinkableAccountDepositCollector(PhantomData); + pub(crate) struct LinkableAccountDepositCollector(PhantomData); impl StorageDepositCollector, LinkableAccountId, T::RuntimeHoldReason> for LinkableAccountDepositCollector { @@ -482,7 +471,6 @@ pub mod pallet { ) -> Result<(), DispatchError> { let record = ConnectedDids::::get(key).ok_or(Error::::NotFound)?; ConnectedDids::::insert(key, ConnectionRecord { deposit, ..record }); - Ok(()) } } diff --git a/pallets/pallet-did-lookup/src/mock.rs b/pallets/pallet-did-lookup/src/mock.rs index a43584d45f..6107093f77 100644 --- a/pallets/pallet-did-lookup/src/mock.rs +++ b/pallets/pallet-did-lookup/src/mock.rs @@ -18,8 +18,8 @@ use frame_support::parameter_types; use kilt_support::{ - deposit::Deposit, mock::{mock_origin, SubjectId}, + traits::StorageDepositCollector, }; use sp_runtime::{ testing::Header, @@ -29,7 +29,7 @@ use sp_runtime::{ use crate::{ self as pallet_did_lookup, linkable_account::LinkableAccountId, AccountIdOf, BalanceOf, Config, ConnectedAccounts, - ConnectedDids, ConnectionRecord, CurrencyOf, DidIdentifierOf, HoldReason, + ConnectedDids, ConnectionRecord, DidIdentifierOf, LinkableAccountDepositCollector, }; pub(crate) type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; @@ -144,30 +144,19 @@ pub(crate) fn insert_raw_connection( account: LinkableAccountId, deposit: BalanceOf, ) { - let deposit = Deposit { - owner: sender, - amount: deposit, - }; + let deposit = LinkableAccountDepositCollector::::create_deposit(sender, deposit) + .expect("Account should have enough balance"); + let record = ConnectionRecord { deposit, did: did_identifier.clone(), }; - kilt_support::reserve_deposit::, CurrencyOf>( - record.deposit.owner.clone(), - record.deposit.amount, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) - .expect("Account should have enough balance"); - ConnectedDids::::mutate(&account, |did_entry| { if let Some(old_connection) = did_entry.replace(record) { ConnectedAccounts::::remove(&old_connection.did, &account); - kilt_support::free_deposit::, CurrencyOf>( - &old_connection.deposit, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) - .expect("Could not release deposit of account"); + LinkableAccountDepositCollector::::free_deposit(old_connection.deposit) + .expect("Could not release deposit of account"); } }); ConnectedAccounts::::insert(&did_identifier, &account, ()); diff --git a/pallets/pallet-did-lookup/src/tests.rs b/pallets/pallet-did-lookup/src/tests.rs index e59e4bd459..f0637892fc 100644 --- a/pallets/pallet-did-lookup/src/tests.rs +++ b/pallets/pallet-did-lookup/src/tests.rs @@ -17,7 +17,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::{assert_noop, assert_ok, crypto::ecdsa::ECDSAExt, traits::fungible::InspectHold}; -use kilt_support::{deposit::Deposit, mock::mock_origin}; +use kilt_support::{mock::mock_origin, Deposit}; use parity_scale_codec::Encode; use sha3::{Digest, Keccak256}; use sp_runtime::{ diff --git a/pallets/pallet-web3-names/src/benchmarking.rs b/pallets/pallet-web3-names/src/benchmarking.rs index 2b2a25894a..dce74fcb33 100644 --- a/pallets/pallet-web3-names/src/benchmarking.rs +++ b/pallets/pallet-web3-names/src/benchmarking.rs @@ -30,7 +30,7 @@ use frame_support::{ use frame_system::RawOrigin; use sp_runtime::app_crypto::sr25519; -use kilt_support::{deposit::Deposit, traits::GenerateBenchmarkOrigin}; +use kilt_support::{traits::GenerateBenchmarkOrigin, Deposit}; use crate::{ mock::insert_raw_w3n, AccountIdOf, Banned, Call, Config, CurrencyOf, Names, Owner, Pallet, Web3NameOf, diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index 087aa9a1dd..49f46854b4 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -57,8 +57,8 @@ pub mod pallet { use sp_std::{fmt::Debug, vec::Vec}; use kilt_support::{ - deposit::Deposit, traits::{CallSources, StorageDepositCollector}, + Deposit, }; use super::WeightInfo; @@ -422,18 +422,8 @@ pub mod pallet { owner: Web3NameOwnerOf, deposit_payer: AccountIdOf, ) -> DispatchResult { - let deposit = Deposit { - owner: deposit_payer, - amount: T::Deposit::get(), - }; let block_number = frame_system::Pallet::::block_number(); - - // Should never fail since we checked in the preconditions - kilt_support::reserve_deposit::, CurrencyOf>( - deposit.owner.clone(), - deposit.amount, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + let deposit = Web3NameStorageDepositCollector::::create_deposit(deposit_payer, T::Deposit::get())?; Names::::insert(&owner, name.clone()); Owner::::insert( @@ -482,10 +472,7 @@ pub mod pallet { Names::::remove(&name_ownership.owner); // Should never fail since we checked in the preconditions - kilt_support::free_deposit::, CurrencyOf>( - &name_ownership.deposit, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + Web3NameStorageDepositCollector::::free_deposit(name_ownership.clone().deposit)?; Ok(name_ownership) } @@ -535,7 +522,7 @@ pub mod pallet { } } - struct Web3NameStorageDepositCollector(PhantomData); + pub(crate) struct Web3NameStorageDepositCollector(PhantomData); impl StorageDepositCollector, T::Web3Name, T::RuntimeHoldReason> for Web3NameStorageDepositCollector { diff --git a/pallets/pallet-web3-names/src/mock.rs b/pallets/pallet-web3-names/src/mock.rs index 8989ebf864..108c1cdafb 100644 --- a/pallets/pallet-web3-names/src/mock.rs +++ b/pallets/pallet-web3-names/src/mock.rs @@ -16,7 +16,7 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org use frame_support::traits::fungible::MutateHold; -use kilt_support::deposit::Deposit; +use kilt_support::Deposit; use crate::{ AccountIdOf, BalanceOf, Config, CurrencyOf, HoldReason, Names, Owner, Web3NameOf, Web3NameOwnerOf, Web3OwnershipOf, diff --git a/pallets/pallet-web3-names/src/tests.rs b/pallets/pallet-web3-names/src/tests.rs index afcc90d714..d57c238a89 100644 --- a/pallets/pallet-web3-names/src/tests.rs +++ b/pallets/pallet-web3-names/src/tests.rs @@ -23,7 +23,7 @@ use frame_support::{ }; use frame_system::RawOrigin; -use kilt_support::{deposit::Deposit, mock::mock_origin}; +use kilt_support::{mock::mock_origin, Deposit}; use sp_runtime::{traits::Zero, DispatchError, TokenError}; use crate::{mock::*, Banned, Config, Error, HoldReason, Names, Owner, Pallet, Web3OwnershipOf}; diff --git a/pallets/public-credentials/src/benchmarking.rs b/pallets/public-credentials/src/benchmarking.rs index 888bfe3a7c..ad6dd4a581 100644 --- a/pallets/public-credentials/src/benchmarking.rs +++ b/pallets/public-credentials/src/benchmarking.rs @@ -26,8 +26,8 @@ use sp_std::{boxed::Box, vec, vec::Vec}; use ctype::CtypeEntryOf; use kilt_support::{ - deposit::Deposit, traits::{GenerateBenchmarkOrigin, GetWorstCase}, + Deposit, }; use crate::{ diff --git a/pallets/public-credentials/src/credentials.rs b/pallets/public-credentials/src/credentials.rs index 21c8698b59..b03642c133 100644 --- a/pallets/public-credentials/src/credentials.rs +++ b/pallets/public-credentials/src/credentials.rs @@ -21,7 +21,7 @@ use scale_info::TypeInfo; use frame_support::RuntimeDebug; -use kilt_support::deposit::Deposit; +use kilt_support::Deposit; /// The type of a credentials as incoming from the outside world. /// Some of its fields are parsed and/or transformed inside the `add` operation. diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index cf0e5086d8..9fb2a53329 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -69,8 +69,8 @@ pub mod pallet { pub use ctype::CtypeHashOf; use kilt_support::{ - deposit::Deposit, traits::{CallSources, StorageDepositCollector}, + Deposit, }; /// The current storage version. @@ -306,12 +306,8 @@ pub mod pallet { Error::::AlreadyAttested ); - let deposit = kilt_support::reserve_deposit::, CurrencyOf>( - payer, - deposit_amount, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - ) - .map_err(|_| Error::::UnableToPayFees)?; + let deposit = PublicCredentialDepositCollector::::create_deposit(payer, deposit_amount) + .map_err(|_| Error::::UnableToPayFees)?; let block_number = frame_system::Pallet::::block_number(); @@ -555,10 +551,7 @@ pub mod pallet { credential_id: CredentialIdOf, credential: CredentialEntryOf, ) -> DispatchResult { - kilt_support::free_deposit::>( - &credential.deposit, - &T::RuntimeHoldReason::from(HoldReason::Deposit), - )?; + PublicCredentialDepositCollector::::free_deposit(credential.deposit)?; Credentials::::remove(&credential_subject, &credential_id); CredentialSubjects::::remove(&credential_id); @@ -616,7 +609,7 @@ pub mod pallet { } } - struct PublicCredentialDepositCollector(PhantomData); + pub(crate) struct PublicCredentialDepositCollector(PhantomData); impl StorageDepositCollector, CredentialIdOf, T::RuntimeHoldReason> for PublicCredentialDepositCollector { diff --git a/pallets/public-credentials/src/mock.rs b/pallets/public-credentials/src/mock.rs index 9d9c1bd632..3a94e1dc0a 100644 --- a/pallets/public-credentials/src/mock.rs +++ b/pallets/public-credentials/src/mock.rs @@ -20,11 +20,11 @@ use frame_support::traits::Get; use parity_scale_codec::Encode; use sp_runtime::traits::Hash; -use kilt_support::deposit::Deposit; +use kilt_support::{traits::StorageDepositCollector, Deposit}; use crate::{ - AccountIdOf, AttesterOf, BalanceOf, Config, CredentialEntryOf, CredentialIdOf, CredentialSubjects, Credentials, - CtypeHashOf, CurrencyOf, HoldReason, InputClaimsContentOf, InputCredentialOf, InputSubjectIdOf, + AttesterOf, BalanceOf, Config, CredentialEntryOf, CredentialIdOf, CredentialSubjects, Credentials, CtypeHashOf, + InputClaimsContentOf, InputCredentialOf, InputSubjectIdOf, PublicCredentialDepositCollector, }; // Generate a public credential using a many Default::default() as possible. @@ -76,10 +76,9 @@ pub(crate) fn insert_public_credentials( credential_id: CredentialIdOf, credential_entry: CredentialEntryOf, ) { - kilt_support::reserve_deposit::, CurrencyOf>( + PublicCredentialDepositCollector::::create_deposit( credential_entry.deposit.owner.clone(), credential_entry.deposit.amount, - &T::RuntimeHoldReason::from(HoldReason::Deposit), ) .expect("Attester should have enough balance"); diff --git a/pallets/public-credentials/src/tests.rs b/pallets/public-credentials/src/tests.rs index fb4f5f0773..9cb68ac322 100644 --- a/pallets/public-credentials/src/tests.rs +++ b/pallets/public-credentials/src/tests.rs @@ -23,7 +23,7 @@ use frame_support::{ use sp_runtime::traits::Zero; use ctype::mock::get_ctype_hash; -use kilt_support::{deposit::Deposit, mock::mock_origin::DoubleOrigin}; +use kilt_support::{mock::mock_origin::DoubleOrigin, Deposit}; use crate::{ mock::*, Config, CredentialIdOf, CredentialSubjects, Credentials, Error, HoldReason, InputClaimsContentOf, diff --git a/runtime-api/did/src/did_details.rs b/runtime-api/did/src/did_details.rs index 509aa72928..82f6e2fd6f 100644 --- a/runtime-api/did/src/did_details.rs +++ b/runtime-api/did/src/did_details.rs @@ -21,7 +21,7 @@ use scale_info::TypeInfo; use sp_std::collections::{btree_map::BTreeMap, btree_set::BTreeSet}; use did::{did_details::DidPublicKeyDetails, AccountIdOf, BalanceOf, BlockNumberOf, KeyIdOf}; -use kilt_support::deposit::Deposit; +use kilt_support::Deposit; #[derive(Encode, Decode, TypeInfo, Clone, Debug, Eq, PartialEq, MaxEncodedLen)] pub struct DidDetails { diff --git a/support/src/deposit.rs b/support/src/deposit.rs index d1438ecb43..0694c9cabb 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -32,7 +32,7 @@ pub struct Deposit { pub amount: Balance, } -pub fn reserve_deposit>( +pub(crate) fn reserve_deposit>( account: Account, deposit_amount: Currency::Balance, reason: &Currency::Reason, @@ -44,13 +44,13 @@ pub fn reserve_deposit>( }) } -pub fn free_deposit>( +pub(crate) fn free_deposit>( deposit: &Deposit, reason: &Currency::Reason, ) -> DispatchResult { let result = Currency::release(reason, &deposit.owner, deposit.amount, Precision::BestEffort); debug_assert!( - result.is_ok() && result == Ok(deposit.amount), + result == Ok(deposit.amount), "Released deposit amount does not match with expected amount. Expected: {:?}, Released amount: {:?} Error: {:?}", deposit.amount, result.unwrap(), diff --git a/support/src/lib.rs b/support/src/lib.rs index 6b1e3306a8..38b6c21d92 100644 --- a/support/src/lib.rs +++ b/support/src/lib.rs @@ -17,8 +17,8 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org #![cfg_attr(not(feature = "std"), no_std)] -pub mod deposit; -pub use deposit::{free_deposit, reserve_deposit}; +mod deposit; +pub use deposit::Deposit; pub mod migration; #[cfg(any(feature = "runtime-benchmarks", feature = "mock"))] diff --git a/support/src/traits.rs b/support/src/traits.rs index 0aefa92cfc..f2bdb41f66 100644 --- a/support/src/traits.rs +++ b/support/src/traits.rs @@ -22,7 +22,7 @@ use frame_support::traits::{ }; use sp_runtime::DispatchError; -use crate::deposit::{free_deposit, Deposit}; +use crate::deposit::{free_deposit, reserve_deposit, Deposit}; /// The sources of a call struct. /// @@ -116,6 +116,25 @@ pub trait StorageDepositCollector { deposit: Deposit>::Balance>, ) -> Result<(), DispatchError>; + /// Release the deposit. + fn free_deposit( + deposit: Deposit>::Balance>, + ) -> Result<(), DispatchError> { + free_deposit::(&deposit, &Self::reason().into()) + } + + /// Creates a new deposit for user. + /// + /// # Errors + /// Can fail if the user has not enough balance. + fn create_deposit( + who: AccountId, + amount: >::Balance, + ) -> Result>::Balance>, DispatchError> { + let reason = Self::reason(); + reserve_deposit::(who, amount, &reason.into()) + } + /// Change the deposit owner. /// /// The deposit balance of the current owner will be freed, while the From 2ae86115b5d4a963e9eb232236e94971fb0d9bb6 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 13:09:21 +0200 Subject: [PATCH 73/99] use into instead of from --- pallets/attestation/src/migrations.rs | 12 +- pallets/attestation/src/tests.rs | 80 +---- pallets/delegation/src/migrations.rs | 12 +- pallets/delegation/src/tests.rs | 319 ++++--------------- pallets/did/src/benchmarking.rs | 4 +- pallets/did/src/migrations.rs | 12 +- pallets/did/src/mock.rs | 8 +- pallets/did/src/tests.rs | 94 ++---- pallets/pallet-did-lookup/src/lib.rs | 4 +- pallets/pallet-did-lookup/src/migrations.rs | 12 +- pallets/pallet-did-lookup/src/tests.rs | 98 +----- pallets/pallet-web3-names/src/lib.rs | 2 +- pallets/pallet-web3-names/src/migrations.rs | 12 +- pallets/pallet-web3-names/src/mock.rs | 2 +- pallets/pallet-web3-names/src/tests.rs | 55 +--- pallets/public-credentials/src/migrations.rs | 12 +- pallets/public-credentials/src/tests.rs | 49 +-- 17 files changed, 167 insertions(+), 620 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 92503bbfb4..38c84e036e 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -59,7 +59,7 @@ where .map(|details: crate::AttestationDetails| { kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), ) }) .all(|user| user); @@ -81,11 +81,9 @@ where use frame_support::traits::fungible::InspectHold; Attestations::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = ::Currency::balance_on_hold( - &T::RuntimeHoldReason::from(HoldReason::Deposit), - &details.deposit.owner, - ) - .saturated_into(); + let hold_balance: u128 = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) + .saturated_into(); assert!( details.deposit.amount.saturated_into::() <= hold_balance, "Attestation: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", @@ -113,7 +111,7 @@ where let deposit = attestations_detail.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), deposit.amount.saturated_into(), ); diff --git a/pallets/attestation/src/tests.rs b/pallets/attestation/src/tests.rs index e8840c0ec4..e3b18a3738 100644 --- a/pallets/attestation/src/tests.rs +++ b/pallets/attestation/src/tests.rs @@ -184,10 +184,7 @@ fn test_revoke_remove() { assert!(stored_attestation.revoked); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); @@ -197,11 +194,7 @@ fn test_revoke_remove() { None )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); }); } @@ -230,10 +223,7 @@ fn test_authorized_revoke() { assert!(stored_attestation.revoked); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); }); @@ -392,11 +382,7 @@ fn test_remove_not_found() { .with_balances(vec![(ACCOUNT_00, ::Deposit::get() * 100)]) .with_ctypes(vec![(attestation.ctype_hash, attester.clone())]) .build_and_execute_with_sanity_tests(|| { - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_noop!( Attestation::remove(DoubleOrigin(ACCOUNT_00, attester.clone()).into(), claim_hash, None), attestation::Error::::NotFound @@ -421,10 +407,7 @@ fn test_reclaim_deposit() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); assert_ok!(Attestation::reclaim_deposit( @@ -436,11 +419,7 @@ fn test_reclaim_deposit() { claim_hash )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); }); } @@ -456,10 +435,7 @@ fn test_reclaim_deposit_authorization() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); assert_ok!(Attestation::reclaim_deposit( @@ -467,11 +443,7 @@ fn test_reclaim_deposit_authorization() { claim_hash )); assert!(Attestation::attestations(claim_hash).is_none()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); }); } @@ -530,10 +502,7 @@ fn test_change_deposit_owner() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); assert_ok!(Attestation::change_deposit_owner( @@ -549,16 +518,9 @@ fn test_change_deposit_owner() { amount: ::Deposit::get() } ); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); }); @@ -578,10 +540,7 @@ fn test_change_deposit_owner_insufficient_balance() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); assert_noop!( @@ -644,10 +603,7 @@ fn test_update_deposit() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_ok!(Attestation::update_deposit( @@ -666,10 +622,7 @@ fn test_update_deposit() { // old deposit was 2x Deposit::get(), new deposit should be the the default // deposit value. assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); }); @@ -692,10 +645,7 @@ fn test_update_deposit_unauthorized() { .with_attestations(vec![(claim_hash, attestation)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_noop!( diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index eda71ec684..a532b07a1c 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -59,7 +59,7 @@ where .map(|details: crate::DelegationNode| { kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), ) }) .all(|user| user); @@ -80,11 +80,9 @@ where use frame_support::traits::fungible::InspectHold; DelegationNodes::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = ::Currency::balance_on_hold( - &T::RuntimeHoldReason::from(HoldReason::Deposit), - &details.deposit.owner, - ) - .saturated_into(); + let hold_balance: u128 = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) + .saturated_into(); assert!( details.deposit.amount.saturated_into::() <= hold_balance, "Delegation: Hold balance is not matching for delegation node {:?}. Expected hold: {:?}. Real hold: {:?}", @@ -110,7 +108,7 @@ where let deposit = delegation_detail.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), deposit.amount.saturated_into(), ); diff --git a/pallets/delegation/src/tests.rs b/pallets/delegation/src/tests.rs index 7486834845..a344b86b57 100644 --- a/pallets/delegation/src/tests.rs +++ b/pallets/delegation/src/tests.rs @@ -55,10 +55,7 @@ fn create_root_delegation_successful() { // Check reserved balance assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); @@ -177,10 +174,7 @@ fn create_delegation_direct_root_successful() { // 1 Deposit should be reserved for hierarchy assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); @@ -196,10 +190,7 @@ fn create_delegation_direct_root_successful() { // 2 Deposits should be reserved for hierarchy and delegation to root assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 2 * ::Deposit::get() ); @@ -269,10 +260,7 @@ fn create_delegation_with_parent_successful() { // Should have deposited for hierarchy and parent delegation assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 2 * ::Deposit::get() ); @@ -288,17 +276,10 @@ fn create_delegation_with_parent_successful() { // Should have deposited for hierarchy, parent delegation and sub-delegation assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 3 * ::Deposit::get() ); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); // Data in stored delegation and operation should match let stored_delegation = @@ -736,17 +717,11 @@ fn list_hierarchy_revoke_and_remove_root_successful() { .build_and_execute_with_sanity_tests(|| { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_some()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); @@ -789,16 +764,8 @@ fn list_hierarchy_revoke_and_remove_root_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); }); } @@ -866,17 +833,11 @@ fn tree_hierarchy_revoke_and_remove_root_successful() { ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); @@ -891,16 +852,8 @@ fn tree_hierarchy_revoke_and_remove_root_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation2_id).is_none()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); }); } @@ -964,17 +917,11 @@ fn max_max_revocations_revoke_and_remove_successful() { ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); @@ -989,16 +936,8 @@ fn max_max_revocations_revoke_and_remove_successful() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); }); } @@ -1159,10 +1098,7 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { ]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); @@ -1207,17 +1143,11 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { // Should not remove root because tree traversal steps are insufficient assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), 3 * ::Deposit::get() ); // assert_err and not assert_noop because the storage is indeed changed, but @@ -1236,17 +1166,11 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { assert!(Delegation::delegation_nodes(delegation2_id).is_some()); assert!(Delegation::delegation_nodes(delegation3_id).is_some()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), 3 * ::Deposit::get() ); @@ -1259,16 +1183,8 @@ fn exact_children_max_revocations_revoke_and_remove_root_error() { assert!(Delegation::delegation_nodes(operation.id).is_none()); assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation3_id).is_none()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); }); } @@ -1337,17 +1253,11 @@ fn direct_owner_revoke_and_remove_delegation_successful() { ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); @@ -1363,17 +1273,10 @@ fn direct_owner_revoke_and_remove_delegation_successful() { assert!(Delegation::delegation_nodes(parent_id).is_none()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); }); } @@ -1413,17 +1316,11 @@ fn parent_owner_revoke_delegation_successful() { .build_and_execute_with_sanity_tests(|| { // Parent should not be able to remove the child delegation directly assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); assert_noop!( @@ -1467,17 +1364,10 @@ fn parent_owner_revoke_delegation_successful() { assert!(Delegation::delegation_nodes(parent_id).is_some()); assert!(Delegation::delegation_nodes(delegation_id).is_none()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 2 * ::Deposit::get() ); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); }); } @@ -1608,24 +1498,15 @@ fn parent_too_far_revoke_and_remove_delegation_error() { // removal assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_02 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_02), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); @@ -1734,16 +1615,8 @@ fn direct_owner_reclaim_deposit_delegation_successful() { assert!(Delegation::delegation_nodes(delegation_id).is_none()); // We have released all the deposits by deleting the root node. - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); }); } @@ -1776,17 +1649,11 @@ fn parent_owner_reclaim_deposit_error() { // Parent should not be able to claim the deposit for the child delegation // directly assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 2 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); assert_noop!( @@ -2228,10 +2095,7 @@ fn remove_single_hierarchy() { assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_some()); assert!(Delegation::delegation_nodes(hierarchy_root_id).is_some()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); @@ -2251,11 +2115,7 @@ fn remove_single_hierarchy() { )); assert!(Delegation::delegation_hierarchies(hierarchy_root_id).is_none()); assert!(Delegation::delegation_nodes(hierarchy_root_id).is_none()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); }); } @@ -2306,24 +2166,15 @@ fn remove_children_gas_runs_out() { ]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), 3 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_02 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_02), ::Deposit::get() ); @@ -2346,24 +2197,15 @@ fn remove_children_gas_runs_out() { assert!(Delegation::delegation_nodes(delegation3_id).is_some()); assert!(Delegation::delegation_nodes(delegation4_id).is_some()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), 3 * ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_02 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_02), ::Deposit::get() ); @@ -2377,21 +2219,9 @@ fn remove_children_gas_runs_out() { assert!(Delegation::delegation_nodes(delegation1_id).is_none()); assert!(Delegation::delegation_nodes(delegation2_id).is_none()); assert!(Delegation::delegation_nodes(delegation3_id).is_none()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_02 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_02).is_zero()); }); } @@ -2430,17 +2260,10 @@ fn test_change_deposit_owner() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 3 ); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); assert_ok!(Delegation::change_deposit_owner( DoubleOrigin(ACCOUNT_01, delegate).into(), delegation_id @@ -2448,17 +2271,11 @@ fn test_change_deposit_owner() { // ACCOUNT_00 has still one deposit (there are two nodes) assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); }); @@ -2489,17 +2306,10 @@ fn test_change_deposit_owner_insufficient_balance() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 3 ); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01).is_zero()); assert_noop!( Delegation::change_deposit_owner(DoubleOrigin(ACCOUNT_01, delegate).into(), delegation_id), TokenError::CannotCreateHold @@ -2597,10 +2407,7 @@ fn test_update_deposit() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 3 ); assert_ok!(Delegation::update_deposit( @@ -2610,10 +2417,7 @@ fn test_update_deposit() { // ACCOUNT_00 has still one deposit (there are two nodes) assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 2 ); }); @@ -2644,10 +2448,7 @@ fn test_update_deposit_unauthorized() { .with_delegations(vec![(parent_id, parent_node), (delegation_id, delegation_node)]) .build_and_execute_with_sanity_tests(|| { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 3 ); assert_noop!( diff --git a/pallets/did/src/benchmarking.rs b/pallets/did/src/benchmarking.rs index 2d4375e3b1..5f28013e48 100644 --- a/pallets/did/src/benchmarking.rs +++ b/pallets/did/src/benchmarking.rs @@ -1148,7 +1148,7 @@ benchmarks! { did_details.deposit.owner = did_account.clone(); make_free_for_did::(&did_account); - CurrencyOf::::hold(&T::RuntimeHoldReason::from(HoldReason::Deposit), &did_account, did_details.deposit.amount).expect("should reserve currency"); + CurrencyOf::::hold(&HoldReason::Deposit.into(), &did_account, did_details.deposit.amount).expect("should reserve currency"); Did::::insert(&did_subject, did_details); let origin = RawOrigin::Signed(did_subject.clone()); @@ -1174,7 +1174,7 @@ benchmarks! { Did::::insert(&did_subject, did_details.clone()); make_free_for_did::(&did_account); - CurrencyOf::::hold(&T::RuntimeHoldReason::from(HoldReason::Deposit), &did_account, did_details.deposit.amount).expect("should reserve currency"); + CurrencyOf::::hold(&HoldReason::Deposit.into(), &did_account, did_details.deposit.amount).expect("should reserve currency"); let origin = RawOrigin::Signed(did_subject.clone()); let did_to_update = did_subject.clone(); diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index ae3f408f96..3b1c356f73 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -59,7 +59,7 @@ where .map(|details: crate::did_details::DidDetails| { kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), ) }) .all(|user| user); @@ -78,11 +78,9 @@ where use frame_support::traits::fungible::InspectHold; Did::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = ::Currency::balance_on_hold( - &T::RuntimeHoldReason::from(HoldReason::Deposit), - &details.deposit.owner, - ) - .saturated_into(); + let hold_balance: u128 = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) + .saturated_into(); assert!( details.deposit.amount.saturated_into::() <= hold_balance, "Did: Hold balance is not matching for Did {:?}. Expected hold: {:?}. Real hold: {:?}", @@ -110,7 +108,7 @@ where let deposit = did_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), deposit.amount.saturated_into(), ); diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index 0b26dfcdd3..d2b37b8d65 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -500,12 +500,8 @@ impl ExtBuilder { for did in self.dids_stored.iter() { did::Did::::insert(&did.0, did.1.clone()); - CurrencyOf::::hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &did.1.deposit.owner, - did.1.deposit.amount, - ) - .expect("Deposit owner should have enough balance"); + CurrencyOf::::hold(&HoldReason::Deposit.into(), &did.1.deposit.owner, did.1.deposit.amount) + .expect("Deposit owner should have enough balance"); } for did in self.deleted_dids.iter() { DidBlacklist::::insert(did, ()); diff --git a/pallets/did/src/tests.rs b/pallets/did/src/tests.rs index bebe07dedf..dfa37d0b1b 100644 --- a/pallets/did/src/tests.rs +++ b/pallets/did/src/tests.rs @@ -77,10 +77,7 @@ fn check_successful_simple_ed25519_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::BaseDeposit::get() ); @@ -123,10 +120,7 @@ fn check_successful_simple_sr25519_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::BaseDeposit::get() ); assert_eq!(Balances::balance(&ACCOUNT_FEE), ::Fee::get()); @@ -168,10 +162,7 @@ fn check_successful_simple_ecdsa_creation() { assert_eq!(stored_did.last_tx_counter, 0u64); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::BaseDeposit::get() ); assert_eq!(Balances::balance(&ACCOUNT_FEE), ::Fee::get()); @@ -287,10 +278,7 @@ fn check_successful_complete_creation() { ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::BaseDeposit::get() + required_balance_for_endpoint + required_balance_for_key_agreement @@ -327,10 +315,7 @@ fn check_deposit_change_by_adding_service_endpoint() { )); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &alice_did - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &alice_did), ::ServiceEndpointDeposit::get() + ::BaseDeposit::get() ); @@ -2178,20 +2163,13 @@ fn check_successful_deletion_no_endpoints() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::delete(RuntimeOrigin::signed(alice_did.clone()), 0)); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); @@ -2232,20 +2210,13 @@ fn check_successful_deletion_with_endpoints() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 1); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::delete(RuntimeOrigin::signed(alice_did.clone()), 1)); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); @@ -2331,10 +2302,7 @@ fn check_successful_reclaiming() { .build_and_execute_with_sanity_tests(None, || { assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 1); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::reclaim_deposit( @@ -2344,11 +2312,7 @@ fn check_successful_reclaiming() { )); assert!(Did::get_did(alice_did.clone()).is_none()); assert!(Did::get_deleted_did(alice_did.clone()).is_some()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_eq!(did::pallet::DidEndpointsCount::::get(&alice_did), 0); // Re-adding the same DID identifier should fail. @@ -2384,10 +2348,7 @@ fn unauthorized_reclaiming() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::BaseDeposit::get() ); assert_noop!( @@ -3313,23 +3274,13 @@ fn test_change_deposit_owner() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::BaseDeposit::get() ); assert_ok!(Did::change_deposit_owner(RuntimeOrigin::signed(alice_did.clone()))); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &alice_did - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &alice_did), ::BaseDeposit::get() ); }); @@ -3417,10 +3368,7 @@ fn test_update_deposit() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &alice_did - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &alice_did), ::BaseDeposit::get() * 2 ); @@ -3430,10 +3378,7 @@ fn test_update_deposit() { )); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &alice_did - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &alice_did), ::BaseDeposit::get() ); @@ -3470,10 +3415,7 @@ fn test_update_deposit_unauthorized() { .with_dids(vec![(alice_did.clone(), did_details)]) .build_and_execute_with_sanity_tests(None, || { assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &alice_did - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &alice_did), ::BaseDeposit::get() * 2 ); assert_noop!( diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index fdc09a6d96..6e504e97db 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -255,7 +255,7 @@ pub mod pallet { ensure!( >>::can_hold( - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), &sender, ::Deposit::get() ), @@ -290,7 +290,7 @@ pub mod pallet { ensure!( >>::can_hold( - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), &source.sender(), ::Deposit::get() ), diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index 3e80a6fc1d..e765c58513 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -148,7 +148,7 @@ where .map(|details| { kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), ) }) .all(|user| user); @@ -170,11 +170,9 @@ where use frame_support::traits::fungible::InspectHold; ConnectedDids::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = ::Currency::balance_on_hold( - &T::RuntimeHoldReason::from(HoldReason::Deposit), - &details.deposit.owner, - ) - .saturated_into(); + let hold_balance: u128 = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) + .saturated_into(); assert!( details.deposit.amount.saturated_into::() <= hold_balance, "Did lookup: Hold balance is not matching for connected did {:?}. Expected hold: {:?}. Real hold: {:?}", @@ -202,7 +200,7 @@ where let deposit = did_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), deposit.amount.saturated_into(), ); diff --git a/pallets/pallet-did-lookup/src/tests.rs b/pallets/pallet-did-lookup/src/tests.rs index f0637892fc..5059a53b15 100644 --- a/pallets/pallet-did-lookup/src/tests.rs +++ b/pallets/pallet-did-lookup/src/tests.rs @@ -57,10 +57,7 @@ fn test_add_association_sender() { ); assert!(ConnectedAccounts::::get(DID_00, LINKABLE_ACCOUNT_00).is_some()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); @@ -79,10 +76,7 @@ fn test_add_association_sender() { assert!(ConnectedAccounts::::get(DID_00, LINKABLE_ACCOUNT_00).is_none()); assert!(ConnectedAccounts::::get(DID_01, LINKABLE_ACCOUNT_00).is_some()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); }); @@ -127,10 +121,7 @@ fn test_add_association_account() { ConnectedAccounts::::get(DID_00, LinkableAccountId::from(account_hash_alice.clone())).is_some() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); @@ -161,10 +152,7 @@ fn test_add_association_account() { ConnectedAccounts::::get(DID_01, LinkableAccountId::from(account_hash_alice.clone())).is_some() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); @@ -189,18 +177,9 @@ fn test_add_association_account() { ConnectedAccounts::::get(DID_00, LinkableAccountId::from(account_hash_alice.clone())).is_none() ); assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(account_hash_alice)).is_some()); + assert_eq!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 0); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), - 0 - ); - assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); }); @@ -244,10 +223,7 @@ fn test_add_eth_association() { ); assert!(ConnectedAccounts::::get(DID_00, LinkableAccountId::from(eth_account)).is_some()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); }); @@ -318,13 +294,7 @@ fn test_remove_association_sender() { assert!(DidLookup::remove_sender_association(RuntimeOrigin::signed(ACCOUNT_00)).is_ok()); assert_eq!(ConnectedDids::::get(LinkableAccountId::from(ACCOUNT_00)), None); assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(ACCOUNT_00)).is_none()); - assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), - 0 - ); + assert_eq!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 0); }); } @@ -359,13 +329,7 @@ fn test_remove_association_account() { .is_ok()); assert_eq!(ConnectedDids::::get(LinkableAccountId::from(ACCOUNT_00)), None); assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(ACCOUNT_00)).is_none()); - assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), - 0 - ); + assert_eq!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), 0); }); } @@ -406,10 +370,7 @@ fn test_remove_association_account_not_authorized() { Error::::NotAuthorized ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); }); @@ -428,13 +389,7 @@ fn test_reclaim_deposit() { RuntimeOrigin::signed(ACCOUNT_01), ACCOUNT_00.into() )); - assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), - 0 - ); + assert_eq!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), 0); }); } @@ -452,10 +407,7 @@ fn test_reclaim_deposit_not_authorized() { Error::::NotAuthorized ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); }); @@ -477,16 +429,9 @@ fn test_change_deposit_owner() { mock_origin::DoubleOrigin(ACCOUNT_01, DID_00).into(), ACCOUNT_00.into() )); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); }) @@ -554,10 +499,7 @@ fn test_update_deposit() { ::Deposit::get() * 2, ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_ok!(DidLookup::update_deposit( @@ -565,10 +507,7 @@ fn test_update_deposit() { ACCOUNT_00.into() )); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); }) @@ -589,10 +528,7 @@ fn test_update_deposit_unauthorized() { ::Deposit::get() * 2, ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_noop!( diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index 49f46854b4..7709d583b2 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -403,7 +403,7 @@ pub mod pallet { ensure!( >>::can_hold( - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), deposit_payer, T::Deposit::get() ), diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index ab5ba946ca..a0d501a4dd 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -56,7 +56,7 @@ where .map(|details: crate::Web3OwnershipOf| { kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), ) }) .all(|user| user); @@ -75,11 +75,9 @@ where use frame_support::traits::fungible::InspectHold; Owner::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = ::Currency::balance_on_hold( - &T::RuntimeHoldReason::from(HoldReason::Deposit), - &details.deposit.owner, - ) - .saturated_into(); + let hold_balance: u128 = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) + .saturated_into(); assert!( details.deposit.amount.saturated_into::() <= hold_balance, "W3n: Hold balance is not matching for w3n {:?}. Expected hold: {:?}. Real hold: {:?}", @@ -106,7 +104,7 @@ where let deposit = w3n_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), deposit.amount.saturated_into(), ); diff --git a/pallets/pallet-web3-names/src/mock.rs b/pallets/pallet-web3-names/src/mock.rs index 108c1cdafb..a6b359f6ea 100644 --- a/pallets/pallet-web3-names/src/mock.rs +++ b/pallets/pallet-web3-names/src/mock.rs @@ -31,7 +31,7 @@ pub(crate) fn insert_raw_w3n( block_number: BlockNumberOf, deposit: BalanceOf, ) { - CurrencyOf::::hold(&T::RuntimeHoldReason::from(HoldReason::Deposit), &payer, deposit) + CurrencyOf::::hold(&HoldReason::Deposit.into(), &payer, deposit) .expect("Payer should have enough funds for deposit"); Names::::insert(&owner, name.clone()); diff --git a/pallets/pallet-web3-names/src/tests.rs b/pallets/pallet-web3-names/src/tests.rs index d57c238a89..088b5c43b9 100644 --- a/pallets/pallet-web3-names/src/tests.rs +++ b/pallets/pallet-web3-names/src/tests.rs @@ -40,11 +40,7 @@ fn claiming_successful() { .build_and_execute_with_sanity_tests(|| { assert!(Names::::get(&DID_00).is_none()); assert!(Owner::::get(&web3_name_00).is_none()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_ok!(Pallet::::claim( mock_origin::DoubleOrigin(ACCOUNT_00, DID_00).into(), @@ -69,10 +65,7 @@ fn claiming_successful() { ); // Test that the deposit was reserved correctly. assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), Web3NameDeposit::get() ); assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance - Web3NameDeposit::get(),); @@ -183,11 +176,7 @@ fn releasing_by_owner_successful() { assert!(Owner::::get(&web3_name_00).is_none()); // Test that the deposit was returned to the payer correctly. - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance); }) } @@ -208,11 +197,7 @@ fn releasing_by_payer_successful() { assert!(Names::::get(&DID_00).is_none()); assert!(Owner::::get(&web3_name_00).is_none()); // Test that the deposit was returned to the payer correctly. - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance); }) } @@ -283,11 +268,7 @@ fn banning_successful() { assert!(Owner::::get(&web3_name_00).is_none()); assert!(Banned::::get(&web3_name_00).is_some()); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_eq!(Balances::balance(&ACCOUNT_00), initial_balance); // Ban an unclaimed name @@ -407,16 +388,9 @@ fn test_change_deposit_owner() { amount: ::Deposit::get() } ); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); }) @@ -467,10 +441,7 @@ fn test_update_deposit() { ::Deposit::get() * 2, ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_ok!(Pallet::::update_deposit( @@ -487,10 +458,7 @@ fn test_update_deposit() { } ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); }) @@ -511,10 +479,7 @@ fn test_update_deposit_unauthorized() { ::Deposit::get() * 2, ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() * 2 ); assert_noop!( diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index 2b2489c8ac..784e0200ec 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -58,7 +58,7 @@ where .map(|details: crate::CredentialEntryOf| { kilt_support::migration::has_user_reserved_balance::, CurrencyOf>( &details.deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), ) }) .all(|user| user); @@ -80,11 +80,9 @@ where use frame_support::traits::fungible::InspectHold; Credentials::::iter().try_for_each(|(key, key2, details)| -> Result<(), &'static str> { - let hold_balance: u128 = ::Currency::balance_on_hold( - &T::RuntimeHoldReason::from(HoldReason::Deposit), - &details.deposit.owner, - ) - .saturated_into(); + let hold_balance: u128 = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) + .saturated_into(); assert!( details.deposit.amount.saturated_into::() <= hold_balance, "Public Credentails: Hold balance is not matching for credential {:?} {:?}. Expected hold: {:?}. Real hold: {:?}", @@ -110,7 +108,7 @@ where let deposit = pc_details.deposit; let error = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, - &T::RuntimeHoldReason::from(HoldReason::Deposit), + &HoldReason::Deposit.into(), deposit.amount.saturated_into(), ); diff --git a/pallets/public-credentials/src/tests.rs b/pallets/public-credentials/src/tests.rs index 9cb68ac322..e1197d0383 100644 --- a/pallets/public-credentials/src/tests.rs +++ b/pallets/public-credentials/src/tests.rs @@ -56,11 +56,7 @@ fn add_successful_without_authorization() { .with_ctypes(vec![(ctype_hash_1, attester.clone()), (ctype_hash_2, attester.clone())]) .build_and_execute_with_sanity_tests(|| { // Check for 0 reserved deposit - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); assert_ok!(PublicCredentials::add( DoubleOrigin(ACCOUNT_00, attester.clone()).into(), @@ -79,10 +75,7 @@ fn add_successful_without_authorization() { // Check deposit reservation logic assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), deposit ); @@ -97,10 +90,7 @@ fn add_successful_without_authorization() { // Check deposit has not changed assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), deposit ); @@ -125,10 +115,7 @@ fn add_successful_without_authorization() { // Deposit is 2x now assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), 2 * deposit ); }); @@ -596,11 +583,7 @@ fn remove_successful() { assert!(CredentialSubjects::::get(credential_id).is_none()); // Check deposit release logic - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); // Removing the same credential again will fail assert_noop!( @@ -732,11 +715,7 @@ fn reclaim_deposit_successful() { assert!(CredentialSubjects::::get(credential_id).is_none()); // Check deposit release logic - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); // Reclaiming the deposit for the same credential again will fail assert_noop!( @@ -830,17 +809,10 @@ fn test_change_deposit_owner() { ACCOUNT_01 ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_01 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_01), ::Deposit::get() ); - assert!(Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ) - .is_zero()); + assert!(Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00).is_zero()); }); } @@ -936,10 +908,7 @@ fn test_update_deposit() { ::Deposit::get() ); assert_eq!( - Balances::balance_on_hold( - &::RuntimeHoldReason::from(HoldReason::Deposit), - &ACCOUNT_00 - ), + Balances::balance_on_hold(&HoldReason::Deposit.into(), &ACCOUNT_00), ::Deposit::get() ); }); From fe07f7d8ff297561b2ff1701dccd1adc60ca9b58 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 13:16:09 +0200 Subject: [PATCH 74/99] rename dust handler --- pallets/attestation/src/migrations.rs | 2 +- runtimes/common/src/lib.rs | 4 ++-- runtimes/peregrine/src/lib.rs | 10 +++++----- runtimes/spiritnet/src/lib.rs | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 38c84e036e..5be2fbfb49 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -85,7 +85,7 @@ where ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) .saturated_into(); assert!( - details.deposit.amount.saturated_into::() <= hold_balance, + details.deposit.amount.saturated_into::() = hold_balance, "Attestation: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", key, details.deposit.amount, diff --git a/runtimes/common/src/lib.rs b/runtimes/common/src/lib.rs index 5c502a7a59..c201374aa9 100644 --- a/runtimes/common/src/lib.rs +++ b/runtimes/common/src/lib.rs @@ -203,9 +203,9 @@ where } } -pub struct DustAndFeeHandler(sp_std::marker::PhantomData); +pub struct SendDustAndFeesToTreasury(sp_std::marker::PhantomData); -impl OnUnbalanced> for DustAndFeeHandler +impl OnUnbalanced> for SendDustAndFeesToTreasury where T: pallet_balances::Config, T: pallet_treasury::Config, diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index f3c7464096..bc2f951e9f 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -205,7 +205,7 @@ impl pallet_balances::Config for Runtime { /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; - type DustRemoval = runtime_common::DustAndFeeHandler; + type DustRemoval = runtime_common::SendDustAndFeesToTreasury; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = weights::pallet_balances::WeightInfo; @@ -590,7 +590,7 @@ impl ctype::Config for Runtime { type CtypeCreatorId = AccountId; type Currency = Balances; type Fee = constants::CtypeFee; - type FeeCollector = runtime_common::DustAndFeeHandler; + type FeeCollector = runtime_common::SendDustAndFeesToTreasury; type EnsureOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; @@ -611,7 +611,7 @@ impl did::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type Currency = Balances; type Fee = constants::did::DidFee; - type FeeCollector = runtime_common::DustAndFeeHandler; + type FeeCollector = runtime_common::SendDustAndFeesToTreasury; #[cfg(not(feature = "runtime-benchmarks"))] type EnsureOrigin = did::EnsureDidOrigin; @@ -670,7 +670,7 @@ impl pallet_inflation::Config for Runtime { type Currency = Balances; type InitialPeriodLength = constants::treasury::InitialPeriodLength; type InitialPeriodReward = constants::treasury::InitialPeriodReward; - type Beneficiary = runtime_common::DustAndFeeHandler; + type Beneficiary = runtime_common::SendDustAndFeesToTreasury; type WeightInfo = weights::pallet_inflation::WeightInfo; } @@ -694,7 +694,7 @@ impl parachain_staking::Config for Runtime { type MaxUnstakeRequests = constants::staking::MaxUnstakeRequests; type NetworkRewardRate = constants::staking::NetworkRewardRate; type NetworkRewardStart = constants::staking::NetworkRewardStart; - type NetworkRewardBeneficiary = runtime_common::DustAndFeeHandler; + type NetworkRewardBeneficiary = runtime_common::SendDustAndFeesToTreasury; type WeightInfo = weights::parachain_staking::WeightInfo; const BLOCKS_PER_YEAR: Self::BlockNumber = constants::BLOCKS_PER_YEAR; diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 2d839b6ae0..294353892b 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -205,7 +205,7 @@ impl pallet_balances::Config for Runtime { type Balance = Balance; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; - type DustRemoval = runtime_common::DustAndFeeHandler; + type DustRemoval = runtime_common::SendDustAndFeesToTreasury; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = weights::pallet_balances::WeightInfo; @@ -580,7 +580,7 @@ impl ctype::Config for Runtime { type CtypeCreatorId = AccountId; type Currency = Balances; type Fee = constants::CtypeFee; - type FeeCollector = runtime_common::DustAndFeeHandler; + type FeeCollector = runtime_common::SendDustAndFeesToTreasury; type EnsureOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; @@ -603,7 +603,7 @@ impl did::Config for Runtime { type ServiceEndpointDeposit = constants::did::ServiceEndpointDeposit; type BaseDeposit = constants::did::DidBaseDeposit; type Fee = constants::did::DidFee; - type FeeCollector = runtime_common::DustAndFeeHandler; + type FeeCollector = runtime_common::SendDustAndFeesToTreasury; #[cfg(not(feature = "runtime-benchmarks"))] type EnsureOrigin = did::EnsureDidOrigin; @@ -662,7 +662,7 @@ impl pallet_inflation::Config for Runtime { type Currency = Balances; type InitialPeriodLength = constants::treasury::InitialPeriodLength; type InitialPeriodReward = constants::treasury::InitialPeriodReward; - type Beneficiary = runtime_common::DustAndFeeHandler; + type Beneficiary = runtime_common::SendDustAndFeesToTreasury; type WeightInfo = weights::pallet_inflation::WeightInfo; } @@ -687,7 +687,7 @@ impl parachain_staking::Config for Runtime { type MaxUnstakeRequests = constants::staking::MaxUnstakeRequests; type NetworkRewardRate = constants::staking::NetworkRewardRate; type NetworkRewardStart = constants::staking::NetworkRewardStart; - type NetworkRewardBeneficiary = runtime_common::DustAndFeeHandler; + type NetworkRewardBeneficiary = runtime_common::SendDustAndFeesToTreasury; type WeightInfo = weights::parachain_staking::WeightInfo; const BLOCKS_PER_YEAR: Self::BlockNumber = constants::BLOCKS_PER_YEAR; From f1efce41b8166eb4cf4c4b721ac73e332e846550 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 13:24:27 +0200 Subject: [PATCH 75/99] add error message --- runtimes/common/src/fees.rs | 3 ++- runtimes/common/src/lib.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/runtimes/common/src/fees.rs b/runtimes/common/src/fees.rs index dc4522b4e2..d520c0b478 100644 --- a/runtimes/common/src/fees.rs +++ b/runtimes/common/src/fees.rs @@ -88,7 +88,8 @@ where { fn on_nonzero_unbalanced(amount: CreditOf) { if let Some(author) = >::author() { - let _ = >::resolve(&author, amount); + let result = pallet_balances::Pallet::::resolve(&author, amount); + debug_assert!(result.is_ok(), "The whole credit cannot be countered"); } } } diff --git a/runtimes/common/src/lib.rs b/runtimes/common/src/lib.rs index c201374aa9..d0968c1a02 100644 --- a/runtimes/common/src/lib.rs +++ b/runtimes/common/src/lib.rs @@ -212,6 +212,7 @@ where { fn on_nonzero_unbalanced(amount: CreditOf) { let treasury_account_id = pallet_treasury::Pallet::::account_id(); - let _ = pallet_balances::Pallet::::resolve(&treasury_account_id, amount); + let result = pallet_balances::Pallet::::resolve(&treasury_account_id, amount); + debug_assert!(result.is_ok(), "The whole credit cannot be countered"); } } From a30a15706cb14befb9c29e46e6d5ffc71e0f0249 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 13:28:17 +0200 Subject: [PATCH 76/99] add treasury in feature --- runtimes/common/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtimes/common/Cargo.toml b/runtimes/common/Cargo.toml index ae09f583fe..ac21db4b91 100644 --- a/runtimes/common/Cargo.toml +++ b/runtimes/common/Cargo.toml @@ -79,6 +79,7 @@ std = [ "pallet-balances/std", "pallet-membership/std", "pallet-transaction-payment/std", + "pallet-treasury/std", "parachain-staking/std", "polkadot-parachain/std", "public-credentials/std", @@ -101,6 +102,7 @@ try-runtime = [ "pallet-balances/try-runtime", "pallet-membership/try-runtime", "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", "parachain-staking/try-runtime", "public-credentials/try-runtime", ] From 0e50b2811cdccdfe2c05d2fd83bee1721c1a7cd7 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 13:30:11 +0200 Subject: [PATCH 77/99] remove unnecessary migration --- runtimes/peregrine/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index bc2f951e9f..7aa49850f0 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -1094,8 +1094,6 @@ pub type Executive = frame_executive::Executive< // Executes pallet hooks in the order of definition in construct_runtime AllPalletsWithSystem, ( - pallet_did_lookup::migrations::CleanupMigration, - runtime_common::migrations::RemoveInsecureRandomnessPallet, pallet_did_lookup::migrations::CleanupMigration, runtime_common::migrations::RemoveInsecureRandomnessPallet, attestation::migrations::BalanceMigration, From fb8f6613fedf620a060265ab557d4a1b07a34088 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 13:49:09 +0200 Subject: [PATCH 78/99] typo --- pallets/attestation/src/migrations.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 5be2fbfb49..38c84e036e 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -85,7 +85,7 @@ where ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) .saturated_into(); assert!( - details.deposit.amount.saturated_into::() = hold_balance, + details.deposit.amount.saturated_into::() <= hold_balance, "Attestation: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", key, details.deposit.amount, From 1993e94543f892d23cbc74de2698e6e88c673cd8 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 14:07:02 +0200 Subject: [PATCH 79/99] benchmark --- runtimes/common/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/runtimes/common/Cargo.toml b/runtimes/common/Cargo.toml index ac21db4b91..eacbbef9c7 100644 --- a/runtimes/common/Cargo.toml +++ b/runtimes/common/Cargo.toml @@ -60,6 +60,7 @@ runtime-benchmarks = [ "kilt-support/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-membership/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", "polkadot-parachain/runtime-benchmarks", "public-credentials/runtime-benchmarks", "sp-runtime/runtime-benchmarks", From e5966d6b775b4b648f609ba3b0af6e77973f8e45 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 15:51:53 +0200 Subject: [PATCH 80/99] updated weights for migration --- pallets/attestation/src/migrations.rs | 46 ++++++++++-------- pallets/delegation/src/migrations.rs | 44 +++++++++-------- pallets/did/src/migrations.rs | 46 +++++++++++------- pallets/pallet-did-lookup/src/migrations.rs | 39 +++++++++------ pallets/pallet-web3-names/src/migrations.rs | 41 ++++++++++------ pallets/parachain-staking/src/migrations.rs | 13 +++-- pallets/public-credentials/src/migrations.rs | 51 +++++++++++--------- 7 files changed, 166 insertions(+), 114 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 38c84e036e..344918fba7 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -27,6 +27,9 @@ use sp_std::marker::PhantomData; use crate::{AccountIdOf, Attestations, Config, CurrencyOf, HoldReason, Pallet}; +const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(1); +const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(2); + pub struct BalanceMigration(PhantomData); impl OnRuntimeUpgrade for BalanceMigration @@ -37,18 +40,22 @@ where log::info!("Attestation: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&StorageVersion::new(1)) { - StorageVersion::new(2).put::>(); - return do_migration::(); - } - log::info!( + if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + TARGET_STORAGE_VERSION.put::>(); + + ::DbWeight::get() + .reads_writes(1, 1) + .saturating_add(do_migration::()) + } else { + log::info!( "Attestation: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", onchain_storage_version, - StorageVersion::new(1) + CURRENT_STORAGE_VERSION ); - ::DbWeight::get().reads_writes(0, 0) + ::DbWeight::get().reads_writes(1, 0) + } } #[cfg(feature = "try-runtime")] @@ -69,7 +76,7 @@ where "Pre Upgrade Attestation: there are users with holds!" ); - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(1)); + assert_eq!(Pallet::::on_chain_storage_version(), CURRENT_STORAGE_VERSION); log::info!("Attestation: Pre migration checks successful"); @@ -95,7 +102,7 @@ where Ok(()) })?; - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(2)); + assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); log::info!("Attestation: Post migration checks successful"); Ok(()) @@ -109,23 +116,24 @@ where Attestations::::iter() .map(|(key, attestations_detail)| -> Weight { let deposit = attestations_detail.deposit; - let error = switch_reserved_to_hold::, CurrencyOf>( + let result = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, &HoldReason::Deposit.into(), deposit.amount.saturated_into(), ); - if error.is_ok() { - return ::DbWeight::get().reads_writes(1, 1); + if result.is_err() { + log::error!( + " Attestation: Could not convert reserves to hold from attestation: {:?} error: {:?}", + key, + result + ); } - log::error!( - " Attestation: Could not convert reserves to hold from attestation: {:?} error: {:?}", - key, - error - ); - - ::DbWeight::get().reads_writes(0, 0) + // Currency::reserve and Currency::hold each read and write to the DB once. + // Since we are uncertain about which operation may fail, in the event of an + // error, we assume the worst-case scenario here. + ::DbWeight::get().reads_writes(2, 2) }) .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) } diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index a532b07a1c..f59492b028 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -27,6 +27,9 @@ use sp_std::marker::PhantomData; use crate::{AccountIdOf, Config, CurrencyOf, DelegationNodes, HoldReason, Pallet}; +const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(3); +const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(4); + pub struct BalanceMigration(PhantomData); impl OnRuntimeUpgrade for BalanceMigration @@ -37,18 +40,20 @@ where log::info!("Delegation: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&StorageVersion::new(3)) { - StorageVersion::new(4).put::>(); - return do_migration::(); - } - - log::info!( + if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + TARGET_STORAGE_VERSION.put::>(); + ::DbWeight::get() + .reads_writes(1, 1) + .saturating_add(do_migration::()) + } else { + log::info!( "Delegation: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", onchain_storage_version, - StorageVersion::new(3) + CURRENT_STORAGE_VERSION ); - ::DbWeight::get().reads_writes(0, 0) + ::DbWeight::get().reads_writes(1, 0) + } } #[cfg(feature = "try-runtime")] @@ -69,7 +74,7 @@ where "Pre Upgrade Delegation: there are users with holds!" ); - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(3)); + assert_eq!(Pallet::::on_chain_storage_version(), CURRENT_STORAGE_VERSION); log::info!("Delegation: Pre migration checks successful"); Ok(vec![]) @@ -92,7 +97,7 @@ where Ok(()) })?; - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(4)); + assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); log::info!("Delegation: Post migration checks successful"); Ok(()) @@ -112,17 +117,18 @@ where deposit.amount.saturated_into(), ); - if error.is_ok() { - return ::DbWeight::get().reads_writes(1, 1); + if error.is_err() { + log::error!( + " Delegation: Could not convert reserves to hold from delegation: {:?}, error: {:?}", + key, + error + ); } - log::error!( - " Delegation: Could not convert reserves to hold from delegation: {:?}, error: {:?}", - key, - error - ); - - ::DbWeight::get().reads_writes(0, 0) + // Currency::reserve and Currency::hold each read and write to the DB once. + // Since we are uncertain about which operation may fail, in the event of an + // error, we assume the worst-case scenario here. + ::DbWeight::get().reads_writes(2, 2) }) .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) } diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index 3b1c356f73..c749367c45 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -27,6 +27,9 @@ use sp_std::marker::PhantomData; use crate::{AccountIdOf, Config, CurrencyOf, Did, HoldReason, Pallet}; +const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(4); +const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(5); + pub struct BalanceMigration(PhantomData); impl OnRuntimeUpgrade for BalanceMigration @@ -37,17 +40,19 @@ where log::info!("Did: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&StorageVersion::new(4)) { - StorageVersion::new(5).put::>(); - return do_migration::(); + if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + TARGET_STORAGE_VERSION.put::>(); + ::DbWeight::get() + .reads_writes(1, 1) + .saturating_add(do_migration::()) + } else { + log::info!( + "Did: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", + onchain_storage_version, + CURRENT_STORAGE_VERSION + ); + ::DbWeight::get().reads_writes(1, 0) } - - log::info!( - "Did: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", - onchain_storage_version, - StorageVersion::new(4) - ); - ::DbWeight::get().reads_writes(0, 0) } #[cfg(feature = "try-runtime")] @@ -66,7 +71,7 @@ where ensure!(has_all_user_no_holds, "Pre Upgrade Did: there are users with holds!"); - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(4)); + assert_eq!(Pallet::::on_chain_storage_version(), CURRENT_STORAGE_VERSION); log::info!("Did: Pre migration checks successful"); @@ -92,7 +97,7 @@ where Ok(()) })?; - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(5)); + assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); log::info!("Did: Post migration checks successful"); Ok(()) @@ -106,19 +111,24 @@ where Did::::iter() .map(|(key, did_details)| -> Weight { let deposit = did_details.deposit; - let error = switch_reserved_to_hold::, CurrencyOf>( + let result = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, &HoldReason::Deposit.into(), deposit.amount.saturated_into(), ); - if error.is_ok() { - return ::DbWeight::get().reads_writes(1, 1); + if result.is_err() { + log::error!( + " Did: Could not convert reserves to hold from did: {:?} error: {:?}", + key, + result + ); } - log::error!(" Did: Could not convert reserves to hold from did: {:?} ", key); - - ::DbWeight::get().reads_writes(0, 0) + // Currency::reserve and Currency::hold each read and write to the DB once. + // Since we are uncertain about which operation may fail, in the event of an + // error, we assume the worst-case scenario here. + ::DbWeight::get().reads_writes(2, 2) }) .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) } diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index e765c58513..eb3c65dd23 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -117,6 +117,9 @@ impl OnRuntimeUpgrade for CleanupMigration { } } +const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(4); +const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(5); + pub struct BalanceMigration(PhantomData); impl OnRuntimeUpgrade for BalanceMigration @@ -127,17 +130,19 @@ where log::info!("Did lookup: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&StorageVersion::new(4)) { - StorageVersion::new(5).put::>(); - return do_migration::(); + if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + TARGET_STORAGE_VERSION.put::>(); + return ::DbWeight::get() + .reads_writes(1, 1) + .saturating_add(do_migration::()); } log::info!( "Did lookup: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", onchain_storage_version, - StorageVersion::new(3) + CURRENT_STORAGE_VERSION ); - ::DbWeight::get().reads_writes(0, 0) + ::DbWeight::get().reads_writes(1, 0) } #[cfg(feature = "try-runtime")] @@ -158,7 +163,7 @@ where "Pre Upgrade Did lookup: there are users with holds!" ); - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(4)); + assert_eq!(Pallet::::on_chain_storage_version(), CURRENT_STORAGE_VERSION); log::info!("Did: Pre migration checks successful"); @@ -184,7 +189,7 @@ where Ok(()) })?; - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(5)); + assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); log::info!("Did lookup: Post migration checks successful"); Ok(()) @@ -198,22 +203,24 @@ where ConnectedDids::::iter() .map(|(key, did_details)| -> Weight { let deposit = did_details.deposit; - let error = switch_reserved_to_hold::, CurrencyOf>( + let result = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, &HoldReason::Deposit.into(), deposit.amount.saturated_into(), ); - if error.is_ok() { - return ::DbWeight::get().reads_writes(1, 1); + if result.is_err() { + log::error!( + "Did lookup: Could not convert reserves to hold from connected did: {:?} error: {:?}", + key, + result + ); } - log::error!( - "Did lookup: Could not convert reserves to hold from connected did: {:?} ", - key, - ); - - ::DbWeight::get().reads_writes(0, 0) + // Currency::reserve and Currency::hold each read and write to the DB once. + // Since we are uncertain about which operation may fail, in the event of an + // error, we assume the worst-case scenario here. + ::DbWeight::get().reads_writes(2, 2) }) .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) } diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index a0d501a4dd..c5eb2a43d0 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -26,6 +26,9 @@ use sp_std::marker::PhantomData; use crate::{AccountIdOf, Config, CurrencyOf, HoldReason, Owner, Pallet}; +const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(1); +const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(2); + pub struct BalanceMigration(PhantomData); impl OnRuntimeUpgrade for BalanceMigration @@ -36,16 +39,19 @@ where log::info!("W3n: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&StorageVersion::new(1)) { - StorageVersion::new(2).put::>(); - return do_migration::(); - } - log::info!( + if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + TARGET_STORAGE_VERSION.put::>(); + ::DbWeight::get() + .reads_writes(1, 1) + .saturating_add(do_migration::()) + } else { + log::info!( "W3N: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", onchain_storage_version, - StorageVersion::new(1) + CURRENT_STORAGE_VERSION ); - ::DbWeight::get().reads_writes(0, 0) + ::DbWeight::get().reads_writes(1, 0) + } } #[cfg(feature = "try-runtime")] @@ -63,7 +69,7 @@ where assert!(has_all_user_no_holds, "Pre Upgrade W3n: there are users with holds!"); - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(1)); + assert_eq!(Pallet::::on_chain_storage_version(), CURRENT_STORAGE_VERSION); log::info!("W3n: Pre migration checks successful"); @@ -88,7 +94,7 @@ where Ok(()) })?; - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(2)); + assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); log::info!("W3n: Post migration checks successful"); Ok(()) @@ -102,19 +108,24 @@ where Owner::::iter() .map(|(key, w3n_details)| -> Weight { let deposit = w3n_details.deposit; - let error = switch_reserved_to_hold::, CurrencyOf>( + let result = switch_reserved_to_hold::, CurrencyOf>( deposit.owner, &HoldReason::Deposit.into(), deposit.amount.saturated_into(), ); - if error.is_ok() { - return ::DbWeight::get().reads_writes(1, 1); + if result.is_err() { + log::error!( + " W3n: Could not convert reserves to hold from w3n: {:?} error: {:?}", + key, + result + ); } - log::error!(" W3n: Could not convert reserves to hold from w3n: {:?} ", key); - - ::DbWeight::get().reads_writes(0, 0) + // Currency::reserve and Currency::hold each read and write to the DB once. + // Since we are uncertain about which operation may fail, in the event of an + // error, we assume the worst-case scenario here. + ::DbWeight::get().reads_writes(2, 2) }) .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) } diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index 4f85f2efa8..51864e4622 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -34,6 +34,9 @@ use crate::{ const STAKING_ID: LockIdentifier = *b"kiltpstk"; +const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(8); +const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(9); + pub struct BalanceMigration(PhantomData); impl OnRuntimeUpgrade for BalanceMigration @@ -45,15 +48,15 @@ where log::info!("Staking: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&StorageVersion::new(8)) { - StorageVersion::new(9).put::>(); + if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + TARGET_STORAGE_VERSION.put::>(); return do_migration::(); } log::info!( "Staking: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", onchain_storage_version, - StorageVersion::new(8) + CURRENT_STORAGE_VERSION ); ::DbWeight::get().reads_writes(0, 0) } @@ -66,7 +69,7 @@ where let count_freezes = pallet_balances::Freezes::::iter().count(); assert!(count_freezes.is_zero(), "Staking Pre: There are already freezes."); - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(8)); + assert_eq!(Pallet::::on_chain_storage_version(), CURRENT_STORAGE_VERSION); log::info!("Staking: Pre migration checks successful"); @@ -81,7 +84,7 @@ where assert!(!count_freezes.is_zero(), "Staking: There are still no freezes."); - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(9)); + assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); log::info!("Staking: Post migration checks successful"); diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index 784e0200ec..24fbb54eb7 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -26,6 +26,9 @@ use sp_std::marker::PhantomData; use crate::{AccountIdOf, Config, Credentials, CurrencyOf, HoldReason, Pallet}; +const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(1); +const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(2); + pub struct BalanceMigration(PhantomData); impl OnRuntimeUpgrade for BalanceMigration @@ -37,17 +40,20 @@ where let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&StorageVersion::new(1)) { - StorageVersion::new(2).put::>(); - return do_migration::(); + if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + TARGET_STORAGE_VERSION.put::>(); + + ::DbWeight::get() + .reads_writes(0, 0) + .saturating_add(do_migration::()) + } else { + log::info!( + "Public Credential: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", + onchain_storage_version, + CURRENT_STORAGE_VERSION + ); + ::DbWeight::get().reads_writes(0, 0) } - - log::info!( - "Public Credential: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", - onchain_storage_version, - StorageVersion::new(1) - ); - ::DbWeight::get().reads_writes(0, 0) } #[cfg(feature = "try-runtime")] @@ -68,7 +74,7 @@ where "Pre Upgrade Public Credentials: there are users with holds!" ); - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(1)); + assert_eq!(Pallet::::on_chain_storage_version(), CURRENT_STORAGE_VERSION); log::info!("Public Credentials: Pre migration checks successful"); @@ -92,7 +98,7 @@ where Ok(()) })?; - assert_eq!(Pallet::::on_chain_storage_version(), StorageVersion::new(2)); + assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); log::info!("Public Credentials: Post migration checks successful"); Ok(()) @@ -112,18 +118,19 @@ where deposit.amount.saturated_into(), ); - if error.is_ok() { - return ::DbWeight::get().reads_writes(1, 1); + if error.is_err() { + log::error!( + " Public Credential: Could not convert reserves to hold from credential: {:?} {:?}, error: {:?}", + key, + key2, + error + ); } - log::error!( - " Public Credential: Could not convert reserves to hold from credential: {:?} {:?}, error: {:?}", - key, - key2, - error - ); - - ::DbWeight::get().reads_writes(0, 0) + // Currency::reserve and Currency::hold each read and write to the DB once. + // Since we are uncertain about which operation may fail, in the event of an + // error, we assume the worst-case scenario here. + ::DbWeight::get().reads_writes(2, 2) }) .fold(Weight::zero(), |acc, next| acc.saturating_add(next)) } From 692ec43e0d908aa10146cc730a3f208ad82df921 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 16:11:28 +0200 Subject: [PATCH 81/99] remove crate from migration --- pallets/attestation/src/migrations.rs | 2 +- pallets/delegation/src/migrations.rs | 2 +- pallets/did/src/migrations.rs | 2 +- pallets/pallet-did-lookup/src/migrations.rs | 2 +- pallets/pallet-web3-names/src/migrations.rs | 2 +- pallets/public-credentials/src/migrations.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 344918fba7..fa75f70b73 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -32,7 +32,7 @@ const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(2); pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration +impl OnRuntimeUpgrade for BalanceMigration where ::Currency: ReservableCurrency, { diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index f59492b028..ca91ae727b 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -32,7 +32,7 @@ const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(4); pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration +impl OnRuntimeUpgrade for BalanceMigration where ::Currency: ReservableCurrency, { diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index c749367c45..f16257b324 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -32,7 +32,7 @@ const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(5); pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration +impl OnRuntimeUpgrade for BalanceMigration where ::Currency: ReservableCurrency, { diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index eb3c65dd23..ac047cefbf 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -122,7 +122,7 @@ const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(5); pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration +impl OnRuntimeUpgrade for BalanceMigration where ::Currency: ReservableCurrency, { diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index c5eb2a43d0..4353dd4d3a 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -31,7 +31,7 @@ const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(2); pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration +impl OnRuntimeUpgrade for BalanceMigration where ::Currency: ReservableCurrency, { diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index 24fbb54eb7..f260d2fa06 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -31,7 +31,7 @@ const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(2); pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration +impl OnRuntimeUpgrade for BalanceMigration where ::Currency: ReservableCurrency, { From 782c37d343dcc5ebdf2275fda34fd50f1e6ddcb7 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 26 Jun 2023 16:11:50 +0200 Subject: [PATCH 82/99] updated weights for staking --- pallets/parachain-staking/src/migrations.rs | 28 +++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index 51864e4622..017fa04293 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -39,7 +39,7 @@ const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(9); pub struct BalanceMigration(PhantomData); -impl OnRuntimeUpgrade for BalanceMigration +impl OnRuntimeUpgrade for BalanceMigration where ::Currency: ReservableCurrency, ::Currency: LockableCurrency, @@ -50,15 +50,17 @@ where let onchain_storage_version = Pallet::::on_chain_storage_version(); if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { TARGET_STORAGE_VERSION.put::>(); - return do_migration::(); + ::DbWeight::get() + .reads_writes(1, 1) + .saturating_add(do_migration::()) + } else { + log::info!( + "Staking: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", + onchain_storage_version, + CURRENT_STORAGE_VERSION + ); + ::DbWeight::get().reads_writes(1, 0) } - - log::info!( - "Staking: No migration needed. This file should be deleted. Current storage version: {:?}, Required Version for update: {:?}", - onchain_storage_version, - CURRENT_STORAGE_VERSION - ); - ::DbWeight::get().reads_writes(0, 0) } #[cfg(feature = "try-runtime")] @@ -147,7 +149,11 @@ where as LockableCurrency>>::remove_lock(STAKING_ID, &user_id); if result.is_err() { - return ::DbWeight::get().reads_writes(0, 0); + return ::DbWeight::get().reads_writes(1, 0); } - ::DbWeight::get().reads_writes(1, 1) + + // Currency::reserve and Currency::hold each read and write to the DB once. + // Since we are uncertain about which operation may fail, in the event of an + // error, we assume the worst-case scenario here. + ::DbWeight::get().reads_writes(2, 2) } From 38982fafb3b85d7f238e93028c70bc1ad5284b75 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 3 Jul 2023 09:20:32 +0200 Subject: [PATCH 83/99] refactor: change order in attestation --- pallets/attestation/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 59993b78f3..e74d0050d1 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -480,8 +480,8 @@ pub mod pallet { impl Pallet { fn remove_attestation(attestation: AttestationDetails, claim_hash: ClaimHashOf) -> DispatchResult { - Attestations::::remove(claim_hash); AttestationStorageDepositCollector::::free_deposit(attestation.deposit)?; + Attestations::::remove(claim_hash); if let Some(authorization_id) = &attestation.authorization_id { ExternalAttestations::::remove(authorization_id, claim_hash); } From 7c49528c03123422867e46d0e2333f450ee72bae Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 3 Jul 2023 09:20:52 +0200 Subject: [PATCH 84/99] debug_assert for remaining balance --- support/src/migration.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/support/src/migration.rs b/support/src/migration.rs index cc565d66e7..d186e0498f 100644 --- a/support/src/migration.rs +++ b/support/src/migration.rs @@ -36,6 +36,12 @@ pub fn switch_reserved_to_hold DispatchResult { let remaining_balance = Currency::unreserve(&owner, amount.saturated_into()); + debug_assert!( + remaining_balance.is_zero(), + "Could not unreserve balance. Remaining: {:?}. To unreserve: {:?}", + remaining_balance, + amount + ); let to_hold_balance = amount.saturating_sub(remaining_balance.saturated_into()); Currency::hold(reason, &owner, to_hold_balance.saturated_into()) } From ce5debe0817904bf699b3bd3b17cf6b060c6ece0 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 3 Jul 2023 10:51:49 +0200 Subject: [PATCH 85/99] updated post updates --- pallets/attestation/src/migrations.rs | 44 +++++++++++------ pallets/delegation/src/migrations.rs | 42 +++++++++++----- pallets/did/src/migrations.rs | 44 +++++++++++------ pallets/pallet-did-lookup/src/migrations.rs | 50 ++++++++++++-------- pallets/pallet-web3-names/src/migrations.rs | 43 +++++++++++------ pallets/parachain-staking/src/migrations.rs | 5 ++ pallets/public-credentials/src/migrations.rs | 44 +++++++++++------ 7 files changed, 181 insertions(+), 91 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index fa75f70b73..e574a088e9 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -86,21 +86,35 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { use frame_support::traits::fungible::InspectHold; - - Attestations::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = - ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) - .saturated_into(); - assert!( - details.deposit.amount.saturated_into::() <= hold_balance, - "Attestation: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", - key, - details.deposit.amount, - hold_balance - ); - - Ok(()) - })?; + use sp_runtime::Saturating; + use sp_std::collections::btree_map::BTreeMap; + + use crate::BalanceOf; + + let mut map_user_deposit: BTreeMap, BalanceOf> = BTreeMap::new(); + + Attestations::::iter_values().for_each(|details| { + map_user_deposit + .entry(details.deposit.owner) + .and_modify(|balance| *balance = balance.saturating_add(details.deposit.amount)) + .or_insert(details.deposit.amount); + }); + + map_user_deposit + .iter() + .try_for_each(|(who, amount)| -> Result<(), &'static str> { + let hold_balance: BalanceOf = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), who).saturated_into(); + + assert!( + amount.eq(&hold_balance), + "Attestation: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", + who, + amount, + hold_balance + ); + Ok(()) + })?; assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index ca91ae727b..31d257750f 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -83,19 +83,35 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { use frame_support::traits::fungible::InspectHold; - - DelegationNodes::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = - ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) - .saturated_into(); - assert!( - details.deposit.amount.saturated_into::() <= hold_balance, - "Delegation: Hold balance is not matching for delegation node {:?}. Expected hold: {:?}. Real hold: {:?}", - key, details.deposit.amount, hold_balance - ); - - Ok(()) - })?; + use sp_runtime::Saturating; + use sp_std::collections::btree_map::BTreeMap; + + use crate::BalanceOf; + + let mut map_user_deposit: BTreeMap, BalanceOf> = BTreeMap::new(); + + DelegationNodes::::iter_values().for_each(|details| { + map_user_deposit + .entry(details.deposit.owner) + .and_modify(|balance| *balance = balance.saturating_add(details.deposit.amount)) + .or_insert(details.deposit.amount); + }); + + map_user_deposit + .iter() + .try_for_each(|(who, amount)| -> Result<(), &'static str> { + let hold_balance: BalanceOf = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), who).saturated_into(); + + assert!( + amount.eq(&hold_balance), + "Delegation: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", + who, + amount, + hold_balance + ); + Ok(()) + })?; assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index f16257b324..ab1ae8959f 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -81,21 +81,35 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { use frame_support::traits::fungible::InspectHold; - - Did::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = - ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) - .saturated_into(); - assert!( - details.deposit.amount.saturated_into::() <= hold_balance, - "Did: Hold balance is not matching for Did {:?}. Expected hold: {:?}. Real hold: {:?}", - key, - details.deposit.amount, - hold_balance - ); - - Ok(()) - })?; + use sp_runtime::Saturating; + use sp_std::collections::btree_map::BTreeMap; + + use crate::BalanceOf; + + let mut map_user_deposit: BTreeMap, BalanceOf> = BTreeMap::new(); + + Did::::iter_values().for_each(|details| { + map_user_deposit + .entry(details.deposit.owner) + .and_modify(|balance| *balance = balance.saturating_add(details.deposit.amount)) + .or_insert(details.deposit.amount); + }); + + map_user_deposit + .iter() + .try_for_each(|(who, amount)| -> Result<(), &'static str> { + let hold_balance: BalanceOf = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), who).saturated_into(); + + assert!( + amount.eq(&hold_balance), + "Did: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", + who, + amount, + hold_balance + ); + Ok(()) + })?; assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index ac047cefbf..5f4ebede85 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -158,14 +158,11 @@ where }) .all(|user| user); - assert!( - has_all_user_no_holds, - "Pre Upgrade Did lookup: there are users with holds!" - ); + assert!(has_all_user_no_holds, "Did lookup: there are users with holds!"); assert_eq!(Pallet::::on_chain_storage_version(), CURRENT_STORAGE_VERSION); - log::info!("Did: Pre migration checks successful"); + log::info!("Did lookup: Pre migration checks successful"); Ok(vec![]) } @@ -173,21 +170,34 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { use frame_support::traits::fungible::InspectHold; - - ConnectedDids::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = - ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) - .saturated_into(); - assert!( - details.deposit.amount.saturated_into::() <= hold_balance, - "Did lookup: Hold balance is not matching for connected did {:?}. Expected hold: {:?}. Real hold: {:?}", - key, - details.deposit.amount, - hold_balance - ); - - Ok(()) - })?; + use sp_std::collections::btree_map::BTreeMap; + + use crate::BalanceOf; + + let mut map_user_deposit: BTreeMap, BalanceOf> = BTreeMap::new(); + + ConnectedDids::::iter_values().for_each(|details| { + map_user_deposit + .entry(details.deposit.owner) + .and_modify(|balance| *balance = balance.saturating_add(details.deposit.amount)) + .or_insert(details.deposit.amount); + }); + + map_user_deposit + .iter() + .try_for_each(|(who, amount)| -> Result<(), &'static str> { + let hold_balance: BalanceOf = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), who).saturated_into(); + + assert!( + amount.eq(&hold_balance), + "Did lookup: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", + who, + amount, + hold_balance + ); + Ok(()) + })?; assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index 4353dd4d3a..63c9703234 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -79,21 +79,36 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { use frame_support::traits::fungible::InspectHold; + use sp_runtime::Saturating; + use sp_std::collections::btree_map::BTreeMap; + + use crate::BalanceOf; + + let mut map_user_deposit: BTreeMap, BalanceOf> = BTreeMap::new(); + + Owner::::iter_values().for_each(|details| { + map_user_deposit + .entry(details.deposit.owner) + .and_modify(|balance| *balance = balance.saturating_add(details.deposit.amount)) + .or_insert(details.deposit.amount); + }); + + map_user_deposit + .iter() + .try_for_each(|(who, amount)| -> Result<(), &'static str> { + let hold_balance: BalanceOf = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), who).saturated_into(); + + assert!( + amount.eq(&hold_balance), + "W3n: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", + who, + amount, + hold_balance + ); + Ok(()) + })?; - Owner::::iter().try_for_each(|(key, details)| -> Result<(), &'static str> { - let hold_balance: u128 = - ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) - .saturated_into(); - assert!( - details.deposit.amount.saturated_into::() <= hold_balance, - "W3n: Hold balance is not matching for w3n {:?}. Expected hold: {:?}. Real hold: {:?}", - key, - details.deposit.amount, - hold_balance - ); - - Ok(()) - })?; assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); log::info!("W3n: Post migration checks successful"); diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index 017fa04293..731a3e3750 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -86,6 +86,11 @@ where assert!(!count_freezes.is_zero(), "Staking: There are still no freezes."); + pallet_balances::Freezes::::iter().try_for_each(|(key, details)| { + key.into(); + Ok(()) + })?; + assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); log::info!("Staking: Post migration checks successful"); diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index f260d2fa06..fba406090c 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -84,19 +84,35 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), &'static str> { use frame_support::traits::fungible::InspectHold; - - Credentials::::iter().try_for_each(|(key, key2, details)| -> Result<(), &'static str> { - let hold_balance: u128 = - ::Currency::balance_on_hold(&HoldReason::Deposit.into(), &details.deposit.owner) - .saturated_into(); - assert!( - details.deposit.amount.saturated_into::() <= hold_balance, - "Public Credentails: Hold balance is not matching for credential {:?} {:?}. Expected hold: {:?}. Real hold: {:?}", - key, key2, details.deposit.amount, hold_balance - ); - - Ok(()) - })?; + use sp_runtime::Saturating; + use sp_std::collections::btree_map::BTreeMap; + + use crate::BalanceOf; + + let mut map_user_deposit: BTreeMap, BalanceOf> = BTreeMap::new(); + + Credentials::::iter_values().for_each(|details| { + map_user_deposit + .entry(details.deposit.owner) + .and_modify(|balance| *balance = balance.saturating_add(details.deposit.amount)) + .or_insert(details.deposit.amount); + }); + + map_user_deposit + .iter() + .try_for_each(|(who, amount)| -> Result<(), &'static str> { + let hold_balance: BalanceOf = + ::Currency::balance_on_hold(&HoldReason::Deposit.into(), who).saturated_into(); + + assert!( + amount.eq(&hold_balance), + "Public Credentials: Hold balance is not matching for attestation {:?}. Expected hold: {:?}. Real hold: {:?}", + who, + amount, + hold_balance + ); + Ok(()) + })?; assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); @@ -120,7 +136,7 @@ where if error.is_err() { log::error!( - " Public Credential: Could not convert reserves to hold from credential: {:?} {:?}, error: {:?}", + "Public Credential: Could not convert reserves to hold from credential: {:?} {:?}, error: {:?}", key, key2, error From 68aa397dd20c60435c6128e2a18497c62c08e1c1 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 3 Jul 2023 11:10:26 +0200 Subject: [PATCH 86/99] improved free_deposit --- support/src/deposit.rs | 12 ++++++------ support/src/traits.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/support/src/deposit.rs b/support/src/deposit.rs index 0694c9cabb..f2296cd05d 100644 --- a/support/src/deposit.rs +++ b/support/src/deposit.rs @@ -16,9 +16,9 @@ // If you feel like getting in touch with us, you can do so at info@botlabs.org -use frame_support::{ - pallet_prelude::DispatchResult, - traits::{fungible::hold::Mutate, tokens::Precision}, +use frame_support::traits::{ + fungible::{hold::Mutate, Inspect}, + tokens::Precision, }; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; @@ -47,14 +47,14 @@ pub(crate) fn reserve_deposit>( pub(crate) fn free_deposit>( deposit: &Deposit, reason: &Currency::Reason, -) -> DispatchResult { +) -> Result<>::Balance, DispatchError> { let result = Currency::release(reason, &deposit.owner, deposit.amount, Precision::BestEffort); debug_assert!( result == Ok(deposit.amount), "Released deposit amount does not match with expected amount. Expected: {:?}, Released amount: {:?} Error: {:?}", deposit.amount, - result.unwrap(), + result.ok(), result.err(), ); - Ok(()) + result } diff --git a/support/src/traits.rs b/support/src/traits.rs index f2bdb41f66..de11c7ca92 100644 --- a/support/src/traits.rs +++ b/support/src/traits.rs @@ -119,7 +119,7 @@ pub trait StorageDepositCollector { /// Release the deposit. fn free_deposit( deposit: Deposit>::Balance>, - ) -> Result<(), DispatchError> { + ) -> Result<>::Balance, DispatchError> { free_deposit::(&deposit, &Self::reason().into()) } From 4f1d80cf1f04ea03a53f94d5ff65f3e1a379a93c Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 3 Jul 2023 11:13:38 +0200 Subject: [PATCH 87/99] remove artefact --- pallets/parachain-staking/src/migrations.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index 731a3e3750..017fa04293 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -86,11 +86,6 @@ where assert!(!count_freezes.is_zero(), "Staking: There are still no freezes."); - pallet_balances::Freezes::::iter().try_for_each(|(key, details)| { - key.into(); - Ok(()) - })?; - assert_eq!(Pallet::::on_chain_storage_version(), TARGET_STORAGE_VERSION); log::info!("Staking: Post migration checks successful"); From 6520dc218be8f672795c82fc6048feb9b6c8456f Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 10 Jul 2023 15:10:49 +0200 Subject: [PATCH 88/99] typos --- pallets/parachain-staking/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index ef22bdf246..af485338b4 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -240,7 +240,7 @@ pub mod pallet { type DefaultBlocksPerRound: Get; /// Number of blocks for which unstaked balance will still be locked /// before it can be unlocked by actively calling the extrinsic - /// `unlock_unstacked`. + /// `unlock_unstaked`. #[pallet::constant] type StakeDuration: Get; /// Number of rounds a collator has to stay active after submitting a @@ -914,7 +914,7 @@ pub mod pallet { /// delegators. /// /// Prepares unstaking of the candidates and their delegators stake - /// which can be unfreezed via `unlock_unstacked` after waiting at + /// which can be unfreezed via `unlock_unstaked` after waiting at /// least `StakeDuration` many blocks. Also increments rewards for the /// collator and their delegators. /// @@ -1104,7 +1104,7 @@ pub mod pallet { /// Execute the network exit of a candidate who requested to leave at /// least `ExitQueueDelay` rounds ago. Prepares unstaking of the /// candidates and their delegators stake which can be unfreezed via - /// `unlock_unstacked` after waiting at least `StakeDuration` many + /// `unlock_unstaked` after waiting at least `StakeDuration` many /// blocks. /// /// Requires the candidate to previously have called @@ -1637,7 +1637,7 @@ pub mod pallet { /// bounded by `MaxUnstakeRequests`. /// - Reads: [Origin Account], Unstaking, Freezes /// - Writes: Unstaking, Freezes - /// - Kills: Unstaking & Freezess if no balance is locked anymore + /// - Kills: Unstaking & Freezes if no balance is locked anymore /// # #[pallet::call_index(16)] #[pallet::weight(::WeightInfo::unlock_unstaked( @@ -2219,7 +2219,7 @@ pub mod pallet { } /// Set the unlocking block for the account and corresponding amount - /// which can be unfreezed via `unlock_unstacked` after waiting at + /// which can be unfreezed via `unlock_unstaked` after waiting at /// least for `StakeDuration` many blocks. /// /// Throws if the amount is zero (unlikely) or if active unlocking From 45a2be7b50bdc4191ee91b805d2344961d33a202 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 10 Jul 2023 15:11:11 +0200 Subject: [PATCH 89/99] no unwrap --- pallets/did/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index 0268f07175..a3a6e7776e 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -608,8 +608,7 @@ pub mod pallet { Precision::BestEffort, Preservation::Protect, Fortitude::Polite, - ) - .unwrap(); + )?; T::FeeCollector::on_unbalanced(imbalance); Self::deposit_event(Event::DidCreated(sender, did_identifier)); From e0edef03aafd6a3c6792e923cd2164f2a68138cc Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 10 Jul 2023 15:12:55 +0200 Subject: [PATCH 90/99] freeze reason --- pallets/parachain-staking/src/lib.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index af485338b4..3a3a8626c8 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -2209,11 +2209,7 @@ pub mod pallet { // Either set a new lock or potentially extend the existing one if amount // exceeds the currently locked amount - T::Currency::extend_freeze( - &::FreezeIdentifier::from(FreezeReason::Staking), - who, - amount, - )?; + T::Currency::extend_freeze(&FreezeReason::Staking.into(), who, amount)?; Ok(unstaking_len) } From 7201f7fcda45b004276f8d3201a9115ae8f56465 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 10 Jul 2023 15:14:19 +0200 Subject: [PATCH 91/99] less ensure --- pallets/parachain-staking/src/lib.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 3a3a8626c8..54e44ac2cf 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -2172,11 +2172,6 @@ pub mod pallet { pallet_balances::Error::::InsufficientBalance ); - ensure!( - >>::total_balance(who) >= amount, - pallet_balances::Error::::InsufficientBalance - ); - let mut unstaking_len = 0u32; // update Unstaking by consuming up to {amount | more} From bbbd93e28d4812a93061fbc196dcccaa263e03f1 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 10 Jul 2023 15:18:32 +0200 Subject: [PATCH 92/99] update cargo toml --- Cargo.lock | 1 - pallets/pallet-configuration/Cargo.toml | 4 ---- 2 files changed, 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 95babb91a7..7bfa4a48d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6013,7 +6013,6 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "kilt-support", "pallet-balances", "parity-scale-codec", "scale-info", diff --git a/pallets/pallet-configuration/Cargo.toml b/pallets/pallet-configuration/Cargo.toml index d83e842bb2..f8d5998048 100644 --- a/pallets/pallet-configuration/Cargo.toml +++ b/pallets/pallet-configuration/Cargo.toml @@ -21,10 +21,6 @@ sp-keystore = {workspace = true, features = ["std"]} pallet-balances = {workspace = true} [dependencies] - -# Internal dependencies -kilt-support.workspace = true - # Substrate dependencies parity-scale-codec = {workspace = true, features = ["derive"]} scale-info = {workspace = true, features = ["derive"]} From f4a14794afa3e5afcaa527d2837f84102d49cbde Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 10 Jul 2023 15:40:14 +0200 Subject: [PATCH 93/99] update migration --- pallets/attestation/src/lib.rs | 2 +- pallets/attestation/src/migrations.rs | 5 +++-- pallets/delegation/src/lib.rs | 2 +- pallets/delegation/src/migrations.rs | 5 +++-- pallets/did/src/lib.rs | 2 +- pallets/did/src/migrations.rs | 3 +-- pallets/pallet-did-lookup/src/lib.rs | 2 +- pallets/pallet-did-lookup/src/migrations.rs | 6 ++++-- pallets/pallet-web3-names/src/lib.rs | 2 +- pallets/pallet-web3-names/src/migrations.rs | 3 +-- pallets/parachain-staking/src/lib.rs | 2 +- pallets/parachain-staking/src/migrations.rs | 3 +-- pallets/public-credentials/src/lib.rs | 2 +- pallets/public-credentials/src/migrations.rs | 5 +++-- 14 files changed, 23 insertions(+), 21 deletions(-) diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 7ca3379802..527430b6bf 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -103,7 +103,7 @@ pub mod pallet { }; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); + pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); /// Type of a claim hash. pub type ClaimHashOf = ::Hash; diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 9c63f45302..0363928fce 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -25,10 +25,11 @@ use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Attestations, Config, CurrencyOf, HoldReason, Pallet}; +use crate::{ + AccountIdOf, Attestations, Config, CurrencyOf, HoldReason, Pallet, STORAGE_VERSION as TARGET_STORAGE_VERSION, +}; const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(1); -const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(2); pub struct BalanceMigration(PhantomData); diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index 7a5dcc1e25..0ee581e4b7 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -107,7 +107,7 @@ pub mod pallet { use scale_info::TypeInfo; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(4); + pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(4); /// Type of a delegation node identifier. pub type DelegationNodeIdOf = ::DelegationNodeId; diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index 14e6dd565e..5c4f54f7e1 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -25,10 +25,11 @@ use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Config, CurrencyOf, DelegationNodes, HoldReason, Pallet}; +use crate::{ + AccountIdOf, Config, CurrencyOf, DelegationNodes, HoldReason, Pallet, STORAGE_VERSION as TARGET_STORAGE_VERSION, +}; const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(3); -const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(4); pub struct BalanceMigration(PhantomData); diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index a3a6e7776e..f3b734ccaa 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -163,7 +163,7 @@ pub mod pallet { }; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(5); + pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(5); /// Reference to a payload of data of variable size. pub type Payload = [u8]; diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index ab1ae8959f..eb9143f8eb 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -25,10 +25,9 @@ use log; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Config, CurrencyOf, Did, HoldReason, Pallet}; +use crate::{AccountIdOf, Config, CurrencyOf, Did, HoldReason, Pallet, STORAGE_VERSION as TARGET_STORAGE_VERSION}; const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(4); -const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(5); pub struct BalanceMigration(PhantomData); diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index 6e504e97db..65456e7090 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -86,7 +86,7 @@ pub mod pallet { /// The connection record type. pub(crate) type ConnectionRecordOf = ConnectionRecord, AccountIdOf, BalanceOf>; - pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(5); + pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(5); #[pallet::composite_enum] pub enum HoldReason { diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index 5f4ebede85..102524431f 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -28,7 +28,10 @@ use scale_info::TypeInfo; use sp_runtime::{AccountId32, SaturatedConversion}; use sp_std::marker::PhantomData; -use crate::{linkable_account::LinkableAccountId, AccountIdOf, Config, ConnectedDids, CurrencyOf, HoldReason, Pallet}; +use crate::{ + linkable_account::LinkableAccountId, AccountIdOf, Config, ConnectedDids, CurrencyOf, HoldReason, Pallet, + STORAGE_VERSION as TARGET_STORAGE_VERSION, +}; /// A unified log target for did-lookup-migration operations. pub const LOG_TARGET: &str = "runtime::pallet-did-lookup::migrations"; @@ -118,7 +121,6 @@ impl OnRuntimeUpgrade for CleanupMigration { } const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(4); -const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(5); pub struct BalanceMigration(PhantomData); diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index 7709d583b2..ea5238d5f5 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -64,7 +64,7 @@ pub mod pallet { use super::WeightInfo; use crate::web3_name::Web3NameOwnership; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); + pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); pub type AccountIdOf = ::AccountId; pub type BlockNumberFor = ::BlockNumber; diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index 63c9703234..c122848d22 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -24,10 +24,9 @@ use kilt_support::migration::switch_reserved_to_hold; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Config, CurrencyOf, HoldReason, Owner, Pallet}; +use crate::{AccountIdOf, Config, CurrencyOf, HoldReason, Owner, Pallet, STORAGE_VERSION as TARGET_STORAGE_VERSION}; const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(1); -const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(2); pub struct BalanceMigration(PhantomData); diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 54e44ac2cf..f5a5cb54a3 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -179,7 +179,7 @@ pub mod pallet { use sp_std::{convert::TryInto, fmt::Debug}; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(9); + pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(9); /// Pallet for parachain staking. #[pallet::pallet] diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index 017fa04293..a721c23a81 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -29,13 +29,12 @@ use sp_std::marker::PhantomData; use crate::{ types::{AccountIdOf, CurrencyOf}, - Config, FreezeReason, Pallet, + Config, FreezeReason, Pallet, STORAGE_VERSION as TARGET_STORAGE_VERSION, }; const STAKING_ID: LockIdentifier = *b"kiltpstk"; const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(8); -const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(9); pub struct BalanceMigration(PhantomData); diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index 9fb2a53329..41b632df59 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -74,7 +74,7 @@ pub mod pallet { }; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); // No easy way to check whether the two currencies are the same and check for // `can_withdraw` conditions. Maybe with #[transactional] we could stop caring diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index fba406090c..0d41139d6a 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -24,10 +24,11 @@ use kilt_support::migration::switch_reserved_to_hold; use sp_runtime::SaturatedConversion; use sp_std::marker::PhantomData; -use crate::{AccountIdOf, Config, Credentials, CurrencyOf, HoldReason, Pallet}; +use crate::{ + AccountIdOf, Config, Credentials, CurrencyOf, HoldReason, Pallet, STORAGE_VERSION as TARGET_STORAGE_VERSION, +}; const CURRENT_STORAGE_VERSION: StorageVersion = StorageVersion::new(1); -const TARGET_STORAGE_VERSION: StorageVersion = StorageVersion::new(2); pub struct BalanceMigration(PhantomData); From be9f2e502192f8798808944e1349df588c842b56 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 10 Jul 2023 15:51:56 +0200 Subject: [PATCH 94/99] update weights function --- pallets/attestation/src/migrations.rs | 2 +- pallets/delegation/src/migrations.rs | 2 +- pallets/did/src/migrations.rs | 2 +- pallets/pallet-did-lookup/src/migrations.rs | 4 ++-- pallets/pallet-web3-names/src/migrations.rs | 2 +- pallets/parachain-staking/src/migrations.rs | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index 0363928fce..b38c8c1ef7 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -55,7 +55,7 @@ where CURRENT_STORAGE_VERSION ); - ::DbWeight::get().reads_writes(1, 0) + ::DbWeight::get().reads(1) } } diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index 5c4f54f7e1..6815687e75 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -53,7 +53,7 @@ where CURRENT_STORAGE_VERSION ); - ::DbWeight::get().reads_writes(1, 0) + ::DbWeight::get().reads(1) } } diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index eb9143f8eb..c3b4490358 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -50,7 +50,7 @@ where onchain_storage_version, CURRENT_STORAGE_VERSION ); - ::DbWeight::get().reads_writes(1, 0) + ::DbWeight::get().reads(1) } } diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index 102524431f..058289b841 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -85,7 +85,7 @@ impl OnRuntimeUpgrade for CleanupMigration { target: LOG_TARGET, "Migration did not execute. This probably should be removed" ); - ::DbWeight::get().reads_writes(1, 0) + ::DbWeight::get().reads(1) } } @@ -144,7 +144,7 @@ where CURRENT_STORAGE_VERSION ); - ::DbWeight::get().reads_writes(1, 0) + ::DbWeight::get().reads(1) } #[cfg(feature = "try-runtime")] diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index c122848d22..46dd5b3ded 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -49,7 +49,7 @@ where onchain_storage_version, CURRENT_STORAGE_VERSION ); - ::DbWeight::get().reads_writes(1, 0) + ::DbWeight::get().reads(1) } } diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index a721c23a81..ab779f8520 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -58,7 +58,7 @@ where onchain_storage_version, CURRENT_STORAGE_VERSION ); - ::DbWeight::get().reads_writes(1, 0) + ::DbWeight::get().reads(1) } } @@ -148,7 +148,7 @@ where as LockableCurrency>>::remove_lock(STAKING_ID, &user_id); if result.is_err() { - return ::DbWeight::get().reads_writes(1, 0); + return ::DbWeight::get().reads(1); } // Currency::reserve and Currency::hold each read and write to the DB once. From f9b4fb7439008968045f2af4f0b582e915a31494 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Mon, 10 Jul 2023 16:17:31 +0200 Subject: [PATCH 95/99] revert: less ensure --- pallets/parachain-staking/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index f5a5cb54a3..1e92eaad1c 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -2172,6 +2172,11 @@ pub mod pallet { pallet_balances::Error::::InsufficientBalance ); + ensure!( + >>::total_balance(who) >= amount, + pallet_balances::Error::::InsufficientBalance + ); + let mut unstaking_len = 0u32; // update Unstaking by consuming up to {amount | more} From 1de9ed9e58ce19a7ceac65ca47fb4134d16ff390 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 11 Jul 2023 10:32:18 +0200 Subject: [PATCH 96/99] other precision and preservation --- pallets/did/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index f3b734ccaa..fd79a8fc08 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -599,16 +599,14 @@ pub mod pallet { Did::::insert(&did_identifier, did_entry.clone()); - // Withdraw the fee. We made sure that enough balance is available. But if this - // fails, we don't withdraw anything. Since we do the best effort we can unwrap - // the result. let imbalance: CreditOf = >>::withdraw( &did_entry.deposit.owner, T::Fee::get(), - Precision::BestEffort, - Preservation::Protect, + Precision::Exact, + Preservation::Preserve, Fortitude::Polite, )?; + T::FeeCollector::on_unbalanced(imbalance); Self::deposit_event(Event::DidCreated(sender, did_identifier)); From faf9f53336ac0e20ded5450c3ef2b1b696874cb4 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 11 Jul 2023 13:13:08 +0200 Subject: [PATCH 97/99] license --- .../spiritnet/src/weights/pallet_balances.rs | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/runtimes/spiritnet/src/weights/pallet_balances.rs b/runtimes/spiritnet/src/weights/pallet_balances.rs index 7888e0e1ad..11e98f3544 100644 --- a/runtimes/spiritnet/src/weights/pallet_balances.rs +++ b/runtimes/spiritnet/src/weights/pallet_balances.rs @@ -1,12 +1,28 @@ +// KILT Blockchain – https://botlabs.org +// Copyright (C) 2019-2023 BOTLabs GmbH -//! Autogenerated weights for `pallet_balances` +// The KILT Blockchain is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The KILT Blockchain is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@botlabs.org + +//! Autogenerated weights for pallet_collective //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-05-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `rust-2`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! DATE: 2023-03-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("spiritnet-dev"), DB CACHE: 1024 + // Executed Command: // ./target/release/kilt-parachain // benchmark From 873b4fb904657d159518d19a3c962c4b8fc421ae Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 11 Jul 2023 13:13:37 +0200 Subject: [PATCH 98/99] mod order --- pallets/delegation/src/lib.rs | 1 + pallets/did/src/lib.rs | 5 +++-- pallets/pallet-web3-names/src/lib.rs | 6 +++--- support/src/lib.rs | 6 ++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index 0ee581e4b7..f51045a6c1 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -67,6 +67,7 @@ mod access_control; pub mod default_weights; pub mod delegation_hierarchy; pub mod migrations; + #[cfg(any(feature = "mock", test))] pub mod mock; diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index fd79a8fc08..e6696cd824 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -86,12 +86,13 @@ pub mod default_weights; pub mod did_details; pub mod errors; pub mod migrations; +pub mod origin; +pub mod service_endpoints; + #[cfg(test)] mod mock; #[cfg(any(feature = "runtime-benchmarks", test))] mod mock_utils; -pub mod origin; -pub mod service_endpoints; #[cfg(test)] mod tests; diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index ea5238d5f5..e58aca6b41 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -21,14 +21,14 @@ #![cfg_attr(not(feature = "std"), no_std)] -pub mod web3_name; - mod default_weights; +pub mod migrations; +pub mod web3_name; + #[cfg(any(test, feature = "runtime-benchmarks"))] mod mock; -pub mod migrations; #[cfg(any(test, feature = "try-runtime"))] mod try_state; diff --git a/support/src/lib.rs b/support/src/lib.rs index 38b6c21d92..c5e9658211 100644 --- a/support/src/lib.rs +++ b/support/src/lib.rs @@ -18,12 +18,14 @@ #![cfg_attr(not(feature = "std"), no_std)] mod deposit; + pub use deposit::Deposit; pub mod migration; +pub mod signature; +pub mod traits; + #[cfg(any(feature = "runtime-benchmarks", feature = "mock"))] pub mod mock; -pub mod signature; #[cfg(any(feature = "try-runtime", test))] pub mod test_utils; -pub mod traits; From b2fe45ea8edbf6393f507ce1b4e332177c842fc0 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 11 Jul 2023 13:19:03 +0200 Subject: [PATCH 99/99] use == --- pallets/attestation/src/migrations.rs | 2 +- pallets/delegation/src/migrations.rs | 2 +- pallets/did/src/migrations.rs | 2 +- pallets/pallet-did-lookup/src/migrations.rs | 2 +- pallets/pallet-web3-names/src/migrations.rs | 2 +- pallets/parachain-staking/src/migrations.rs | 2 +- pallets/public-credentials/src/migrations.rs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pallets/attestation/src/migrations.rs b/pallets/attestation/src/migrations.rs index b38c8c1ef7..b613ab426a 100644 --- a/pallets/attestation/src/migrations.rs +++ b/pallets/attestation/src/migrations.rs @@ -42,7 +42,7 @@ where let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + if onchain_storage_version == CURRENT_STORAGE_VERSION { TARGET_STORAGE_VERSION.put::>(); ::DbWeight::get() diff --git a/pallets/delegation/src/migrations.rs b/pallets/delegation/src/migrations.rs index 6815687e75..d78e44f728 100644 --- a/pallets/delegation/src/migrations.rs +++ b/pallets/delegation/src/migrations.rs @@ -41,7 +41,7 @@ where log::info!("Delegation: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + if onchain_storage_version == CURRENT_STORAGE_VERSION { TARGET_STORAGE_VERSION.put::>(); ::DbWeight::get() .reads_writes(1, 1) diff --git a/pallets/did/src/migrations.rs b/pallets/did/src/migrations.rs index c3b4490358..096d563af8 100644 --- a/pallets/did/src/migrations.rs +++ b/pallets/did/src/migrations.rs @@ -39,7 +39,7 @@ where log::info!("Did: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + if onchain_storage_version == CURRENT_STORAGE_VERSION { TARGET_STORAGE_VERSION.put::>(); ::DbWeight::get() .reads_writes(1, 1) diff --git a/pallets/pallet-did-lookup/src/migrations.rs b/pallets/pallet-did-lookup/src/migrations.rs index 058289b841..87edd11bda 100644 --- a/pallets/pallet-did-lookup/src/migrations.rs +++ b/pallets/pallet-did-lookup/src/migrations.rs @@ -132,7 +132,7 @@ where log::info!("Did lookup: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + if onchain_storage_version == CURRENT_STORAGE_VERSION { TARGET_STORAGE_VERSION.put::>(); return ::DbWeight::get() .reads_writes(1, 1) diff --git a/pallets/pallet-web3-names/src/migrations.rs b/pallets/pallet-web3-names/src/migrations.rs index 46dd5b3ded..3580e87fe5 100644 --- a/pallets/pallet-web3-names/src/migrations.rs +++ b/pallets/pallet-web3-names/src/migrations.rs @@ -38,7 +38,7 @@ where log::info!("W3n: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + if onchain_storage_version == CURRENT_STORAGE_VERSION { TARGET_STORAGE_VERSION.put::>(); ::DbWeight::get() .reads_writes(1, 1) diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index ab779f8520..c3ffb81159 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -47,7 +47,7 @@ where log::info!("Staking: Initiating migration"); let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + if onchain_storage_version == CURRENT_STORAGE_VERSION { TARGET_STORAGE_VERSION.put::>(); ::DbWeight::get() .reads_writes(1, 1) diff --git a/pallets/public-credentials/src/migrations.rs b/pallets/public-credentials/src/migrations.rs index 0d41139d6a..d8ae7abb55 100644 --- a/pallets/public-credentials/src/migrations.rs +++ b/pallets/public-credentials/src/migrations.rs @@ -41,7 +41,7 @@ where let onchain_storage_version = Pallet::::on_chain_storage_version(); - if onchain_storage_version.eq(&CURRENT_STORAGE_VERSION) { + if onchain_storage_version == CURRENT_STORAGE_VERSION { TARGET_STORAGE_VERSION.put::>(); ::DbWeight::get()