From cdd262a844d8c0a0fb74ec2540015c0a602534b8 Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Mon, 21 Jun 2021 15:26:46 +0200 Subject: [PATCH 01/11] chore: v0.9.5 --- Cargo.lock | 1597 ++++++++++---------- Cargo.toml | 178 +-- node/Cargo.toml | 5 + node/src/chain_spec.rs | 87 +- node/src/command.rs | 2 +- node/src/rpc.rs | 46 + node/src/service.rs | 363 +++-- pallets/balances/Cargo.toml | 43 - pallets/balances/README.md | 122 -- pallets/balances/src/benchmarking.rs | 144 -- pallets/balances/src/lib.rs | 1759 ---------------------- pallets/balances/src/tests.rs | 978 ------------ pallets/balances/src/tests_composite.rs | 146 -- pallets/balances/src/tests_local.rs | 192 --- pallets/balances/src/tests_reentrancy.rs | 310 ---- pallets/balances/src/weights.rs | 111 -- runtime/Cargo.toml | 2 +- runtime/src/lib.rs | 31 +- rust-toolchain | 2 +- 19 files changed, 1278 insertions(+), 4840 deletions(-) delete mode 100644 pallets/balances/Cargo.toml delete mode 100644 pallets/balances/README.md delete mode 100644 pallets/balances/src/benchmarking.rs delete mode 100644 pallets/balances/src/lib.rs delete mode 100644 pallets/balances/src/tests.rs delete mode 100644 pallets/balances/src/tests_composite.rs delete mode 100644 pallets/balances/src/tests_local.rs delete mode 100644 pallets/balances/src/tests_reentrancy.rs delete mode 100644 pallets/balances/src/weights.rs diff --git a/Cargo.lock b/Cargo.lock index 7e6056d77..64960ec94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.14.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" +checksum = "e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a" dependencies = [ "gimli", ] @@ -89,24 +89,13 @@ checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" [[package]] name = "aho-corasick" -version = "0.7.15" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ "memchr", ] -[[package]] -name = "alga" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f823d037a7ec6ea2197046bafd4ae150e6bc36f9ca347404f46a46823fa84f2" -dependencies = [ - "approx 0.3.2", - "num-complex 0.2.4", - "num-traits", -] - [[package]] name = "ansi_term" version = "0.11.0" @@ -127,24 +116,24 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b" +checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61" [[package]] name = "approx" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" +checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278" dependencies = [ "num-traits", ] [[package]] name = "approx" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278" +checksum = "072df7202e63b127ab55acfe16ce97013d5b97bf160489336d3f1840fd78e99e" dependencies = [ "num-traits", ] @@ -172,9 +161,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a2f58b0bb10c380af2b26e57212856b8c9a59e0925b4c20f4a174a49734eaf7" +checksum = "be4dc07131ffa69b8072d35f5007352af944213cde02545e2103680baed38fcd" [[package]] name = "asn1_der" @@ -289,7 +278,7 @@ dependencies = [ "async-io", "async-lock", "async-process", - "crossbeam-utils 0.8.3", + "crossbeam-utils 0.8.5", "futures-channel", "futures-core", "futures-io", @@ -308,9 +297,9 @@ dependencies = [ [[package]] name = "async-std-resolver" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d613d619c2886fc0f4b5a777eceab405b23de82d73f0fc61ae402fdb9bc6fb2" +checksum = "ed4e2c3da14d8ad45acb1e3191db7a918e9505b6f155b218e70a7c9a1a48c638" dependencies = [ "async-std", "async-trait", @@ -397,15 +386,16 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.57" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ed203b9ba68b242c62b3fb7480f589dd49829be1edb3fe8fc8b4ffda2dcb8d" +checksum = "b7815ea54e4d821e791162e078acbebfd6d8c8939cd559c9335dceb1c8ca7282" dependencies = [ "addr2line", + "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object", + "object 0.25.3", "rustc-demangle", ] @@ -534,9 +524,9 @@ dependencies = [ [[package]] name = "blake3" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f" +checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" dependencies = [ "arrayref", "arrayvec 0.5.2", @@ -615,9 +605,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" dependencies = [ "memchr", ] @@ -633,9 +623,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.6.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" +checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" [[package]] name = "byte-slice-cast" @@ -701,7 +691,7 @@ dependencies = [ "semver 0.9.0", "serde", "toml", - "url 2.2.1", + "url 2.2.2", ] [[package]] @@ -728,9 +718,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.67" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" +checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" dependencies = [ "jobserver", ] @@ -895,10 +885,13 @@ dependencies = [ ] [[package]] -name = "cpuid-bool" -version = "0.1.2" +name = "cpufeatures" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" +checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8" +dependencies = [ + "libc", +] [[package]] name = "cpuid-bool" @@ -908,20 +901,19 @@ checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" [[package]] name = "cranelift-bforest" -version = "0.71.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcee7a5107071484772b89fdf37f0f460b7db75f476e43ea7a684fd942470bcf" +checksum = "c8ca3560686e7c9c7ed7e0fe77469f2410ba5d7781b1acaa9adc8d8deea28e3e" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.71.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "654ab96f0f1cab71c0d323618a58360a492da2c341eb2c1f977fc195c664001b" +checksum = "baf9bf1ffffb6ce3d2e5ebc83549bd2436426c99b31cc550d521364cbe35d276" dependencies = [ - "byteorder", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", @@ -932,14 +924,13 @@ dependencies = [ "serde", "smallvec 1.6.1", "target-lexicon", - "thiserror", ] [[package]] name = "cranelift-codegen-meta" -version = "0.71.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65994cfc5be9d5fd10c5fc30bcdddfa50c04bb79c91329287bff846434ff8f14" +checksum = "4cc21936a5a6d07e23849ffe83e5c1f6f50305c074f4b2970ca50c13bf55b821" dependencies = [ "cranelift-codegen-shared", "cranelift-entity", @@ -947,27 +938,27 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.71.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "889d720b688b8b7df5e4903f9b788c3c59396050f5548e516e58ccb7312463ab" +checksum = "ca5b6ffaa87560bebe69a5446449da18090b126037920b0c1c6d5945f72faf6b" dependencies = [ "serde", ] [[package]] name = "cranelift-entity" -version = "0.71.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a2e6884a363e42a9ba980193ea8603a4272f8a92bd8bbaf9f57a94dbea0ff96" +checksum = "7d6b4a8bef04f82e4296782646f733c641d09497df2fabf791323fefaa44c64c" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.71.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6f41e2f9b57d2c030e249d0958f1cdc2c3cd46accf8c0438b3d1944e9153444" +checksum = "c31b783b351f966fce33e3c03498cb116d16d97a8f9978164a60920bd0d3a99c" dependencies = [ "cranelift-codegen", "log", @@ -977,9 +968,9 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.71.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aab70ba7575665375d31cbdea2462916ce58be887834e1b83c860b43b51af637" +checksum = "a77c88d3dd48021ff1e37e978a00098524abd3513444ae252c08d37b310b3d2a" dependencies = [ "cranelift-codegen", "target-lexicon", @@ -987,14 +978,14 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.71.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fc3d2e70da6439adf97648dcdf81834363154f2907405345b6fbe7ca38918c" +checksum = "edb6d408e2da77cdbbd65466298d44c86ae71c1785d2ab0d8657753cdb4d9d89" dependencies = [ "cranelift-codegen", "cranelift-entity", "cranelift-frontend", - "itertools 0.10.0", + "itertools 0.10.1", "log", "serde", "smallvec 1.6.1", @@ -1018,7 +1009,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.3", + "crossbeam-utils 0.8.5", ] [[package]] @@ -1039,8 +1030,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ "cfg-if 1.0.0", - "crossbeam-epoch 0.9.3", - "crossbeam-utils 0.8.3", + "crossbeam-epoch 0.9.5", + "crossbeam-utils 0.8.5", ] [[package]] @@ -1060,14 +1051,14 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" +checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.3", + "crossbeam-utils 0.8.5", "lazy_static", - "memoffset 0.6.3", + "memoffset 0.6.4", "scopeguard", ] @@ -1095,11 +1086,10 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" dependencies = [ - "autocfg", "cfg-if 1.0.0", "lazy_static", ] @@ -1194,9 +1184,9 @@ checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" [[package]] name = "data-encoding-macro" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a94feec3d2ba66c0b6621bca8bc6f68415b1e5c69af3586fdd0af9fd9f29b17" +checksum = "86927b7cd2fe88fa698b87404b287ab98d1a0063a34071d92e575b72d3029aca" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -1204,30 +1194,19 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f83e699727abca3c56e187945f303389590305ab2f0185ea445aa66e8d5f2a" +checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" dependencies = [ "data-encoding", "syn", ] -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "derive_more" -version = "0.99.13" +version = "0.99.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b1b72f1263f214c0f823371768776c4f5841b942c9883aa8e5ec584fd0ba6" +checksum = "5cc7b9cef1e351660e5443924e4f43ab25fbbed3e9a5f052df3677deb4d6b320" dependencies = [ "convert_case", "proc-macro2", @@ -1304,6 +1283,12 @@ dependencies = [ "quick-error 1.2.3", ] +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + [[package]] name = "dyn-clonable" version = "0.9.0" @@ -1333,9 +1318,9 @@ checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf" [[package]] name = "ed25519" -version = "1.0.3" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c66a534cbb46ab4ea03477eae19d5c22c01da8258030280b7bd9d8433fb6ef" +checksum = "8d0860415b12243916284c67a9be413e044ee6668247b99ba26d94b2bc06c8f6" dependencies = [ "signature", ] @@ -1350,7 +1335,7 @@ dependencies = [ "ed25519", "rand 0.7.3", "serde", - "sha2 0.9.3", + "sha2 0.9.5", "zeroize", ] @@ -1407,15 +1392,15 @@ dependencies = [ [[package]] name = "environmental" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6576a1755ddffd988788025e75bce9e74b018f7cc226198fe931d077911c6d7e" +checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" [[package]] name = "erased-serde" -version = "0.3.13" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0465971a8cc1fa2455c8465aaa377131e1f1cf4983280f474a13e68793aa770c" +checksum = "3de9ad4541d99dc22b59134e7ff8dc3d6c988c89ecd7324bf10a8362b07a2afa" dependencies = [ "serde", ] @@ -1453,7 +1438,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", ] [[package]] @@ -1525,26 +1510,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cd795898c348a8ec9edc66ec9e014031c764d4c88cc26d09b492cd93eb41339" dependencies = [ "either", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "log", "num-traits", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", ] [[package]] name = "finality-grandpa" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6447e2f8178843749e8c8003206def83ec124a7859475395777a28b5338647c" +checksum = "74a1bfdcc776e63e49f741c7ce6116fa1b887e8ac2e3ccb14dd4aa113e54feb9" dependencies = [ "either", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "log", "num-traits", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", ] @@ -1564,7 +1549,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" dependencies = [ "byteorder", - "rand 0.8.3", + "rand 0.8.4", "rustc-hex", "static_assertions", ] @@ -1597,9 +1582,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", ] [[package]] @@ -1615,13 +1600,13 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "3.1.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", "linregress", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "paste", "sp-api", "sp-io", @@ -1634,13 +1619,13 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "Inflector", "chrono", "frame-benchmarking", "handlebars", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sc-cli", "sc-client-db", "sc-executor", @@ -1657,11 +1642,11 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-arithmetic", "sp-npos-elections", "sp-std", @@ -1670,11 +1655,11 @@ dependencies = [ [[package]] name = "frame-executive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-core", "sp-io", "sp-runtime", @@ -1685,9 +1670,9 @@ dependencies = [ [[package]] name = "frame-metadata" version = "13.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-core", "sp-std", @@ -1696,15 +1681,16 @@ dependencies = [ [[package]] name = "frame-support" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "bitflags", "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", "log", + "max-encoded-len", "once_cell", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "paste", "serde", "smallvec 1.6.1", @@ -1722,7 +1708,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -1734,7 +1720,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.0.0", @@ -1746,7 +1732,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "proc-macro2", "quote", @@ -1756,12 +1742,12 @@ dependencies = [ [[package]] name = "frame-system" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "impl-trait-for-tuples", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-core", "sp-io", @@ -1773,12 +1759,12 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-core", "sp-runtime", "sp-std", @@ -1787,9 +1773,9 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-api", ] @@ -1851,9 +1837,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d5813545e459ad3ca1bff9915e9ad7f1a47dc6a91b627ce321d5863b7dd253" +checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" dependencies = [ "futures-channel", "futures-core", @@ -1866,9 +1852,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce79c6a52a299137a6013061e0cf0e688fce5d7f1bc60125f520912fdb29ec25" +checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" dependencies = [ "futures-core", "futures-sink", @@ -1876,9 +1862,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "098cd1c6dda6ca01650f1a37a794245eb73181d0d4d4e955e2f3c37db7af1815" +checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" [[package]] name = "futures-cpupool" @@ -1890,27 +1876,11 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "futures-diagnose" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdcef58a173af8148b182684c9f2d5250875adbcaff7b5794073894f9d8634a9" -dependencies = [ - "futures 0.1.31", - "futures 0.3.14", - "lazy_static", - "log", - "parking_lot 0.9.0", - "pin-project 0.4.28", - "serde", - "serde_json", -] - [[package]] name = "futures-executor" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f6cb7042eda00f0049b1d2080aa4b93442997ee507eb3828e8bd7577f94c9d" +checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79" dependencies = [ "futures-core", "futures-task", @@ -1920,15 +1890,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "365a1a1fb30ea1c03a830fdb2158f5236833ac81fa0ad12fe35b29cddc35cb04" +checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" [[package]] name = "futures-lite" -version = "1.11.3" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4481d0cd0de1d204a4fa55e7d45f07b1d958abcb06714b3446438e2eff695fb" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" dependencies = [ "fastrand", "futures-core", @@ -1941,10 +1911,11 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668c6733a182cd7deb4f1de7ba3bf2120823835b3bcfbeacf7d2c4a773c1bb8b" +checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" dependencies = [ + "autocfg", "proc-macro-hack", "proc-macro2", "quote", @@ -1964,15 +1935,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5629433c555de3d82861a7a4e3794a4c40040390907cfbfd7143a92a426c23" +checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" [[package]] name = "futures-task" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba7aa51095076f3ba6d9a1f702f74bd05ec65f555d70d2033d55ba8d69f581bc" +checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" [[package]] name = "futures-timer" @@ -1988,10 +1959,11 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c144ad54d60f23927f0a6b6d816e4271278b64f005ad65e4e35291d2de9c025" +checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" dependencies = [ + "autocfg", "futures 0.1.31", "futures-channel", "futures-core", @@ -2022,15 +1994,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "generic-array" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f797e67af32588215eaaab8327027ee8e71b9dd0b2b26996aedf20c030fce309" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.4" @@ -2054,9 +2017,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if 1.0.0", "libc", @@ -2075,9 +2038,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" +checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" dependencies = [ "fallible-iterator", "indexmap", @@ -2092,9 +2055,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "globset" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a" +checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" dependencies = [ "aho-corasick", "bstr", @@ -2176,14 +2139,14 @@ dependencies = [ [[package]] name = "handlebars" -version = "3.5.4" +version = "3.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "580b6f551b29a3a02436318aed09ba1c58eea177dc49e39beac627ad356730a5" +checksum = "4498fc115fa7d34de968184e473529abb40eeb6be8bc5f7faba3d08c316cb3e3" dependencies = [ "log", "pest", "pest_derive", - "quick-error 2.0.0", + "quick-error 2.0.1", "serde", "serde_json", ] @@ -2214,9 +2177,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" dependencies = [ "unicode-segmentation", ] @@ -2336,9 +2299,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1ce40d6fc9764887c2fdc7305c3dcc429ba11ff981c1509416afd5697e4437" +checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" [[package]] name = "httpdate" @@ -2361,7 +2324,7 @@ version = "5.1.0" dependencies = [ "frame-benchmarking", "frame-benchmarking-cli", - "futures 0.3.14", + "futures 0.3.15", "hex-literal", "hydra-dx-build-script-utils", "hydra-dx-runtime", @@ -2373,13 +2336,16 @@ dependencies = [ "primitives", "sc-authority-discovery", "sc-basic-authorship", + "sc-chain-spec", "sc-cli", "sc-client-api", + "sc-client-db", "sc-consensus", "sc-consensus-babe", "sc-consensus-babe-rpc", "sc-consensus-epochs", "sc-consensus-slots", + "sc-consensus-uncles", "sc-executor", "sc-finality-grandpa", "sc-finality-grandpa-rpc", @@ -2393,6 +2359,7 @@ dependencies = [ "serde_json", "sp-api", "sp-authority-discovery", + "sp-authorship", "sp-block-builder", "sp-blockchain", "sp-consensus", @@ -2402,6 +2369,7 @@ dependencies = [ "sp-inherents", "sp-keystore", "sp-runtime", + "sp-timestamp", "sp-transaction-pool", "structopt", "substrate-frame-rpc-system", @@ -2442,7 +2410,7 @@ dependencies = [ "pallet-authority-discovery", "pallet-authorship", "pallet-babe", - "pallet-balances 3.0.1", + "pallet-balances", "pallet-claims", "pallet-collective", "pallet-democracy", @@ -2472,7 +2440,7 @@ dependencies = [ "pallet-utility", "pallet-xyk", "pallet-xyk-rpc-runtime-api", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "primitives", "serde", "sp-api", @@ -2615,7 +2583,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae8ab7f67bad3240049cb24fb9cb0b4c2c6af4c245840917fbbdededeee91179" dependencies = [ "async-io", - "futures 0.3.14", + "futures 0.3.15", "futures-lite", "if-addrs", "ipnet", @@ -2639,7 +2607,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df170efa359aebdd5cb7fe78edcc67107748e4737bdca8a8fb40d15ea7a877ed" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", ] [[package]] @@ -2697,7 +2665,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "futures-timer 2.0.2", ] @@ -2730,9 +2698,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" [[package]] name = "itertools" @@ -2745,9 +2713,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" +checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" dependencies = [ "either", ] @@ -2769,9 +2737,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.50" +version = "0.3.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d99f9e3e84b8f67f846ef5b4cbbc3b1c29f6c759fcbce6f01aa0e73d932a24c" +checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" dependencies = [ "wasm-bindgen", ] @@ -2946,9 +2914,9 @@ dependencies = [ [[package]] name = "kvdb-rocksdb" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34446c373ccc494c2124439281c198c7636ccdc2752c06722bbffd56d459c1e4" +checksum = "94b27cdb788bf1c8ade782289f9dbee626940be2961fd75c7cde993fa2f1ded1" dependencies = [ "fs-swap", "kvdb", @@ -2985,9 +2953,9 @@ checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" [[package]] name = "libc" -version = "0.2.94" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" +checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" [[package]] name = "libloading" @@ -3023,7 +2991,7 @@ checksum = "08053fbef67cd777049ef7a95ebaca2ece370b4ed7712c3fa404d69a88cb741b" dependencies = [ "atomic", "bytes 1.0.1", - "futures 0.3.14", + "futures 0.3.15", "lazy_static", "libp2p-core", "libp2p-deflate", @@ -3065,7 +3033,7 @@ dependencies = [ "ed25519-dalek", "either", "fnv", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "lazy_static", "libsecp256k1", @@ -3080,7 +3048,7 @@ dependencies = [ "rand 0.7.3", "ring", "rw-stream-sink", - "sha2 0.9.3", + "sha2 0.9.5", "smallvec 1.6.1", "thiserror", "unsigned-varint 0.7.0", @@ -3095,7 +3063,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2181a641cd15f9b6ba71b1335800f309012a0a97a29ffaabbbf40e9d3d58f08" dependencies = [ "flate2", - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", ] @@ -3106,7 +3074,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62e63dab8b5ff35e0c101a3e51e843ba782c07bbb1682f5fd827622e0d02b98b" dependencies = [ "async-std-resolver", - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "log", "smallvec 1.6.1", @@ -3121,7 +3089,7 @@ checksum = "48a9b570f6766301d9c4aa00fce3554cad1598e2f466debbc4dde909028417cf" dependencies = [ "cuckoofilter", "fnv", - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "libp2p-swarm", "log", @@ -3133,16 +3101,16 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.30.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73cb9a89a301afde1e588c73f7e9131e12a5388725f290a9047b878862db1b53" +checksum = "e7b0c8506a6ec3344b9e706d7c7a6dba826f8ede735cfe13dde12a8c263c4af9" dependencies = [ "asynchronous-codec 0.6.0", "base64 0.13.0", "byteorder", "bytes 1.0.1", "fnv", - "futures 0.3.14", + "futures 0.3.15", "hex_fmt", "libp2p-core", "libp2p-swarm", @@ -3151,7 +3119,7 @@ dependencies = [ "prost-build", "rand 0.7.3", "regex", - "sha2 0.9.3", + "sha2 0.9.5", "smallvec 1.6.1", "unsigned-varint 0.7.0", "wasm-timer", @@ -3163,7 +3131,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f668f00efd9883e8b7bcc582eaf0164615792608f886f6577da18bcbeea0a46" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "libp2p-swarm", "log", @@ -3184,14 +3152,14 @@ dependencies = [ "bytes 1.0.1", "either", "fnv", - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "libp2p-swarm", "log", "prost", "prost-build", "rand 0.7.3", - "sha2 0.9.3", + "sha2 0.9.5", "smallvec 1.6.1", "uint 0.9.0", "unsigned-varint 0.7.0", @@ -3201,20 +3169,20 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.30.1" +version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41e282f974c4bea56db8acca50387f05189406e346318cb30190b0bde662961e" +checksum = "4efa70c1c3d2d91237f8546e27aeb85e287d62c066a7b4f3ea6a696d43ced714" dependencies = [ "async-io", "data-encoding", "dns-parser", - "futures 0.3.14", + "futures 0.3.15", "if-watch", "lazy_static", "libp2p-core", "libp2p-swarm", "log", - "rand 0.8.3", + "rand 0.8.4", "smallvec 1.6.1", "socket2 0.4.0", "void", @@ -3228,7 +3196,7 @@ checksum = "85e9b544335d1ed30af71daa96edbefadef6f19c7a55f078b9fc92c87163105d" dependencies = [ "asynchronous-codec 0.6.0", "bytes 1.0.1", - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "log", "nohash-hasher", @@ -3246,14 +3214,14 @@ checksum = "36db0f0db3b0433f5b9463f1c0cd9eadc0a3734a9170439ce501ff99733a88bd" dependencies = [ "bytes 1.0.1", "curve25519-dalek 3.1.0", - "futures 0.3.14", + "futures 0.3.15", "lazy_static", "libp2p-core", "log", "prost", "prost-build", "rand 0.7.3", - "sha2 0.9.3", + "sha2 0.9.5", "snow", "static_assertions", "x25519-dalek", @@ -3266,7 +3234,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4bfaffac63bf3c7ec11ed9d8879d455966ddea7e78ee14737f0b6dce0d1cd1" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "libp2p-swarm", "log", @@ -3283,7 +3251,7 @@ checksum = "0c8c37b4d2a075b4be8442760a5f8c037180f0c8dd5b5734b9978ab868b3aa11" dependencies = [ "asynchronous-codec 0.6.0", "bytes 1.0.1", - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "log", "prost", @@ -3298,7 +3266,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce3374f3b28162db9d3442c9347c4f14cb01e8290052615c7d341d40eae0599" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "log", "pin-project 1.0.7", "rand 0.7.3", @@ -3314,7 +3282,7 @@ checksum = "0b8786aca3f18671d8776289706a5521f6c9124a820f69e358de214b9939440d" dependencies = [ "asynchronous-codec 0.6.0", "bytes 1.0.1", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "libp2p-core", "libp2p-swarm", @@ -3337,7 +3305,7 @@ checksum = "1cdbe172f08e6d0f95fa8634e273d4c4268c4063de2e33e7435194b0130c62e3" dependencies = [ "async-trait", "bytes 1.0.1", - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "libp2p-swarm", "log", @@ -3356,7 +3324,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e04d8e1eef675029ec728ba14e8d0da7975d84b6679b699b4ae91a1de9c3a92" dependencies = [ "either", - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "log", "rand 0.7.3", @@ -3382,7 +3350,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b1a27d21c477951799e99d5c105d78868258502ce092988040a808d5a19bbd9" dependencies = [ "async-io", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "if-watch", "ipnet", @@ -3399,18 +3367,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffd6564bb3b7ff203661ccbb69003c2b551e34cef974f2d6c6a28306a12170b5" dependencies = [ "async-std", - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "log", ] [[package]] name = "libp2p-wasm-ext" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cef45d61e43c313531b5e903e4e8415212ff6338e0c54c47da5b9b412b5760de" +checksum = "e2d413e4cf9b8e5dfbcd2a60d3dc5a3391308bdb463684093d4f67137b7113de" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "js-sys", "libp2p-core", "parity-send-wrapper", @@ -3425,14 +3393,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cace60995ef6f637e4752cccbb2590f6bc358e8741a0d066307636c69a4b3a74" dependencies = [ "either", - "futures 0.3.14", + "futures 0.3.15", "futures-rustls", "libp2p-core", "log", "quicksink", "rw-stream-sink", "soketto", - "url 2.2.1", + "url 2.2.2", "webpki-roots", ] @@ -3442,7 +3410,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f35da42cfc6d5cb0dcf3ad6881bc68d146cdf38f98655e09e33fbba4d13eabc4" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "libp2p-core", "parking_lot 0.11.1", "thiserror", @@ -3479,9 +3447,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655" +checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" dependencies = [ "cc", "pkg-config", @@ -3505,11 +3473,11 @@ dependencies = [ [[package]] name = "linregress" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b36162d2e1dcbdeb61223cb788f029f8ac9f2ab19969b89c5a8f4517aad4d940" +checksum = "b1ff7f341d23e1275eec0656a9a07225fcc86216c4322392868adffe59023d1a" dependencies = [ - "nalgebra 0.25.4", + "nalgebra 0.27.1", "statrs", ] @@ -3524,9 +3492,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176" +checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" dependencies = [ "scopeguard", ] @@ -3597,20 +3565,33 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "matrixmultiply" -version = "0.2.4" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "916806ba0031cd542105d916a97c8572e1fa6dd79c9c51e7eb43a09ec2dd84c1" +checksum = "5a8a15b776d9dfaecd44b03c5828c2199cddff5247215858aac14624f8d6b741" dependencies = [ "rawpointer", ] [[package]] -name = "matrixmultiply" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a8a15b776d9dfaecd44b03c5828c2199cddff5247215858aac14624f8d6b741" +name = "max-encoded-len" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "rawpointer", + "impl-trait-for-tuples", + "max-encoded-len-derive", + "parity-scale-codec 2.1.3", + "primitive-types 0.9.0", +] + +[[package]] +name = "max-encoded-len-derive" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" +dependencies = [ + "proc-macro-crate 1.0.0", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -3621,15 +3602,15 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" [[package]] name = "memmap2" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397d1a6d6d0563c0f5462bbdae662cf6c784edf5e828e40c7257f85d82bf56dd" +checksum = "723e3ebdcdc5c023db1df315364573789f8857c11b631a2fdfad7c00f5c046b4" dependencies = [ "libc", ] @@ -3645,9 +3626,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" +checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" dependencies = [ "autocfg", ] @@ -3815,18 +3796,18 @@ dependencies = [ "digest 0.9.0", "generic-array 0.14.4", "multihash-derive", - "sha2 0.9.3", + "sha2 0.9.5", "sha3", "unsigned-varint 0.5.1", ] [[package]] name = "multihash-derive" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85ee3c48cb9d9b275ad967a0e96715badc13c6029adb92f34fa17b9ff28fd81f" +checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" dependencies = [ - "proc-macro-crate 0.1.5", + "proc-macro-crate 1.0.0", "proc-macro-error", "proc-macro2", "quote", @@ -3847,7 +3828,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d91ec0a2440aaff5f78ec35631a7027d50386c6163aa975f7caa0d5da4b6ff8" dependencies = [ "bytes 1.0.1", - "futures 0.3.14", + "futures 0.3.15", "log", "pin-project 1.0.7", "smallvec 1.6.1", @@ -3856,39 +3837,48 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.19.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0abb021006c01b126a936a8dd1351e0720d83995f4fc942d0d426c654f990745" +checksum = "476d1d59fe02fe54c86356e91650cd892f392782a1cb9fc524ec84f7aa9e1d06" dependencies = [ - "alga", - "approx 0.3.2", - "generic-array 0.13.3", - "matrixmultiply 0.2.4", - "num-complex 0.2.4", - "num-rational 0.2.4", + "approx 0.4.0", + "matrixmultiply", + "num-complex 0.3.1", + "num-rational 0.3.2", "num-traits", - "rand 0.7.3", + "rand 0.8.4", "rand_distr", + "simba 0.4.0", "typenum", ] [[package]] name = "nalgebra" -version = "0.25.4" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c70c9e8c5f213c8e93fc8c112ade4edd3ee62062fb897776c23dcebac7932900" +checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" dependencies = [ - "approx 0.4.0", - "generic-array 0.14.4", - "matrixmultiply 0.3.1", - "num-complex 0.3.1", - "num-rational 0.3.2", + "approx 0.5.0", + "matrixmultiply", + "nalgebra-macros", + "num-complex 0.4.0", + "num-rational 0.4.0", "num-traits", - "serde", - "simba", + "simba 0.5.1", "typenum", ] +[[package]] +name = "nalgebra-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "names" version = "0.11.0" @@ -3944,19 +3934,18 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.2.4" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-complex" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" +checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085" dependencies = [ "num-traits", ] @@ -3994,6 +3983,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-rational" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.14" @@ -4016,19 +4016,28 @@ dependencies = [ [[package]] name = "object" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" +checksum = "1a5b3dd1c072ee7963717671d1ca129f1048fda25edea6b752bfc71ac8854170" dependencies = [ "crc32fast", "indexmap", ] +[[package]] +name = "object" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" dependencies = [ "parking_lot 0.11.1", ] @@ -4047,20 +4056,20 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl-probe" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "orml-currencies" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=master#b63b6667a0809165bda20ba57cbe85e1c0687b8c" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=ded28318c23e2d263beeb1235f040f51826fe11e#ded28318c23e2d263beeb1235f040f51826fe11e" dependencies = [ "frame-support", "frame-system", "orml-traits", "orml-utilities", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-io", "sp-runtime", @@ -4070,12 +4079,13 @@ dependencies = [ [[package]] name = "orml-tokens" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=master#b63b6667a0809165bda20ba57cbe85e1c0687b8c" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=ded28318c23e2d263beeb1235f040f51826fe11e#ded28318c23e2d263beeb1235f040f51826fe11e" dependencies = [ "frame-support", "frame-system", + "max-encoded-len", "orml-traits", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-runtime", "sp-std", @@ -4084,27 +4094,26 @@ dependencies = [ [[package]] name = "orml-traits" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=master#b63b6667a0809165bda20ba57cbe85e1c0687b8c" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=ded28318c23e2d263beeb1235f040f51826fe11e#ded28318c23e2d263beeb1235f040f51826fe11e" dependencies = [ "frame-support", "impl-trait-for-tuples", "num-traits", "orml-utilities", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-io", "sp-runtime", "sp-std", - "xcm", ] [[package]] name = "orml-utilities" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=master#b63b6667a0809165bda20ba57cbe85e1c0687b8c" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=ded28318c23e2d263beeb1235f040f51826fe11e#ded28318c23e2d263beeb1235f040f51826fe11e" dependencies = [ "frame-support", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-io", "sp-runtime", @@ -4126,7 +4135,7 @@ version = "3.1.0" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "primitive-types 0.8.0", "primitives", "serde", @@ -4140,12 +4149,12 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", "pallet-session", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-application-crypto", "sp-authority-discovery", "sp-runtime", @@ -4155,14 +4164,13 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-authorship", - "sp-inherents", "sp-runtime", "sp-std", ] @@ -4170,7 +4178,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-benchmarking", "frame-support", @@ -4179,7 +4187,7 @@ dependencies = [ "pallet-authorship", "pallet-session", "pallet-timestamp", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-application-crypto", "sp-consensus-babe", "sp-consensus-vrf", @@ -4193,30 +4201,14 @@ dependencies = [ [[package]] name = "pallet-balances" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec 2.1.1", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-balances" -version = "3.0.1" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", "log", - "pallet-transaction-payment", - "parity-scale-codec 2.1.1", - "serde", - "sp-core", - "sp-io", + "max-encoded-len", + "parity-scale-codec 2.1.3", "sp-runtime", "sp-std", ] @@ -4234,8 +4226,8 @@ dependencies = [ "orml-tokens", "orml-traits", "orml-utilities", - "pallet-balances 3.0.0", - "parity-scale-codec 2.1.1", + "pallet-balances", + "parity-scale-codec 2.1.3", "primitives", "rustc-hex", "serde", @@ -4248,13 +4240,13 @@ dependencies = [ [[package]] name = "pallet-collective" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-core", "sp-io", "sp-runtime", @@ -4264,12 +4256,12 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-io", "sp-runtime", @@ -4279,14 +4271,15 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-election-provider-support", "frame-support", "frame-system", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-arithmetic", + "sp-core", "sp-io", "sp-npos-elections", "sp-runtime", @@ -4297,12 +4290,12 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-core", "sp-io", "sp-npos-elections", @@ -4320,7 +4313,7 @@ dependencies = [ "orml-traits", "pallet-asset-registry", "pallet-xyk", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "primitive-types 0.8.0", "primitives", "serde", @@ -4344,7 +4337,7 @@ dependencies = [ "pallet-asset-registry", "pallet-exchange", "pallet-xyk", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "primitives", "serde", "sp-core", @@ -4362,7 +4355,7 @@ dependencies = [ "frame-system", "orml-tokens", "orml-traits", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "primitive-types 0.7.3", "primitives", "serde", @@ -4381,7 +4374,7 @@ dependencies = [ "frame-support", "frame-system", "hex-literal", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-core", "sp-io", @@ -4391,8 +4384,8 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +version = "3.1.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-benchmarking", "frame-support", @@ -4400,10 +4393,11 @@ dependencies = [ "log", "pallet-authorship", "pallet-session", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-application-crypto", "sp-core", "sp-finality-grandpa", + "sp-io", "sp-runtime", "sp-session", "sp-staking", @@ -4413,13 +4407,13 @@ dependencies = [ [[package]] name = "pallet-identity" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "enumflags2", "frame-benchmarking", "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-io", "sp-runtime", "sp-std", @@ -4428,13 +4422,13 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", "log", "pallet-authorship", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-application-crypto", "sp-core", "sp-io", @@ -4456,11 +4450,11 @@ dependencies = [ "orml-traits", "orml-utilities", "pallet-asset-registry", - "pallet-balances 3.0.0", + "pallet-balances", "pallet-transaction-multi-payment", "pallet-transaction-payment", "pallet-xyk", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "primitives", "serde", "sp-core", @@ -4473,13 +4467,13 @@ dependencies = [ [[package]] name = "pallet-offences" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", "log", - "pallet-balances 3.0.0", - "parity-scale-codec 2.1.1", + "pallet-balances", + "parity-scale-codec 2.1.3", "serde", "sp-runtime", "sp-staking", @@ -4489,11 +4483,11 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "safe-mix", "sp-runtime", "sp-std", @@ -4502,13 +4496,13 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-io", "sp-runtime", "sp-std", @@ -4517,13 +4511,14 @@ dependencies = [ [[package]] name = "pallet-session" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", + "log", "pallet-timestamp", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-core", "sp-io", "sp-runtime", @@ -4536,7 +4531,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-election-provider-support", "frame-support", @@ -4544,7 +4539,7 @@ dependencies = [ "log", "pallet-authorship", "pallet-session", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "paste", "serde", "sp-application-crypto", @@ -4558,7 +4553,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -4569,11 +4564,11 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-io", "sp-runtime", "sp-std", @@ -4582,14 +4577,14 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", "impl-trait-for-tuples", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-inherents", "sp-io", "sp-runtime", @@ -4600,12 +4595,12 @@ dependencies = [ [[package]] name = "pallet-tips" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", "pallet-treasury", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-runtime", "sp-std", @@ -4622,10 +4617,10 @@ dependencies = [ "orml-traits", "orml-utilities", "pallet-asset-registry", - "pallet-balances 3.0.0", + "pallet-balances", "pallet-transaction-payment", "pallet-xyk", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "primitive-types 0.8.0", "primitives", "serde", @@ -4640,11 +4635,11 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "smallvec 1.6.1", "sp-core", @@ -4656,13 +4651,13 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "pallet-transaction-payment-rpc-runtime-api", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-api", "sp-blockchain", "sp-core", @@ -4673,10 +4668,10 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "pallet-transaction-payment", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-api", "sp-runtime", ] @@ -4684,13 +4679,13 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", - "pallet-balances 3.0.0", - "parity-scale-codec 2.1.1", + "pallet-balances", + "parity-scale-codec 2.1.3", "serde", "sp-runtime", "sp-std", @@ -4699,11 +4694,11 @@ dependencies = [ [[package]] name = "pallet-utility" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-core", "sp-io", "sp-runtime", @@ -4723,7 +4718,7 @@ dependencies = [ "orml-traits", "orml-utilities", "pallet-asset-registry", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "primitive-types 0.8.0", "primitives", "serde", @@ -4742,7 +4737,7 @@ dependencies = [ "jsonrpc-core-client", "jsonrpc-derive", "pallet-xyk-rpc-runtime-api", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-api", "sp-blockchain", @@ -4755,7 +4750,7 @@ dependencies = [ name = "pallet-xyk-rpc-runtime-api" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-api", "sp-runtime", @@ -4765,9 +4760,9 @@ dependencies = [ [[package]] name = "parity-db" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "495197c078e54b8735181aa35c00a327f7f3a3cc00a1ee8c95926dd010f0ec6b" +checksum = "2e337f62db341435f0da05b8f6b97e984ef4ea5800510cd07c2d624688c40b47" dependencies = [ "blake2-rfc", "crc32fast", @@ -4777,7 +4772,7 @@ dependencies = [ "log", "memmap2", "parking_lot 0.11.1", - "rand 0.8.3", + "rand 0.8.4", ] [[package]] @@ -4795,7 +4790,7 @@ dependencies = [ "serde", "static_assertions", "unsigned-varint 0.7.0", - "url 2.2.1", + "url 2.2.2", ] [[package]] @@ -4812,11 +4807,11 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "2.1.1" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f518afaa5a47d0d6386229b0a6e01e86427291d643aa4cabb4992219f504f8" +checksum = "b310f220c335f9df1b3d2e9fbe3890bbfeef5030dad771620f48c5c229877cd3" dependencies = [ - "arrayvec 0.7.0", + "arrayvec 0.7.1", "bitvec 0.20.4", "byte-slice-cast 1.0.0", "parity-scale-codec-derive", @@ -4825,11 +4820,11 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "2.1.0" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f44c5f94427bd0b5076e8f7e15ca3f60a4d8ac0077e4793884e6fdfd8915344e" +checksum = "81038e13ca2c32587201d544ea2e6b6c47120f1e4eae04478f9f60b6bcb89145" dependencies = [ - "proc-macro-crate 0.1.5", + "proc-macro-crate 1.0.0", "proc-macro2", "quote", "syn", @@ -4898,9 +4893,9 @@ dependencies = [ [[package]] name = "parity-wasm" -version = "0.41.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" +checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" [[package]] name = "parity-ws" @@ -4917,7 +4912,7 @@ dependencies = [ "rand 0.7.3", "sha-1 0.8.2", "slab", - "url 2.2.1", + "url 2.2.2", ] [[package]] @@ -4954,7 +4949,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", - "lock_api 0.4.3", + "lock_api 0.4.4", "parking_lot_core 0.8.3", ] @@ -4996,7 +4991,7 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.2.6", + "redox_syscall 0.2.9", "smallvec 1.6.1", "winapi 0.3.9", ] @@ -5175,14 +5170,14 @@ checksum = "989d43012e2ca1c4a02507c67282691a0a3207f9dc67cec596b43fe925b3d325" [[package]] name = "polling" -version = "2.0.3" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc12d774e799ee9ebae13f4076ca003b40d18a11ac0f3641e6f899618580b7b" +checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25" dependencies = [ "cfg-if 1.0.0", "libc", "log", - "wepoll-sys", + "wepoll-ffi", "winapi 0.3.9", ] @@ -5192,7 +5187,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b7456bc1ad2d4cf82b3a016be4c2ac48daf11bf990c1603ebd447fe6f30fca8" dependencies = [ - "cpuid-bool 0.2.0", + "cpuid-bool", "universal-hash", ] @@ -5202,7 +5197,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" dependencies = [ - "cpuid-bool 0.2.0", + "cpuid-bool", "opaque-debug 0.3.0", "universal-hash", ] @@ -5252,7 +5247,7 @@ version = "4.2.0" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "primitive-types 0.8.0", "serde", "sp-core", @@ -5319,9 +5314,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" +checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" dependencies = [ "unicode-xid", ] @@ -5393,22 +5388,22 @@ dependencies = [ [[package]] name = "psm" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3abf49e5417290756acfd26501536358560c4a5cc4a0934d390939acb3e7083a" +checksum = "21ff0279b4a85e576b97e4a21d13e437ebcd56612706cde5d3f0d5c9399490c0" dependencies = [ "cc", ] [[package]] name = "pwasm-utils" -version = "0.14.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f53bc2558e8376358ebdc28301546471d67336584f6438ed4b7c7457a055fd7" +checksum = "f0c1a2f10b47d446372a4f397c58b329aaea72b2daf9395a623a411cb8ccb54f" dependencies = [ "byteorder", "log", - "parity-wasm 0.41.0", + "parity-wasm 0.42.2", ] [[package]] @@ -5419,9 +5414,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quick-error" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ac73b1112776fc109b2e61909bc46c7e1bf0d7f690ffb1676553acce16d5cda" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quicksink" @@ -5494,14 +5489,14 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ "libc", - "rand_chacha 0.3.0", - "rand_core 0.6.2", - "rand_hc 0.3.0", + "rand_chacha 0.3.1", + "rand_core 0.6.3", + "rand_hc 0.3.1", ] [[package]] @@ -5516,12 +5511,12 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.2", + "rand_core 0.6.3", ] [[package]] @@ -5550,20 +5545,21 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.2", + "getrandom 0.2.3", ] [[package]] name = "rand_distr" -version = "0.2.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2" +checksum = "051b398806e42b9cd04ad9ec8f81e355d0a382c543ac6672c62f5a5b452ef142" dependencies = [ - "rand 0.7.3", + "num-traits", + "rand 0.8.4", ] [[package]] @@ -5577,11 +5573,11 @@ dependencies = [ [[package]] name = "rand_hc" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ - "rand_core 0.6.2", + "rand_core 0.6.3", ] [[package]] @@ -5601,9 +5597,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" dependencies = [ "autocfg", "crossbeam-deque 0.8.0", @@ -5613,13 +5609,13 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" dependencies = [ "crossbeam-channel", "crossbeam-deque 0.8.0", - "crossbeam-utils 0.8.3", + "crossbeam-utils 0.8.5", "lazy_static", "num_cpus", ] @@ -5641,9 +5637,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.6" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8270314b5ccceb518e7e578952f0b72b88222d02e8f77f5ecf7abbb673539041" +checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" dependencies = [ "bitflags", ] @@ -5654,8 +5650,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ - "getrandom 0.2.2", - "redox_syscall 0.2.6", + "getrandom 0.2.3", + "redox_syscall 0.2.9", ] [[package]] @@ -5692,9 +5688,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.6" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ "aho-corasick", "memchr", @@ -5703,19 +5699,18 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "byteorder", "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.23" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "region" @@ -5750,9 +5745,9 @@ dependencies = [ [[package]] name = "retain_mut" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" +checksum = "e9c17925a9027d298a4603d286befe3f9dc0e8ed02523141914eb628798d6e5b" [[package]] name = "ring" @@ -5771,9 +5766,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d83c02c429044d58474eaf5ae31e062d0de894e21125b47437ec0edc1397e6" +checksum = "c749134fda8bfc90d0de643d59bfc841dcb3ac8a1062e12b6754bd60235c48b3" dependencies = [ "libc", "librocksdb-sys", @@ -5791,9 +5786,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" +checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" [[package]] name = "rustc-hash" @@ -5870,7 +5865,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "pin-project 0.4.28", "static_assertions", ] @@ -5911,17 +5906,17 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "async-trait", "derive_more", "either", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "ip_network", "libp2p", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "prost", "prost-build", "rand 0.7.3", @@ -5940,12 +5935,12 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sc-block-builder", "sc-client-api", "sc-proposer-metrics", @@ -5963,9 +5958,9 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sc-client-api", "sp-api", "sp-block-builder", @@ -5979,10 +5974,10 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "impl-trait-for-tuples", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sc-chain-spec-derive", "sc-consensus-babe", "sc-consensus-epochs", @@ -6000,7 +5995,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -6011,16 +6006,16 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "chrono", "fdlimit", - "futures 0.3.14", + "futures 0.3.15", "hex", "libp2p", "log", "names", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "rand 0.7.3", "regex", "rpassword", @@ -6049,16 +6044,16 @@ dependencies = [ [[package]] name = "sc-client-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "derive_more", "fnv", - "futures 0.3.14", + "futures 0.3.15", "hash-db", "kvdb", "lazy_static", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "sc-executor", "sp-api", @@ -6083,7 +6078,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "blake2-rfc", "hash-db", @@ -6093,7 +6088,7 @@ dependencies = [ "linked-hash-map", "log", "parity-db", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parity-util-mem", "parking_lot 0.11.1", "sc-client-api", @@ -6113,7 +6108,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "parking_lot 0.11.1", "sc-client-api", @@ -6125,19 +6120,19 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "async-trait", "derive_more", "fork-tree", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "log", "merlin", "num-bigint", "num-rational 0.2.4", "num-traits", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "pdqselect", "rand 0.7.3", @@ -6163,7 +6158,6 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-timestamp", "sp-utils", "sp-version", "substrate-prometheus-endpoint", @@ -6172,10 +6166,10 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "derive_more", - "futures 0.3.14", + "futures 0.3.15", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -6196,10 +6190,10 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "fork-tree", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sc-client-api", "sc-consensus", "sp-blockchain", @@ -6209,13 +6203,14 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "async-trait", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", + "impl-trait-for-tuples", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sc-client-api", "sc-telemetry", "sp-api", @@ -6236,28 +6231,25 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "log", "sc-client-api", "sp-authorship", - "sp-consensus", - "sp-core", - "sp-inherents", "sp-runtime", + "thiserror", ] [[package]] name = "sc-executor" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "derive_more", "lazy_static", "libsecp256k1", "log", - "parity-scale-codec 2.1.1", - "parity-wasm 0.41.0", + "parity-scale-codec 2.1.3", + "parity-wasm 0.42.2", "parking_lot 0.11.1", "sc-executor-common", "sc-executor-wasmi", @@ -6266,7 +6258,6 @@ dependencies = [ "sp-core", "sp-externalities", "sp-io", - "sp-maybe-compressed-blob", "sp-panic-handler", "sp-runtime-interface", "sp-serializer", @@ -6280,14 +6271,14 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "derive_more", - "parity-scale-codec 2.1.1", - "parity-wasm 0.41.0", + "parity-scale-codec 2.1.3", "pwasm-utils", "sp-allocator", "sp-core", + "sp-maybe-compressed-blob", "sp-serializer", "sp-wasm-interface", "thiserror", @@ -6297,10 +6288,10 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sc-executor-common", "sp-allocator", "sp-core", @@ -6312,12 +6303,11 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "log", - "parity-scale-codec 2.1.1", - "parity-wasm 0.41.0", - "pwasm-utils", + "parity-scale-codec 2.1.3", + "parity-wasm 0.42.2", "sc-executor-common", "scoped-tls", "sp-allocator", @@ -6330,18 +6320,18 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "async-trait", "derive_more", "dyn-clone", - "finality-grandpa 0.14.0", + "finality-grandpa 0.14.1", "fork-tree", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "linked-hash-map", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "pin-project 1.0.7", "rand 0.7.3", @@ -6365,6 +6355,7 @@ dependencies = [ "sp-runtime", "sp-utils", "substrate-prometheus-endpoint", + "wasm-timer", ] [[package]] @@ -6375,13 +6366,13 @@ checksum = "145cb4dfafa73269565857c43e204d71f6334c7f1260b783bb5942a6a4e77831" dependencies = [ "derive_more", "finality-grandpa 0.13.0", - "futures 0.3.14", + "futures 0.3.15", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "jsonrpc-pubsub", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sc-client-api", "sc-finality-grandpa", "sc-rpc", @@ -6395,10 +6386,11 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "ansi_term 0.12.1", - "futures 0.3.14", + "futures 0.3.15", + "futures-timer 3.0.2", "log", "parity-util-mem", "sc-client-api", @@ -6406,18 +6398,17 @@ dependencies = [ "sp-blockchain", "sp-runtime", "sp-transaction-pool", - "sp-utils", "wasm-timer", ] [[package]] name = "sc-keystore" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "async-trait", "derive_more", - "futures 0.3.14", + "futures 0.3.15", "futures-util", "hex", "merlin", @@ -6433,11 +6424,11 @@ dependencies = [ [[package]] name = "sc-light" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "hash-db", "lazy_static", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "sc-client-api", "sc-executor", @@ -6452,7 +6443,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "async-std", "async-trait", @@ -6466,7 +6457,7 @@ dependencies = [ "erased-serde", "fnv", "fork-tree", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "hex", "ip_network", @@ -6476,7 +6467,7 @@ dependencies = [ "log", "lru", "nohash-hasher", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "pin-project 1.0.7", "prost", @@ -6505,9 +6496,9 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "libp2p", "log", @@ -6522,18 +6513,18 @@ dependencies = [ [[package]] name = "sc-offchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "bytes 0.5.6", "fnv", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "hex", "hyper 0.13.10", "hyper-rustls", "log", "num_cpus", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "rand 0.7.3", "sc-client-api", @@ -6550,9 +6541,9 @@ dependencies = [ [[package]] name = "sc-peerset" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "libp2p", "log", "serde_json", @@ -6563,7 +6554,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6572,14 +6563,14 @@ dependencies = [ [[package]] name = "sc-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "sc-block-builder", "sc-client-api", @@ -6598,6 +6589,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-state-machine", + "sp-tracing", "sp-transaction-pool", "sp-utils", "sp-version", @@ -6606,16 +6598,16 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "derive_more", - "futures 0.3.14", + "futures 0.3.15", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "jsonrpc-pubsub", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "serde", "serde_json", @@ -6623,6 +6615,7 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", + "sp-tracing", "sp-transaction-pool", "sp-version", ] @@ -6630,7 +6623,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "futures 0.1.31", "jsonrpc-core", @@ -6648,20 +6641,20 @@ dependencies = [ [[package]] name = "sc-service" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "async-trait", "directories", "exit-future", "futures 0.1.31", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", "lazy_static", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parity-util-mem", "parking_lot 0.11.1", "pin-project 1.0.7", @@ -6698,6 +6691,7 @@ dependencies = [ "sp-state-machine", "sp-tracing", "sp-transaction-pool", + "sp-transaction-storage-proof", "sp-trie", "sp-utils", "sp-version", @@ -6712,10 +6706,10 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parity-util-mem", "parity-util-mem-derive", "parking_lot 0.11.1", @@ -6727,10 +6721,10 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "chrono", - "futures 0.3.14", + "futures 0.3.15", "libp2p", "log", "parking_lot 0.11.1", @@ -6747,7 +6741,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "ansi_term 0.12.1", "atty", @@ -6758,23 +6752,33 @@ dependencies = [ "parking_lot 0.11.1", "regex", "rustc-hash", + "sc-client-api", + "sc-rpc-server", + "sc-telemetry", "sc-tracing-proc-macro", "serde", "serde_json", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-core", + "sp-rpc", + "sp-runtime", + "sp-storage", "sp-tracing", "thiserror", "tracing", - "tracing-core", "tracing-log", "tracing-subscriber", "wasm-bindgen", + "wasm-timer", "web-sys", ] [[package]] name = "sc-tracing-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -6785,10 +6789,10 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "derive_more", - "futures 0.3.14", + "futures 0.3.15", "linked-hash-map", "log", "parity-util-mem", @@ -6807,13 +6811,12 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "futures 0.3.14", - "futures-diagnose", + "futures 0.3.15", "intervalier", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parity-util-mem", "parking_lot 0.11.1", "sc-client-api", @@ -6853,7 +6856,6 @@ dependencies = [ "merlin", "rand 0.7.3", "rand_core 0.5.1", - "serde", "sha2 0.8.2", "subtle 2.4.0", "zeroize", @@ -6979,18 +6981,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.125" +version = "1.0.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.125" +version = "1.0.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" dependencies = [ "proc-macro2", "quote", @@ -7022,13 +7024,13 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.4" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfebf75d25bd900fd1e7d11501efab59bc846dbc76196839663e6637bba9f25f" +checksum = "8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", - "cpuid-bool 0.1.2", + "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", ] @@ -7047,13 +7049,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" +checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", - "cpuid-bool 0.1.2", + "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", ] @@ -7087,9 +7089,9 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "signal-hook" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef33d6d0cd06e0840fba9985aab098c147e67e05cee14d412d3345ed14ff30ac" +checksum = "470c5a6397076fae0094aaf06a08e6ba6f37acb77d3b1b91ea92b4d6c8650c39" dependencies = [ "libc", "signal-hook-registry", @@ -7097,9 +7099,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ "libc", ] @@ -7122,12 +7124,33 @@ dependencies = [ "paste", ] +[[package]] +name = "simba" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" +dependencies = [ + "approx 0.5.0", + "num-complex 0.4.0", + "num-traits", + "paste", +] + [[package]] name = "slab" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" +[[package]] +name = "slog" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8347046d4ebd943127157b94d63abb990fcf729dc4e9978927fdf4ac3c998d06" +dependencies = [ + "erased-serde", +] + [[package]] name = "smallvec" version = "0.6.14" @@ -7156,7 +7179,7 @@ dependencies = [ "rand_core 0.5.1", "ring", "rustc_version", - "sha2 0.9.3", + "sha2 0.9.5", "subtle 2.4.0", "x25519-dalek", ] @@ -7191,17 +7214,17 @@ dependencies = [ "base64 0.12.3", "bytes 0.5.6", "flate2", - "futures 0.3.14", + "futures 0.3.15", "httparse", "log", "rand 0.7.3", - "sha-1 0.9.4", + "sha-1 0.9.6", ] [[package]] name = "sp-allocator" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "log", "sp-core", @@ -7213,11 +7236,11 @@ dependencies = [ [[package]] name = "sp-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "hash-db", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-api-proc-macro", "sp-core", "sp-runtime", @@ -7230,7 +7253,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "blake2-rfc", "proc-macro-crate 1.0.0", @@ -7242,9 +7265,10 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "max-encoded-len", + "parity-scale-codec 2.1.3", "serde", "sp-core", "sp-io", @@ -7254,11 +7278,11 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "integer-sqrt", "num-traits", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-debug-derive", "sp-std", @@ -7268,9 +7292,9 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-api", "sp-application-crypto", "sp-runtime", @@ -7280,9 +7304,10 @@ dependencies = [ [[package]] name = "sp-authorship" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "async-trait", + "parity-scale-codec 2.1.3", "sp-inherents", "sp-runtime", "sp-std", @@ -7291,9 +7316,9 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-api", "sp-inherents", "sp-runtime", @@ -7303,12 +7328,12 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "log", "lru", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "sp-api", "sp-consensus", @@ -7321,7 +7346,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "serde", "serde_json", @@ -7330,14 +7355,14 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "async-trait", - "futures 0.3.14", + "futures 0.3.15", "futures-timer 3.0.2", "libp2p", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "serde", "sp-api", @@ -7357,10 +7382,11 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ + "async-trait", "merlin", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-api", "sp-application-crypto", @@ -7378,9 +7404,9 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-arithmetic", "sp-runtime", ] @@ -7388,9 +7414,9 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "schnorrkel", "sp-core", "sp-runtime", @@ -7400,14 +7426,14 @@ dependencies = [ [[package]] name = "sp-core" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "base58", "blake2-rfc", "byteorder", "dyn-clonable", "ed25519-dalek", - "futures 0.3.14", + "futures 0.3.15", "hash-db", "hash256-std-hasher", "hex", @@ -7415,9 +7441,10 @@ dependencies = [ "lazy_static", "libsecp256k1", "log", + "max-encoded-len", "merlin", "num-traits", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parity-util-mem", "parking_lot 0.11.1", "primitive-types 0.9.0", @@ -7426,7 +7453,7 @@ dependencies = [ "schnorrkel", "secrecy", "serde", - "sha2 0.9.3", + "sha2 0.9.5", "sp-debug-derive", "sp-externalities", "sp-runtime-interface", @@ -7444,7 +7471,7 @@ dependencies = [ [[package]] name = "sp-database" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "kvdb", "parking_lot 0.11.1", @@ -7453,7 +7480,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "proc-macro2", "quote", @@ -7463,10 +7490,10 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "environmental", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-std", "sp-storage", ] @@ -7474,11 +7501,11 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "finality-grandpa 0.14.0", + "finality-grandpa 0.14.1", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-api", "sp-application-crypto", @@ -7491,11 +7518,13 @@ dependencies = [ [[package]] name = "sp-inherents" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", - "parking_lot 0.11.1", + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec 2.1.3", "sp-core", + "sp-runtime", "sp-std", "thiserror", ] @@ -7503,17 +7532,18 @@ dependencies = [ [[package]] name = "sp-io" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "hash-db", "libsecp256k1", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "sp-core", "sp-externalities", "sp-keystore", + "sp-maybe-compressed-blob", "sp-runtime-interface", "sp-state-machine", "sp-std", @@ -7527,7 +7557,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "lazy_static", "sp-core", @@ -7538,13 +7568,13 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "async-trait", "derive_more", - "futures 0.3.14", + "futures 0.3.15", "merlin", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "schnorrkel", "serde", @@ -7555,7 +7585,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "ruzstd", "zstd", @@ -7564,9 +7594,9 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-arithmetic", "sp-core", @@ -7577,7 +7607,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -7588,7 +7618,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "sp-api", "sp-core", @@ -7598,7 +7628,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "backtrace", ] @@ -7606,22 +7636,25 @@ dependencies = [ [[package]] name = "sp-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ + "rustc-hash", "serde", "sp-core", + "tracing-core", ] [[package]] name = "sp-runtime" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", - "parity-scale-codec 2.1.1", + "max-encoded-len", + "parity-scale-codec 2.1.3", "parity-util-mem", "paste", "rand 0.7.3", @@ -7636,10 +7669,10 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "impl-trait-for-tuples", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "primitive-types 0.9.0", "sp-externalities", "sp-runtime-interface-proc-macro", @@ -7653,7 +7686,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "Inflector", "proc-macro-crate 1.0.0", @@ -7665,7 +7698,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "serde", "serde_json", @@ -7674,9 +7707,9 @@ dependencies = [ [[package]] name = "sp-session" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-api", "sp-core", "sp-runtime", @@ -7687,9 +7720,9 @@ dependencies = [ [[package]] name = "sp-staking" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-runtime", "sp-std", ] @@ -7697,12 +7730,12 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "hash-db", "log", "num-traits", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "parking_lot 0.11.1", "rand 0.7.3", "smallvec 1.6.1", @@ -7712,6 +7745,7 @@ dependencies = [ "sp-std", "sp-trie", "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -7719,15 +7753,15 @@ dependencies = [ [[package]] name = "sp-std" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" [[package]] name = "sp-storage" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "impl-serde", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "ref-cast", "serde", "sp-debug-derive", @@ -7737,7 +7771,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "log", "sp-core", @@ -7750,23 +7784,32 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "parity-scale-codec 2.1.1", + "async-trait", + "futures-timer 3.0.2", + "log", + "parity-scale-codec 2.1.3", "sp-api", "sp-inherents", "sp-runtime", "sp-std", + "thiserror", "wasm-timer", ] [[package]] name = "sp-tracing" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ + "erased-serde", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", + "parking_lot 0.10.2", + "serde", + "serde_json", + "slog", "sp-std", "tracing", "tracing-core", @@ -7776,12 +7819,12 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "derive_more", - "futures 0.3.14", + "futures 0.3.15", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-api", "sp-blockchain", @@ -7789,14 +7832,29 @@ dependencies = [ "thiserror", ] +[[package]] +name = "sp-transaction-storage-proof" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" +dependencies = [ + "async-trait", + "log", + "parity-scale-codec 2.1.3", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-std", + "sp-trie", +] + [[package]] name = "sp-trie" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "hash-db", "memory-db", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-core", "sp-std", "trie-db", @@ -7806,9 +7864,9 @@ dependencies = [ [[package]] name = "sp-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "futures-core", "futures-timer 3.0.2", "lazy_static", @@ -7818,22 +7876,35 @@ dependencies = [ [[package]] name = "sp-version" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "impl-serde", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "serde", "sp-runtime", "sp-std", + "sp-version-proc-macro", +] + +[[package]] +name = "sp-version-proc-macro" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" +dependencies = [ + "parity-scale-codec 2.1.3", + "proc-macro-crate 1.0.0", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "sp-wasm-interface" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "impl-trait-for-tuples", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sp-std", "wasmi", ] @@ -7858,12 +7929,15 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "statrs" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e34b58a8f9b7462b6922e0b4e3c83d1b3c2075f7f996a56d6c66afa81590064" +checksum = "1e0c1f144861fbfd2a8cc82d564ccbf7fb3b7834d4fa128b84e9c2a73371aead" dependencies = [ - "nalgebra 0.19.0", - "rand 0.7.3", + "approx 0.4.0", + "lazy_static", + "nalgebra 0.26.2", + "num-traits", + "rand 0.8.4", ] [[package]] @@ -7952,15 +8026,15 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-system-rpc-runtime-api", - "futures 0.3.14", + "futures 0.3.15", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "log", - "parity-scale-codec 2.1.1", + "parity-scale-codec 2.1.3", "sc-client-api", "sc-rpc-api", "serde", @@ -7975,7 +8049,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#2be8fcc4236d32786c62f6f27a98e7fe7e550807" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "async-std", "derive_more", @@ -8016,9 +8090,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" -version = "1.0.70" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9505f307c872bab8eb46f77ae357c8eba1fdacead58ee5a850116b1d7f82883" +checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" dependencies = [ "proc-macro2", "quote", @@ -8051,9 +8125,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.11.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422045212ea98508ae3d28025bc5aaa2bd4a9cdaecd442a08da2ee620ee9ea95" +checksum = "64ae3b39281e4b14b8123bdbaddd472b7dfe215e444181f2f9d2443c2444f834" [[package]] name = "tempfile" @@ -8063,8 +8137,8 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand 0.8.3", - "redox_syscall 0.2.6", + "rand 0.8.4", + "redox_syscall 0.2.9", "remove_dir_all", "winapi 0.3.9", ] @@ -8089,18 +8163,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d" dependencies = [ "proc-macro2", "quote", @@ -8148,7 +8222,7 @@ dependencies = [ "pbkdf2 0.4.0", "rand 0.7.3", "rustc-hash", - "sha2 0.9.3", + "sha2 0.9.5", "thiserror", "unicode-normalization", "zeroize", @@ -8458,9 +8532,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" +checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if 1.0.0", "log", @@ -8482,9 +8556,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" dependencies = [ "lazy_static", ] @@ -8522,9 +8596,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705096c6f83bf68ea5d357a6aa01829ddbdac531b357b45abeca842938085baa" +checksum = "aa5553bf0883ba7c9cbe493b085c29926bd41b66afc31ff72cf17ff4fb60dcd5" dependencies = [ "ansi_term 0.12.1", "chrono", @@ -8544,9 +8618,9 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.22.3" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec051edf7f0fc9499a2cb0947652cab2148b9d7f61cee7605e312e9f970dacaf" +checksum = "cd81fe0c8bc2b528a51c9d2c31dae4483367a26a723a3c9a4a8120311d7774e3" dependencies = [ "hash-db", "hashbrown", @@ -8566,9 +8640,9 @@ dependencies = [ [[package]] name = "trust-dns-proto" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "952a078337565ba39007de99b151770f41039253a31846f0a3d5cd5a4ac8eedf" +checksum = "ad0d7f5db438199a6e2609debe3f69f808d074e0a2888ee0bccb45fe234d03f4" dependencies = [ "async-trait", "cfg-if 1.0.0", @@ -8581,18 +8655,18 @@ dependencies = [ "ipnet", "lazy_static", "log", - "rand 0.8.3", + "rand 0.8.4", "smallvec 1.6.1", "thiserror", "tinyvec", - "url 2.2.1", + "url 2.2.2", ] [[package]] name = "trust-dns-resolver" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9c97f7d103e0f94dbe384a57908833505ae5870126492f166821b7cf685589" +checksum = "f6ad17b608a64bd0735e67bde16b0636f8aa8591f831a25d18443ed00a699770" dependencies = [ "cfg-if 1.0.0", "futures-util", @@ -8680,9 +8754,9 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.17" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" dependencies = [ "tinyvec", ] @@ -8701,9 +8775,9 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "universal-hash" @@ -8764,9 +8838,9 @@ dependencies = [ [[package]] name = "url" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", "idna 0.2.3", @@ -8776,18 +8850,19 @@ dependencies = [ [[package]] name = "value-bag" -version = "1.0.0-alpha.6" +version = "1.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b676010e055c99033117c2343b33a40a30b91fecd6c49055ac9cd2d6c305ab1" +checksum = "dd320e1520f94261153e96f7534476ad869c14022aee1e59af7c778075d840ae" dependencies = [ "ctor", + "version_check", ] [[package]] name = "vcpkg" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vec_map" @@ -8859,9 +8934,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9" +checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -8869,9 +8944,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae" +checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" dependencies = [ "bumpalo", "lazy_static", @@ -8884,9 +8959,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.23" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b8b767af23de6ac18bf2168b690bed2902743ddf0fb39252e36f9e2bfc63ea" +checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -8896,9 +8971,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e734d91443f177bfdb41969de821e15c516931c3c3db3d318fa1b68975d0f6f" +checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -8906,9 +8981,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c" +checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" dependencies = [ "proc-macro2", "quote", @@ -8919,9 +8994,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489" +checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" [[package]] name = "wasm-gc-api" @@ -8940,7 +9015,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "js-sys", "parking_lot 0.11.1", "pin-utils", @@ -8951,38 +9026,39 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.6.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf617d864d25af3587aa745529f7aaa541066c876d57e050c0d0c85c61c92aff" +checksum = "d2ee05bba3d1d994652079893941a2ef9324d2b58a63c31b40678fb7eddd7a5a" dependencies = [ + "downcast-rs", "libc", "memory_units", "num-rational 0.2.4", "num-traits", - "parity-wasm 0.41.0", + "parity-wasm 0.42.2", "wasmi-validation", ] [[package]] name = "wasmi-validation" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93" +checksum = "a2eb8e860796d8be48efef530b60eebf84e74a88bce107374fffb0da97d504b8" dependencies = [ - "parity-wasm 0.41.0", + "parity-wasm 0.42.2", ] [[package]] name = "wasmparser" -version = "0.76.0" +version = "0.78.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755a9a4afe3f6cccbbe6d7e965eef44cf260b001f93e547eba84255c1d0187d8" +checksum = "52144d4c78e5cf8b055ceab8e5fa22814ce4315d6002ad32cfd914f37c12fd65" [[package]] name = "wasmtime" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718cb52a9fdb7ab12471e9b9d051c9adfa6b5c504e0a1fea045e5eabc81eedd9" +checksum = "b310b9d20fcf59385761d1ade7a3ef06aecc380e3d3172035b919eaf7465d9f7" dependencies = [ "anyhow", "backtrace", @@ -8990,9 +9066,11 @@ dependencies = [ "cfg-if 1.0.0", "cpp_demangle", "indexmap", + "lazy_static", "libc", "log", "paste", + "psm", "region", "rustc-demangle", "serde", @@ -9011,9 +9089,9 @@ dependencies = [ [[package]] name = "wasmtime-cache" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f984df56c4adeba91540f9052db9f7a8b3b00cfaac1a023bee50a972f588b0c" +checksum = "d14d500d5c3dc5f5c097158feee123d64b3097f0d836a2a27dff9c761c73c843" dependencies = [ "anyhow", "base64 0.13.0", @@ -9024,7 +9102,7 @@ dependencies = [ "libc", "log", "serde", - "sha2 0.9.3", + "sha2 0.9.5", "toml", "winapi 0.3.9", "zstd", @@ -9032,28 +9110,29 @@ dependencies = [ [[package]] name = "wasmtime-cranelift" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a05abbf94e03c2c8ee02254b1949320c4d45093de5d9d6ed4d9351d536075c9" +checksum = "c525b39f062eada7db3c1298287b96dcb6e472b9f6b22501300b28d9fa7582f6" dependencies = [ "cranelift-codegen", "cranelift-entity", "cranelift-frontend", "cranelift-wasm", + "target-lexicon", "wasmparser", "wasmtime-environ", ] [[package]] name = "wasmtime-debug" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382eecd6281c6c1d1f3c904c3c143e671fc1a9573820cbfa777fba45ce2eda9c" +checksum = "c5d2a763e7a6fc734218e0e463196762a4f409c483063d81e0e85f96343b2e0a" dependencies = [ "anyhow", "gimli", "more-asserts", - "object", + "object 0.24.0", "target-lexicon", "thiserror", "wasmparser", @@ -9062,11 +9141,10 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81011b2b833663d7e0ce34639459a0e301e000fc7331e0298b3a27c78d0cec60" +checksum = "f64d0c2d881c31b0d65c1f2695e022d71eb60b9fbdd336aacca28208b58eac90" dependencies = [ - "anyhow", "cfg-if 1.0.0", "cranelift-codegen", "cranelift-entity", @@ -9082,9 +9160,9 @@ dependencies = [ [[package]] name = "wasmtime-fiber" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92da32e31af2e3d828f485f5f24651ed4d3b7f03a46ea6555eae6940d1402cd" +checksum = "a089d44cd7e2465d41a53b840a5b4fca1bf6d1ecfebc970eac9592b34ea5f0b3" dependencies = [ "cc", "libc", @@ -9093,9 +9171,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b5f649623859a12d361fe4cc4793de44f7c3ff34c322c5714289787e89650bb" +checksum = "4d4539ea734422b7c868107e2187d7746d8affbcaa71916d72639f53757ad707" dependencies = [ "addr2line", "anyhow", @@ -9108,7 +9186,7 @@ dependencies = [ "gimli", "log", "more-asserts", - "object", + "object 0.24.0", "rayon", "region", "serde", @@ -9126,13 +9204,13 @@ dependencies = [ [[package]] name = "wasmtime-obj" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2e99cd9858f57fd062e9351e07881cedfc8597928385e02a48d9333b9e15a1" +checksum = "8e1a8ff85246d091828e2225af521a6208ed28c997bb5c39eb697366dc2e2f2b" dependencies = [ "anyhow", "more-asserts", - "object", + "object 0.24.0", "target-lexicon", "wasmtime-debug", "wasmtime-environ", @@ -9140,16 +9218,16 @@ dependencies = [ [[package]] name = "wasmtime-profiling" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e46c0a590e49278ba7f79ef217af9db4ecc671b50042c185093e22d73524abb2" +checksum = "e24364d522dcd67c897c8fffc42e5bdfc57207bbb6d7eeade0da9d4a7d70105b" dependencies = [ "anyhow", "cfg-if 1.0.0", "gimli", "lazy_static", "libc", - "object", + "object 0.24.0", "scroll", "serde", "target-lexicon", @@ -9159,10 +9237,11 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1438a09185fc7ca067caf1a80d7e5b398eefd4fb7630d94841448ade60feb3d0" +checksum = "c51e57976e8a19a18a18e002c6eb12e5769554204238e47ff155fda1809ef0f7" dependencies = [ + "anyhow", "backtrace", "cc", "cfg-if 1.0.0", @@ -9170,38 +9249,40 @@ dependencies = [ "lazy_static", "libc", "log", - "memoffset 0.6.3", + "mach", + "memoffset 0.6.4", "more-asserts", - "psm", + "rand 0.8.4", "region", "thiserror", "wasmtime-environ", + "wasmtime-fiber", "winapi 0.3.9", ] [[package]] name = "wast" -version = "35.0.2" +version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" +checksum = "8b5d7ba374a364571da1cb0a379a3dc302582a2d9937a183bfe35b68ad5bb9c4" dependencies = [ "leb128", ] [[package]] name = "wat" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ec280a739b69173e0ffd12c1658507996836ba4e992ed9bc1e5385a0bd72a02" +checksum = "16383df7f0e3901484c2dda6294ed6895caa3627ce4f6584141dcf30a33a23e6" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.50" +version = "0.3.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be" +checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" dependencies = [ "js-sys", "wasm-bindgen", @@ -9227,10 +9308,10 @@ dependencies = [ ] [[package]] -name = "wepoll-sys" -version = "3.0.1" +name = "wepoll-ffi" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff" +checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" dependencies = [ "cc", ] @@ -9330,27 +9411,17 @@ dependencies = [ "zeroize", ] -[[package]] -name = "xcm" -version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#127eb17a25bbe2a9f2731ff11a65d7f8170f2373" -dependencies = [ - "derivative", - "impl-trait-for-tuples", - "parity-scale-codec 2.1.1", -] - [[package]] name = "yamux" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7d9028f208dd5e63c614be69f115c1b53cacc1111437d4c765185856666c107" dependencies = [ - "futures 0.3.14", + "futures 0.3.15", "log", "nohash-hasher", "parking_lot 0.11.1", - "rand 0.8.3", + "rand 0.8.4", "static_assertions", ] diff --git a/Cargo.toml b/Cargo.toml index 6aef509d3..1f9582b73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,97 +1,99 @@ [patch.crates-io] -frame-benchmarking = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -frame-benchmarking-cli = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -frame-executive = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -frame-support = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -frame-system = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -frame-system-benchmarking = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -frame-system-rpc-runtime-api = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-balances = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-democracy = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-election-provider-multi-phase = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-grandpa = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-identity = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-randomness-collective-flip = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-scheduler = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-sudo = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-timestamp = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-tips = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-transaction-payment-rpc = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-transaction-payment-rpc-runtime-api = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-basic-authorship = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-chain-spec = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-cli = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-client-api = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-client-db = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-consensus = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-consensus-epochs = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-executor = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-finality-grandpa = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-informant = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-keystore = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-network = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-offchain = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-rpc = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-rpc-api = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-service = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-telemetry = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-transaction-pool = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-api = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-application-crypto = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-arithmetic = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-block-builder = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-blockchain = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-consensus = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-core = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-externalities = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-finality-grandpa = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-inherents = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-io = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-offchain = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-rpc = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-runtime = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-runtime-interface = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-session = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-staking = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-state-machine = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-std = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-storage = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-timestamp = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-tracing = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-transaction-pool = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-trie = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-version = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-npos-elections = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -substrate-frame-rpc-system = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} +frame-benchmarking = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +frame-benchmarking-cli = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +frame-executive = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +frame-support = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +frame-system = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +frame-system-benchmarking = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +frame-system-rpc-runtime-api = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-balances = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-democracy = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-election-provider-multi-phase = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-grandpa = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-identity = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-randomness-collective-flip = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-scheduler = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-sudo = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-timestamp = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-tips = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-transaction-payment-rpc = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-transaction-payment-rpc-runtime-api = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-basic-authorship = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-chain-spec = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-cli = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-client-api = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-client-db = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-consensus = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-consensus-epochs = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-executor = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-finality-grandpa = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-informant = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-keystore = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-network = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-offchain = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-rpc = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-rpc-api = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-service = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-telemetry = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-transaction-pool = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-api = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-application-crypto = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-arithmetic = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-block-builder = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-blockchain = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-consensus = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-core = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-externalities = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-finality-grandpa = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-inherents = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-io = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-offchain = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-rpc = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-runtime = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-runtime-interface = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-session = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-staking = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-state-machine = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-std = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-storage = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-timestamp = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-tracing = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-transaction-pool = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-trie = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-version = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-npos-elections = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +substrate-frame-rpc-system = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} -pallet-transaction-payment = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} +pallet-transaction-payment = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} #staking -pallet-authority-discovery = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-authorship = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-babe = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-collective = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-elections-phragmen = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-im-online = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-offences = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-session = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-staking = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-staking-reward-curve = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-treasury = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -pallet-utility = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-authority-discovery = {git = "https://github.com/paritytech/substrate.git", branch = 'rococo-v1'} -sc-consensus-babe = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-consensus-babe-rpc = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sc-consensus-slots = {git = "https://github.com/paritytech/substrate.git", branch = 'rococo-v1'} -sp-authority-discovery = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-consensus-babe = {git = 'https://github.com/paritytech/substrate', branch = 'rococo-v1'} -sp-keystore = {git = "https://github.com/paritytech/substrate.git", branch = 'rococo-v1'} +pallet-authority-discovery = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-authorship = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-babe = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-collective = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-elections-phragmen = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-im-online = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-offences = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-session = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-staking = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-staking-reward-curve = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-treasury = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +pallet-utility = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-authority-discovery = {git = "https://github.com/paritytech/substrate.git", branch = 'polkadot-v0.9.5'} +sc-consensus-babe = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-consensus-babe-rpc = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sc-consensus-slots = {git = "https://github.com/paritytech/substrate.git", branch = 'polkadot-v0.9.5'} +sc-consensus-uncles = {git = "https://github.com/paritytech/substrate.git", branch = 'polkadot-v0.9.5'} +sp-authority-discovery = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-consensus-babe = {git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.5'} +sp-keystore = {git = "https://github.com/paritytech/substrate.git", branch = 'polkadot-v0.9.5'} +sp-authorship = {git = "https://github.com/paritytech/substrate.git", branch = 'polkadot-v0.9.5'} # ORML dependencies -orml-currencies = {git = 'https://github.com/open-web3-stack/open-runtime-module-library', branch = 'master'} -orml-tokens = {git = 'https://github.com/open-web3-stack/open-runtime-module-library', branch = 'master'} -orml-traits = {git = 'https://github.com/open-web3-stack/open-runtime-module-library', branch = 'master'} -orml-utilities = {git = 'https://github.com/open-web3-stack/open-runtime-module-library', branch = 'master'} +orml-currencies = {git = 'https://github.com/open-web3-stack/open-runtime-module-library', rev = 'ded28318c23e2d263beeb1235f040f51826fe11e'} +orml-tokens = {git = 'https://github.com/open-web3-stack/open-runtime-module-library', rev = 'ded28318c23e2d263beeb1235f040f51826fe11e'} +orml-traits = {git = 'https://github.com/open-web3-stack/open-runtime-module-library', rev = 'ded28318c23e2d263beeb1235f040f51826fe11e'} +orml-utilities = {git = 'https://github.com/open-web3-stack/open-runtime-module-library', rev = 'ded28318c23e2d263beeb1235f040f51826fe11e'} [profile.release] panic = 'unwind' diff --git a/node/Cargo.toml b/node/Cargo.toml index a0e99e0b2..5db36d662 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -40,11 +40,14 @@ sc-authority-discovery = '0.9.0' sc-basic-authorship = '0.9.0' sc-cli = {features = ['wasmtime'], version = '0.9.0'} sc-client-api = '3.0.0' +sc-client-db = '0.9.0' +sc-chain-spec = "3.0.0" sc-consensus = '0.9.0' sc-consensus-babe = '0.9.0' sc-consensus-babe-rpc = '0.9.0' sc-consensus-epochs = '0.9.0' sc-consensus-slots = '0.9.0' +sc-consensus-uncles = '0.9.0' sc-executor = {features = ['wasmtime'], version = '0.9.0'} sc-finality-grandpa = '=0.9.0' sc-finality-grandpa-rpc = '=0.9.0' @@ -56,6 +59,7 @@ sc-service = '0.9.0' sc-telemetry = '3.0.0' sc-transaction-pool = '3.0.0' sp-api = '3.0.0' +sp-authorship = "3.0.0" sp-authority-discovery = '3.0.0' sp-block-builder = '3.0.0' sp-blockchain = '3.0.0' @@ -66,6 +70,7 @@ sp-finality-grandpa = '3.0.0' sp-inherents = '3.0.0' sp-keystore = '0.9.0' sp-runtime = '3.0.0' +sp-timestamp = '3.0.0' sp-transaction-pool = '3.0.0' substrate-frame-rpc-system = '3.0.0' diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 9151625ae..04fd454c5 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -3,11 +3,12 @@ use hydra_dx_runtime::constants::currency::{Balance, HDX}; use hydra_dx_runtime::opaque::SessionKeys; use hydra_dx_runtime::pallet_claims::EthereumAddress; +use hydra_dx_runtime::GenesisConfig; use hydra_dx_runtime::{ AccountId, AssetRegistryConfig, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, ClaimsConfig, CouncilConfig, - ElectionsConfig, FaucetConfig, GenesisConfig, GenesisHistoryConfig, GrandpaConfig, ImOnlineConfig, - MultiTransactionPaymentConfig, Perbill, SessionConfig, Signature, StakerStatus, StakingConfig, SudoConfig, - SystemConfig, TechnicalCommitteeConfig, TokensConfig, CORE_ASSET_ID, WASM_BINARY, + ElectionsConfig, FaucetConfig, GenesisHistoryConfig, GrandpaConfig, ImOnlineConfig, MultiTransactionPaymentConfig, + Perbill, SessionConfig, Signature, StakerStatus, StakingConfig, SudoConfig, SystemConfig, TechnicalCommitteeConfig, + TokensConfig, CORE_ASSET_ID, WASM_BINARY, }; use pallet_staking::Forcing; use sc_service::ChainType; @@ -301,12 +302,12 @@ fn testnet_genesis( _enable_println: bool, ) -> GenesisConfig { GenesisConfig { - frame_system: SystemConfig { + system: SystemConfig { // Add Wasm runtime to storage. code: wasm_binary.to_vec(), changes_trie_config: Default::default(), }, - pallet_balances: BalancesConfig { + balances: BalancesConfig { // Configure endowed accounts with initial balance of 1_000_000. balances: endowed_accounts .iter() @@ -314,12 +315,12 @@ fn testnet_genesis( .map(|k| (k, 1_000_000u128 * HDX)) .collect(), }, - pallet_grandpa: Default::default(), - pallet_sudo: SudoConfig { + grandpa: Default::default(), + sudo: SudoConfig { // Assign network admin rights. key: root_key.clone(), }, - pallet_asset_registry: AssetRegistryConfig { + asset_registry: AssetRegistryConfig { core_asset_id: CORE_ASSET_ID, asset_ids: vec![ (b"tKSM".to_vec(), 1), @@ -335,13 +336,13 @@ fn testnet_genesis( ], next_asset_id: 11, }, - pallet_transaction_multi_payment: MultiTransactionPaymentConfig { + multi_transaction_payment: MultiTransactionPaymentConfig { currencies: vec![], authorities: vec![], fallback_account: root_key, }, - orml_tokens: TokensConfig { - endowed_accounts: endowed_accounts + tokens: TokensConfig { + balances: endowed_accounts .iter() .flat_map(|x| { vec![ @@ -352,19 +353,19 @@ fn testnet_genesis( }) .collect(), }, - pallet_faucet: FaucetConfig { + faucet: FaucetConfig { rampage: true, mint_limit: 5, mintable_currencies: vec![0, 1, 2], }, - pallet_babe: BabeConfig { + babe: BabeConfig { authorities: vec![], epoch_config: Some(hydra_dx_runtime::BABE_GENESIS_EPOCH_CONFIG), }, - pallet_authority_discovery: AuthorityDiscoveryConfig { keys: vec![] }, - pallet_im_online: Default::default(), - pallet_treasury: Default::default(), - pallet_session: SessionConfig { + authority_discovery: AuthorityDiscoveryConfig { keys: vec![] }, + im_online: Default::default(), + treasury: Default::default(), + session: SessionConfig { keys: initial_authorities .iter() .map(|x| { @@ -376,7 +377,7 @@ fn testnet_genesis( }) .collect::>(), }, - pallet_staking: StakingConfig { + staking: StakingConfig { validator_count: initial_authorities.len() as u32 * 2, minimum_validator_count: initial_authorities.len() as u32, stakers: initial_authorities @@ -388,14 +389,14 @@ fn testnet_genesis( slash_reward_fraction: Perbill::from_percent(10), ..Default::default() }, - pallet_elections_phragmen: ElectionsConfig { + elections: ElectionsConfig { members: vec![(get_account_id_from_seed::("Alice"), STASH / 2)], }, - pallet_collective_Instance1: CouncilConfig { + council: CouncilConfig { members: vec![get_account_id_from_seed::("Alice")], phantom: Default::default(), }, - pallet_collective_Instance2: TechnicalCommitteeConfig { + technical_committee: TechnicalCommitteeConfig { members: vec![ get_account_id_from_seed::("Alice"), get_account_id_from_seed::("Bob"), @@ -403,10 +404,10 @@ fn testnet_genesis( ], phantom: Default::default(), }, - pallet_claims: ClaimsConfig { + claims: ClaimsConfig { claims: create_testnet_claims(), }, - pallet_genesis_history: GenesisHistoryConfig::default(), + genesis_history: GenesisHistoryConfig::default(), } } @@ -425,12 +426,12 @@ fn lerna_genesis( _enable_println: bool, ) -> GenesisConfig { GenesisConfig { - frame_system: SystemConfig { + system: SystemConfig { // Add Wasm runtime to storage. code: wasm_binary.to_vec(), changes_trie_config: Default::default(), }, - pallet_balances: BalancesConfig { + balances: BalancesConfig { // Intergalactic initial supply balances: vec![ ( @@ -465,37 +466,37 @@ fn lerna_genesis( ), ], }, - pallet_grandpa: GrandpaConfig { authorities: vec![] }, - pallet_sudo: SudoConfig { + grandpa: GrandpaConfig { authorities: vec![] }, + sudo: SudoConfig { // Assign network admin rights. key: root_key, }, - pallet_asset_registry: AssetRegistryConfig { + asset_registry: AssetRegistryConfig { core_asset_id: CORE_ASSET_ID, asset_ids: vec![], next_asset_id: 1, }, - pallet_transaction_multi_payment: MultiTransactionPaymentConfig { + multi_transaction_payment: MultiTransactionPaymentConfig { currencies: vec![], authorities: vec![], fallback_account: hex!["6d6f646c70792f74727372790000000000000000000000000000000000000000"].into(), }, - orml_tokens: TokensConfig { - endowed_accounts: endowed_accounts.iter().flat_map(|_x| vec![]).collect(), + tokens: TokensConfig { + balances: endowed_accounts.iter().flat_map(|_x| vec![]).collect(), }, - pallet_faucet: FaucetConfig { + faucet: FaucetConfig { rampage: false, mint_limit: 5, mintable_currencies: vec![], }, - pallet_babe: BabeConfig { + babe: BabeConfig { authorities: vec![], epoch_config: Some(hydra_dx_runtime::BABE_GENESIS_EPOCH_CONFIG), }, - pallet_authority_discovery: AuthorityDiscoveryConfig { keys: vec![] }, - pallet_im_online: ImOnlineConfig { keys: vec![] }, - pallet_treasury: Default::default(), - pallet_session: SessionConfig { + authority_discovery: AuthorityDiscoveryConfig { keys: vec![] }, + im_online: ImOnlineConfig { keys: vec![] }, + treasury: Default::default(), + session: SessionConfig { keys: initial_authorities .iter() .map(|x| { @@ -507,7 +508,7 @@ fn lerna_genesis( }) .collect::>(), }, - pallet_staking: StakingConfig { + staking: StakingConfig { validator_count: 3, minimum_validator_count: 3, stakers: initial_authorities @@ -519,19 +520,19 @@ fn lerna_genesis( slash_reward_fraction: Perbill::from_percent(10), ..Default::default() }, - pallet_elections_phragmen: ElectionsConfig { + elections: ElectionsConfig { // Intergalactic elections members: vec![( hex!["0abad795adcb5dee45d29528005b1f78d55fc170844babde88df84016c6cd14d"].into(), STASH, )], }, - pallet_collective_Instance1: CouncilConfig { + council: CouncilConfig { // Intergalactic council member members: vec![hex!["0abad795adcb5dee45d29528005b1f78d55fc170844babde88df84016c6cd14d"].into()], phantom: Default::default(), }, - pallet_collective_Instance2: TechnicalCommitteeConfig { + technical_committee: TechnicalCommitteeConfig { members: vec![ hex!["d6cf8789dce651cb54a4036406f4aa0c771914d345c004ad0567b814c71fb637"].into(), hex!["bc96ec00952efa8f0e3e08b36bf5096bcb877acac536e478aecb72868db5db02"].into(), @@ -542,8 +543,8 @@ fn lerna_genesis( ], phantom: Default::default(), }, - pallet_claims: ClaimsConfig { claims: vec![] }, - pallet_genesis_history: GenesisHistoryConfig { + claims: ClaimsConfig { claims: vec![] }, + genesis_history: GenesisHistoryConfig { previous_chain: Chain { genesis_hash: hex!["0ed32bfcab4a83517fac88f2aa7cbc2f88d3ab93be9a12b6188a036bf8a943c2"] .to_vec() diff --git a/node/src/command.rs b/node/src/command.rs index 443eb7e2e..951ad936a 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -150,7 +150,7 @@ pub fn run() -> sc_cli::Result<()> { runner.run_node_until_exit(|config| async move { match config.role { Role::Light => service::new_light(config), - _ => service::new_full(config).map(|(task_manager, _, _, _, _, _)| task_manager), + _ => service::new_full(config), } .map_err(sc_cli::Error::Service) }) diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 7992a4dd4..a3dea7db6 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -29,6 +29,8 @@ pub struct FullDeps { pub pool: Arc

, /// The SelectChain Strategy pub select_chain: SC, + /// A copy of the chain spec. + pub chain_spec: Box, /// Whether to deny unsafe calls pub deny_unsafe: DenyUnsafe, /// BABE specific dependencies. @@ -37,6 +39,18 @@ pub struct FullDeps { pub grandpa: GrandpaDeps, } +/// Light client extra dependencies. +pub struct LightDeps { + /// The client instance to use. + pub client: Arc, + /// Transaction pool instance. + pub pool: Arc

, + /// Remote access to the blockchain (async). + pub remote_blockchain: Arc>, + /// Fetcher instance. + pub fetcher: Arc, +} + /// Extra dependencies for BABE. pub struct BabeDeps { /// BABE protocol config. @@ -61,6 +75,9 @@ pub struct GrandpaDeps { pub finality_provider: Arc>, } +/// A IO handler that uses all Full RPC extensions. +pub type IoHandler = jsonrpc_core::IoHandler; + /// Instantiate all full RPC extensions. pub fn create_full(deps: FullDeps) -> jsonrpc_core::IoHandler where @@ -86,6 +103,7 @@ where client, pool, select_chain, + chain_spec: _, deny_unsafe, babe, grandpa, @@ -141,3 +159,31 @@ where io } + +/// Instantiate all Light RPC extensions. +pub fn create_light(deps: LightDeps) -> jsonrpc_core::IoHandler +where + C: sp_blockchain::HeaderBackend, + C: Send + Sync + 'static, + F: sc_client_api::light::Fetcher + 'static, + P: TransactionPool + 'static, + M: jsonrpc_core::Metadata + Default, +{ + use substrate_frame_rpc_system::{LightSystem, SystemApi}; + + let LightDeps { + client, + pool, + remote_blockchain, + fetcher, + } = deps; + let mut io = jsonrpc_core::IoHandler::default(); + io.extend_with(SystemApi::::to_delegate(LightSystem::new( + client, + remote_blockchain, + fetcher, + pool, + ))); + + io +} diff --git a/node/src/service.rs b/node/src/service.rs index 00c6c7e84..016da5fd7 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -3,32 +3,35 @@ #![allow(clippy::all)] use hydra_dx_runtime::{self, opaque::Block, RuntimeApi}; + +use futures::prelude::*; use sc_client_api::{ExecutorProvider, RemoteBackend}; +use sc_client_db::PruningMode; +use sc_consensus_babe; +use sc_consensus_babe::SlotProportion; use sc_executor::native_executor_instance; -pub use sc_executor::NativeExecutor; -use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider; -use sc_service::{error::Error as ServiceError, Configuration, TaskManager}; +use sc_network::{Event, NetworkService}; +use sc_service::{config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager}; use sc_telemetry::{Telemetry, TelemetryWorker}; -use sp_inherents::InherentDataProviders; use sp_runtime::traits::Block as BlockT; use std::sync::Arc; -use std::time::Duration; // Our native executor instance. native_executor_instance!( - pub Executor, - hydra_dx_runtime::api::dispatch, - hydra_dx_runtime::native_version, - frame_benchmarking::benchmarking::HostFunctions, + pub Executor, + hydra_dx_runtime::api::dispatch, + hydra_dx_runtime::native_version, + frame_benchmarking::benchmarking::HostFunctions, ); -pub type RpcExtension = jsonrpc_core::IoHandler; +use crate::rpc as node_rpc; +use sc_finality_grandpa as grandpa; type FullClient = sc_service::TFullClient; type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; - -type FullGrandpaBlockImport = sc_finality_grandpa::GrandpaBlockImport; +type FullGrandpaBlockImport = grandpa::GrandpaBlockImport; +type LightClient = sc_service::TLightClient; pub fn new_partial( config: &Configuration, @@ -40,24 +43,23 @@ pub fn new_partial( sp_consensus::DefaultImportQueue, sc_transaction_pool::FullPool, ( - impl Fn(sc_rpc::DenyUnsafe, sc_rpc::SubscriptionTaskExecutor) -> RpcExtension, + impl Fn(node_rpc::DenyUnsafe, sc_rpc::SubscriptionTaskExecutor) -> node_rpc::IoHandler, ( sc_consensus_babe::BabeBlockImport, - sc_finality_grandpa::LinkHalf, + grandpa::LinkHalf, sc_consensus_babe::BabeLink, ), - sc_finality_grandpa::SharedVoterState, + grandpa::SharedVoterState, Option, ), >, ServiceError, > { - let inherent_data_providers = sp_inherents::InherentDataProviders::new(); let telemetry = config .telemetry_endpoints .clone() .filter(|x| !x.is_empty()) - .map(move |endpoints| -> Result<_, sc_telemetry::Error> { + .map(|endpoints| -> Result<_, sc_telemetry::Error> { let worker = TelemetryWorker::new(16)?; let telemetry = worker.handle().new_telemetry(endpoints); Ok((worker, telemetry)) @@ -68,7 +70,6 @@ pub fn new_partial( &config, telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), )?; - let client = Arc::new(client); let telemetry = telemetry.map(|(worker, telemetry)| { @@ -82,17 +83,16 @@ pub fn new_partial( config.transaction_pool.clone(), config.role.is_authority().into(), config.prometheus_registry(), - task_manager.spawn_handle(), + task_manager.spawn_essential_handle(), client.clone(), ); - let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import( + let (grandpa_block_import, grandpa_link) = grandpa::block_import( client.clone(), &(client.clone() as Arc<_>), select_chain.clone(), telemetry.as_ref().map(|x| x.handle()), )?; - let justification_import = grandpa_block_import.clone(); let (block_import, babe_link) = sc_consensus_babe::block_import( @@ -101,13 +101,25 @@ pub fn new_partial( client.clone(), )?; + let slot_duration = babe_link.config().slot_duration(); let import_queue = sc_consensus_babe::import_queue( babe_link.clone(), block_import.clone(), Some(Box::new(justification_import)), client.clone(), select_chain.clone(), - inherent_data_providers.clone(), + move |_, ()| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_duration( + *timestamp, + slot_duration, + ); + + let uncles = sp_authorship::InherentDataProvider::<::Header>::check_inherents(); + + Ok((timestamp, slot, uncles)) + }, &task_manager.spawn_essential_handle(), config.prometheus_registry(), sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()), @@ -121,12 +133,12 @@ pub fn new_partial( let justification_stream = grandpa_link.justification_stream(); let shared_authority_set = grandpa_link.shared_authority_set().clone(); - let shared_voter_state = sc_finality_grandpa::SharedVoterState::empty(); - let finality_proof_provider = - GrandpaFinalityProofProvider::new_for_service(backend.clone(), Some(shared_authority_set.clone())); - + let shared_voter_state = grandpa::SharedVoterState::empty(); let rpc_setup = shared_voter_state.clone(); + let finality_proof_provider = + grandpa::FinalityProofProvider::new_for_service(backend.clone(), Some(shared_authority_set.clone())); + let babe_config = babe_link.config().clone(); let shared_epoch_changes = babe_link.epoch_changes().clone(); @@ -134,19 +146,25 @@ pub fn new_partial( let pool = transaction_pool.clone(); let select_chain = select_chain.clone(); let keystore = keystore_container.sync_keystore(); + let chain_spec = config.chain_spec.cloned_box(); + let _is_archive_mode = match config.state_pruning { + PruningMode::Constrained(_) => false, + PruningMode::ArchiveAll | PruningMode::ArchiveCanonical => true, + }; let rpc_extensions_builder = move |deny_unsafe, subscription_executor| { - let deps = crate::rpc::FullDeps { + let deps = node_rpc::FullDeps { client: client.clone(), pool: pool.clone(), select_chain: select_chain.clone(), + chain_spec: chain_spec.cloned_box(), deny_unsafe, - babe: crate::rpc::BabeDeps { + babe: node_rpc::BabeDeps { babe_config: babe_config.clone(), shared_epoch_changes: shared_epoch_changes.clone(), keystore: keystore.clone(), }, - grandpa: crate::rpc::GrandpaDeps { + grandpa: node_rpc::GrandpaDeps { shared_voter_state: shared_voter_state.clone(), shared_authority_set: shared_authority_set.clone(), justification_stream: justification_stream.clone(), @@ -155,7 +173,8 @@ pub fn new_partial( }, }; - crate::rpc::create_full(deps) + let io = node_rpc::create_full(deps); + io }; (rpc_extensions_builder, rpc_setup) @@ -169,25 +188,25 @@ pub fn new_partial( select_chain, import_queue, transaction_pool, - inherent_data_providers, other: (rpc_extensions_builder, import_setup, rpc_setup, telemetry), }) } -/// Builds a new service for a full client. -pub fn new_full( +pub struct NewFullBase { + pub task_manager: TaskManager, + pub client: Arc, + pub network: Arc::Hash>>, + pub transaction_pool: Arc>, +} + +/// Creates a full service from the configuration. +pub fn new_full_base( mut config: Configuration, -) -> Result< - ( - TaskManager, - InherentDataProviders, - Arc, - Arc::Hash>>, - sc_service::NetworkStatusSinks, - Arc>, + with_startup_data: impl FnOnce( + &sc_consensus_babe::BabeBlockImport, + &sc_consensus_babe::BabeLink, ), - ServiceError, -> { +) -> Result { let sc_service::PartialComponents { client, backend, @@ -196,29 +215,34 @@ pub fn new_full( keystore_container, select_chain, transaction_pool, - inherent_data_providers, other: (rpc_extensions_builder, import_setup, rpc_setup, mut telemetry), } = new_partial(&config)?; - let backoff_authoring_blocks = Some(sc_consensus_slots::BackoffAuthoringOnFinalizedHeadLagging::default()); - let shared_voter_state = rpc_setup; + let auth_disc_publish_non_global_ips = config.network.allow_non_globals_in_dht; + config.network.extra_sets.push(grandpa::grandpa_peers_set_config()); + + #[cfg(feature = "cli")] config .network - .extra_sets - .push(sc_finality_grandpa::grandpa_peers_set_config()); + .request_response_protocols + .push(sc_finality_grandpa_warp_sync::request_response_config_for_chain( + &config, + task_manager.spawn_handle(), + backend.clone(), + import_setup.1.shared_authority_set().clone(), + )); - let (network, network_status_sinks, system_rpc_tx, network_starter) = - sc_service::build_network(sc_service::BuildNetworkParams { - config: &config, - client: client.clone(), - transaction_pool: transaction_pool.clone(), - spawn_handle: task_manager.spawn_handle(), - import_queue, - on_demand: None, - block_announce_validator_builder: None, - })?; + let (network, system_rpc_tx, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { + config: &config, + client: client.clone(), + transaction_pool: transaction_pool.clone(), + spawn_handle: task_manager.spawn_handle(), + import_queue, + on_demand: None, + block_announce_validator_builder: None, + })?; if config.offchain_worker.enabled { sc_service::build_offchain_workers(&config, task_manager.spawn_handle(), client.clone(), network.clone()); @@ -226,13 +250,14 @@ pub fn new_full( let role = config.role.clone(); let force_authoring = config.force_authoring; + let backoff_authoring_blocks = Some(sc_consensus_slots::BackoffAuthoringOnFinalizedHeadLagging::default()); let name = config.network.node_name.clone(); let enable_grandpa = !config.disable_grandpa; let prometheus_registry = config.prometheus_registry().cloned(); let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { config, - backend: backend, + backend: backend.clone(), client: client.clone(), keystore: keystore_container.sync_keystore(), network: network.clone(), @@ -241,14 +266,15 @@ pub fn new_full( task_manager: &mut task_manager, on_demand: None, remote_blockchain: None, - network_status_sinks: network_status_sinks.clone(), system_rpc_tx, telemetry: telemetry.as_mut(), })?; let (block_import, grandpa_link, babe_link) = import_setup; - if role.is_authority() { + (with_startup_data)(&block_import, &babe_link); + + if let sc_service::config::Role::Authority { .. } = &role { let proposer = sc_basic_authorship::ProposerFactory::new( task_manager.spawn_handle(), client.clone(), @@ -259,43 +285,59 @@ pub fn new_full( let can_author_with = sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); + let client_clone = client.clone(); + let slot_duration = babe_link.config().slot_duration(); let babe_config = sc_consensus_babe::BabeParams { keystore: keystore_container.sync_keystore(), client: client.clone(), select_chain, - block_import, env: proposer, + block_import, sync_oracle: network.clone(), - inherent_data_providers: inherent_data_providers.clone(), + justification_sync_link: network.clone(), + create_inherent_data_providers: move |parent, ()| { + let client_clone = client_clone.clone(); + async move { + let uncles = sc_consensus_uncles::create_uncles_inherent_data_provider(&*client_clone, parent)?; + + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_duration( + *timestamp, + slot_duration, + ); + + Ok((timestamp, slot, uncles)) + } + }, force_authoring, backoff_authoring_blocks, babe_link, can_author_with, - block_proposal_slot_portion: sc_consensus_babe::SlotProportion::new(2f32 / 3f32), + block_proposal_slot_portion: SlotProportion::new(0.5), telemetry: telemetry.as_ref().map(|x| x.handle()), }; let babe = sc_consensus_babe::start_babe(babe_config)?; - task_manager.spawn_essential_handle().spawn_blocking("babe", babe); + task_manager + .spawn_essential_handle() + .spawn_blocking("babe-proposer", babe); } - let _authority_discovery_service = if role.is_authority() { - use futures::StreamExt; - use sc_network::Event; - - let authority_discovery_role = if role.is_authority() { - sc_authority_discovery::Role::PublishAndDiscover(keystore_container.keystore()) - } else { - // don't publish our addresses when we're only a collator - sc_authority_discovery::Role::Discover - }; + // Spawn authority discovery module. + if role.is_authority() { + let authority_discovery_role = sc_authority_discovery::Role::PublishAndDiscover(keystore_container.keystore()); let dht_event_stream = network.event_stream("authority-discovery").filter_map(|e| async move { match e { Event::Dht(e) => Some(e), _ => None, } }); - let (worker, service) = sc_authority_discovery::new_worker_and_service( + let (authority_discovery_worker, _service) = sc_authority_discovery::new_worker_and_service_with_config( + sc_authority_discovery::WorkerConfig { + publish_non_global_ips: auth_disc_publish_non_global_ips, + ..Default::default() + }, client.clone(), network.clone(), Box::pin(dht_event_stream), @@ -305,29 +347,25 @@ pub fn new_full( task_manager .spawn_handle() - .spawn("authority-discovery-worker", worker.run()); - Some(service) - } else { - None - }; + .spawn("authority-discovery-worker", authority_discovery_worker.run()); + } // 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()) } else { None }; - let grandpa_config = sc_finality_grandpa::Config { + let config = grandpa::Config { // FIXME #1578 make this available through chainspec - gossip_duration: Duration::from_millis(1000), - justification_period: 512, + gossip_duration: std::time::Duration::from_millis(333), + justification_period: 1, name: Some(name), observer_enabled: false, keystore, - is_authority: role.is_authority(), + local_role: role, telemetry: telemetry.as_ref().map(|x| x.handle()), }; @@ -338,42 +376,62 @@ pub fn new_full( // 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 { - config: grandpa_config, + let grandpa_config = grandpa::GrandpaParams { + config, link: grandpa_link, network: network.clone(), - voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(), - prometheus_registry: prometheus_registry, - shared_voter_state, telemetry: telemetry.as_ref().map(|x| x.handle()), + voting_rule: grandpa::VotingRulesBuilder::default().build(), + prometheus_registry, + shared_voter_state, }; // the GRANDPA voter task is considered infallible, i.e. // if it fails we take down the service with it. task_manager .spawn_essential_handle() - .spawn_blocking("grandpa-voter", sc_finality_grandpa::run_grandpa_voter(grandpa_config)?); + .spawn_blocking("grandpa-voter", grandpa::run_grandpa_voter(grandpa_config)?); } network_starter.start_network(); - Ok(( + Ok(NewFullBase { task_manager, - inherent_data_providers, client, network, - network_status_sinks, transaction_pool, - )) + }) } -/// Builds a new service for a light client. -pub fn new_light(config: Configuration) -> Result { +/// Builds a new service for a full client. +pub fn new_full(config: Configuration) -> Result { + new_full_base(config, |_, _| ()).map(|NewFullBase { task_manager, .. }| task_manager) +} + +pub fn new_light_base( + mut config: Configuration, +) -> Result< + ( + TaskManager, + RpcHandlers, + Arc, + Arc::Hash>>, + Arc>>, + ), + ServiceError, +> { let telemetry = config .telemetry_endpoints .clone() .filter(|x| !x.is_empty()) .map(|endpoints| -> Result<_, sc_telemetry::Error> { - let worker = TelemetryWorker::new(16)?; + #[cfg(feature = "browser")] + let transport = Some(sc_telemetry::ExtTransport::new( + libp2p_wasm_ext::ffi::websocket_transport(), + )); + #[cfg(not(feature = "browser"))] + let transport = None; + + let worker = TelemetryWorker::with_transport(16, transport)?; let telemetry = worker.handle().new_telemetry(endpoints); Ok((worker, telemetry)) }) @@ -385,22 +443,24 @@ pub fn new_light(config: Configuration) -> Result { telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), )?; - let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light( - config.transaction_pool.clone(), - config.prometheus_registry(), - task_manager.spawn_handle(), - client.clone(), - on_demand.clone(), - )); - let mut telemetry = telemetry.map(|(worker, telemetry)| { task_manager.spawn_handle().spawn("telemetry", worker.run()); telemetry }); + config.network.extra_sets.push(grandpa::grandpa_peers_set_config()); + let select_chain = sc_consensus::LongestChain::new(backend.clone()); - let (grandpa_block_import, _) = sc_finality_grandpa::block_import( + let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light( + config.transaction_pool.clone(), + config.prometheus_registry(), + task_manager.spawn_essential_handle(), + client.clone(), + on_demand.clone(), + )); + + let (grandpa_block_import, grandpa_link) = grandpa::block_import( client.clone(), &(client.clone() as Arc<_>), select_chain.clone(), @@ -414,51 +474,94 @@ pub fn new_light(config: Configuration) -> Result { client.clone(), )?; + let slot_duration = babe_link.config().slot_duration(); let import_queue = sc_consensus_babe::import_queue( babe_link, babe_block_import, Some(Box::new(justification_import)), client.clone(), - select_chain, - InherentDataProviders::new(), + select_chain.clone(), + move |_, ()| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_duration( + *timestamp, + slot_duration, + ); + + let uncles = sp_authorship::InherentDataProvider::<::Header>::check_inherents(); + + Ok((timestamp, slot, uncles)) + }, &task_manager.spawn_essential_handle(), config.prometheus_registry(), sp_consensus::NeverCanAuthor, telemetry.as_ref().map(|x| x.handle()), )?; - let (network, network_status_sinks, system_rpc_tx, network_starter) = - sc_service::build_network(sc_service::BuildNetworkParams { - config: &config, - client: client.clone(), - transaction_pool: transaction_pool.clone(), - spawn_handle: task_manager.spawn_handle(), - import_queue, - on_demand: Some(on_demand.clone()), - block_announce_validator_builder: None, - })?; + let (network, system_rpc_tx, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { + config: &config, + client: client.clone(), + transaction_pool: transaction_pool.clone(), + spawn_handle: task_manager.spawn_handle(), + import_queue, + on_demand: Some(on_demand.clone()), + block_announce_validator_builder: None, + })?; + + let enable_grandpa = !config.disable_grandpa; + if enable_grandpa { + let name = config.network.node_name.clone(); + + let config = grandpa::Config { + gossip_duration: std::time::Duration::from_millis(333), + justification_period: 512, + name: Some(name), + observer_enabled: false, + keystore: None, + local_role: config.role.clone(), + telemetry: telemetry.as_ref().map(|x| x.handle()), + }; + + task_manager.spawn_handle().spawn_blocking( + "grandpa-observer", + grandpa::run_grandpa_observer(config, grandpa_link, network.clone())?, + ); + } if config.offchain_worker.enabled { sc_service::build_offchain_workers(&config, task_manager.spawn_handle(), client.clone(), network.clone()); } - sc_service::spawn_tasks(sc_service::SpawnTasksParams { - remote_blockchain: Some(backend.remote_blockchain()), - transaction_pool, - task_manager: &mut task_manager, + let light_deps = node_rpc::LightDeps { + remote_blockchain: backend.remote_blockchain(), + fetcher: on_demand.clone(), + client: client.clone(), + pool: transaction_pool.clone(), + }; + + let rpc_extensions = node_rpc::create_light(light_deps); + + let rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { on_demand: Some(on_demand), - rpc_extensions_builder: Box::new(|_, _| ()), - config, - client, + remote_blockchain: Some(backend.remote_blockchain()), + rpc_extensions_builder: Box::new(sc_service::NoopRpcExtensionBuilder(rpc_extensions)), + client: client.clone(), + transaction_pool: transaction_pool.clone(), keystore: keystore_container.sync_keystore(), + config, backend, - network, - network_status_sinks, system_rpc_tx, + network: network.clone(), + task_manager: &mut task_manager, telemetry: telemetry.as_mut(), })?; network_starter.start_network(); + Ok((task_manager, rpc_handlers, client, network, transaction_pool)) +} - Ok(task_manager) +/// Builds a new service for a light client. +pub fn new_light(config: Configuration) -> Result { + new_light_base(config).map(|(task_manager, _, _, _, _)| task_manager) } diff --git a/pallets/balances/Cargo.toml b/pallets/balances/Cargo.toml deleted file mode 100644 index 59fff19e6..000000000 --- a/pallets/balances/Cargo.toml +++ /dev/null @@ -1,43 +0,0 @@ -[package] -authors = ["Parity Technologies "] -description = "FRAME pallet to manage balances" -edition = "2018" -homepage = "https://substrate.dev" -license = "Apache-2.0" -name = "pallet-balances" -readme = "README.md" -repository = "https://github.com/paritytech/substrate/" -version = "3.0.1" - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -codec = {package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"]} -frame-benchmarking = {version = "3.1.0", default-features = false, optional = true} -frame-support = {version = "3.0.0", default-features = false} -frame-system = {version = "3.0.0", default-features = false} -serde = {version = "1.0.101", optional = true} -sp-runtime = {version = "3.0.0", default-features = false} -sp-std = {version = "3.0.0", default-features = false} -log = { version = "0.4.14", default-features = false } - -[dev-dependencies] -pallet-transaction-payment = {version = "3.0.0"} -sp-core = {version = "3.0.0"} -sp-io = {version = "3.0.0"} - -[features] -default = ["std"] -runtime-benchmarks = ["frame-benchmarking"] -std = [ - "serde", - "codec/std", - "sp-std/std", - "sp-runtime/std", - "frame-benchmarking/std", - "frame-support/std", - "frame-system/std", - "log/std", -] -try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/balances/README.md b/pallets/balances/README.md deleted file mode 100644 index cbbfea75e..000000000 --- a/pallets/balances/README.md +++ /dev/null @@ -1,122 +0,0 @@ -# Balances Module - -The Balances module provides functionality for handling accounts and balances. - -- [`balances::Trait`](https://docs.rs/pallet-balances/latest/pallet_balances/trait.Trait.html) -- [`Call`](https://docs.rs/pallet-balances/latest/pallet_balances/enum.Call.html) -- [`Module`](https://docs.rs/pallet-balances/latest/pallet_balances/struct.Module.html) - -## Overview - -The Balances module provides functions for: - -- Getting and setting free balances. -- Retrieving total, reserved and unreserved balances. -- Repatriating a reserved balance to a beneficiary account that exists. -- Transferring a balance between accounts (when not reserved). -- Slashing an account balance. -- Account creation and removal. -- Managing total issuance. -- Setting and managing locks. - -### Terminology - -- **Existential Deposit:** The minimum balance required to create or keep an account open. This prevents -"dust accounts" from filling storage. When the free plus the reserved balance (i.e. the total balance) - fall below this, then the account is said to be dead; and it loses its functionality as well as any - prior history and all information on it is removed from the chain's state. - No account should ever have a total balance that is strictly between 0 and the existential - deposit (exclusive). If this ever happens, it indicates either a bug in this module or an - erroneous raw mutation of storage. - -- **Total Issuance:** The total number of units in existence in a system. - -- **Reaping an account:** The act of removing an account by resetting its nonce. Happens after its -total balance has become zero (or, strictly speaking, less than the Existential Deposit). - -- **Free Balance:** The portion of a balance that is not reserved. The free balance is the only - balance that matters for most operations. - -- **Reserved Balance:** Reserved balance still belongs to the account holder, but is suspended. - Reserved balance can still be slashed, but only after all the free balance has been slashed. - -- **Imbalance:** A condition when some funds were credited or debited without equal and opposite accounting -(i.e. a difference between total issuance and account balances). Functions that result in an imbalance will -return an object of the `Imbalance` trait that can be managed within your runtime logic. (If an imbalance is -simply dropped, it should automatically maintain any book-keeping such as total issuance.) - -- **Lock:** A freeze on a specified amount of an account's free balance until a specified block number. Multiple -locks always operate over the same funds, so they "overlay" rather than "stack". - -### Implementations - -The Balances module provides implementations for the following traits. If these traits provide the functionality -that you need, then you can avoid coupling with the Balances module. - -- [`Currency`](https://docs.rs/frame-support/latest/frame_support/traits/trait.Currency.html): Functions for dealing with a -fungible assets system. -- [`ReservableCurrency`](https://docs.rs/frame-support/latest/frame_support/traits/trait.ReservableCurrency.html): -Functions for dealing with assets that can be reserved from an account. -- [`LockableCurrency`](https://docs.rs/frame-support/latest/frame_support/traits/trait.LockableCurrency.html): Functions for -dealing with accounts that allow liquidity restrictions. -- [`Imbalance`](https://docs.rs/frame-support/latest/frame_support/traits/trait.Imbalance.html): Functions for handling -imbalances between total issuance in the system and account balances. Must be used when a function -creates new funds (e.g. a reward) or destroys some funds (e.g. a system fee). -- [`IsDeadAccount`](https://docs.rs/frame-support/latest/frame_support/traits/trait.IsDeadAccount.html): Determiner to say whether a -given account is unused. - -## Interface - -### Dispatchable Functions - -- `transfer` - Transfer some liquid free balance to another account. -- `set_balance` - Set the balances of a given account. The origin of this call must be root. - -## Usage - -The following examples show how to use the Balances module in your custom module. - -### Examples from the FRAME - -The Contract module uses the `Currency` trait to handle gas payment, and its types inherit from `Currency`: - -```rust -use frame_support::traits::Currency; - -pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; -pub type NegativeImbalanceOf = <::Currency as Currency<::AccountId>>::NegativeImbalance; - -``` - -The Staking module uses the `LockableCurrency` trait to lock a stash account's funds: - -```rust -use frame_support::traits::{WithdrawReasons, LockableCurrency}; -use sp_runtime::traits::Bounded; -pub trait Config: frame_system::Config { - type Currency: LockableCurrency; -} - -fn update_ledger( - controller: &T::AccountId, - ledger: &StakingLedger -) { - T::Currency::set_lock( - STAKING_ID, - &ledger.stash, - ledger.total, - WithdrawReasons::all() - ); - // >::insert(controller, ledger); // Commented out as we don't have access to Staking's storage here. -} -``` - -## Genesis config - -The Balances module depends on the [`GenesisConfig`](https://docs.rs/pallet-balances/latest/pallet_balances/struct.GenesisConfig.html). - -## Assumptions - -* Total issued balanced of all accounts should be less than `Config::Balance::max_value()`. - -License: Apache-2.0 diff --git a/pallets/balances/src/benchmarking.rs b/pallets/balances/src/benchmarking.rs deleted file mode 100644 index c01c30951..000000000 --- a/pallets/balances/src/benchmarking.rs +++ /dev/null @@ -1,144 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Balances pallet benchmarking. - -#![cfg(feature = "runtime-benchmarks")] - -use super::*; - -use frame_benchmarking::{account, benchmarks_instance_pallet, whitelisted_caller}; -use frame_system::RawOrigin; -use sp_runtime::traits::Bounded; - -use crate::Pallet as Balances; - -const SEED: u32 = 0; -// existential deposit multiplier -const ED_MULTIPLIER: u32 = 10; - -benchmarks_instance_pallet! { - // Benchmark `transfer` extrinsic with the worst possible conditions: - // * Transfer will kill the sender account. - // * Transfer will create the recipient account. - transfer { - let existential_deposit = T::ExistentialDeposit::get(); - let caller = whitelisted_caller(); - - // Give some multiple of the existential deposit + creation fee + transfer fee - let balance = existential_deposit.saturating_mul(ED_MULTIPLIER.into()); - let _ = as Currency<_>>::make_free_balance_be(&caller, balance); - - // Transfer `e - 1` existential deposits + 1 unit, which guarantees to create one account, and reap this user. - let recipient: T::AccountId = account("recipient", 0, SEED); - let recipient_lookup: ::Source = T::Lookup::unlookup(recipient.clone()); - let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1u32.into(); - }: transfer(RawOrigin::Signed(caller.clone()), recipient_lookup, transfer_amount) - verify { - assert_eq!(Balances::::free_balance(&caller), Zero::zero()); - assert_eq!(Balances::::free_balance(&recipient), transfer_amount); - } - - // Benchmark `transfer` with the best possible condition: - // * Both accounts exist and will continue to exist. - #[extra] - transfer_best_case { - let caller = whitelisted_caller(); - let recipient: T::AccountId = account("recipient", 0, SEED); - let recipient_lookup: ::Source = T::Lookup::unlookup(recipient.clone()); - - // Give the sender account max funds for transfer (their account will never reasonably be killed). - let _ = as Currency<_>>::make_free_balance_be(&caller, T::Balance::max_value()); - - // Give the recipient account existential deposit (thus their account already exists). - let existential_deposit = T::ExistentialDeposit::get(); - let _ = as Currency<_>>::make_free_balance_be(&recipient, existential_deposit); - let transfer_amount = existential_deposit.saturating_mul(ED_MULTIPLIER.into()); - }: transfer(RawOrigin::Signed(caller.clone()), recipient_lookup, transfer_amount) - verify { - assert!(!Balances::::free_balance(&caller).is_zero()); - assert!(!Balances::::free_balance(&recipient).is_zero()); - } - - // Benchmark `transfer_keep_alive` with the worst possible condition: - // * The recipient account is created. - transfer_keep_alive { - let caller = whitelisted_caller(); - let recipient: T::AccountId = account("recipient", 0, SEED); - let recipient_lookup: ::Source = T::Lookup::unlookup(recipient.clone()); - - // Give the sender account max funds, thus a transfer will not kill account. - let _ = as Currency<_>>::make_free_balance_be(&caller, T::Balance::max_value()); - let existential_deposit = T::ExistentialDeposit::get(); - let transfer_amount = existential_deposit.saturating_mul(ED_MULTIPLIER.into()); - }: _(RawOrigin::Signed(caller.clone()), recipient_lookup, transfer_amount) - verify { - assert!(!Balances::::free_balance(&caller).is_zero()); - assert_eq!(Balances::::free_balance(&recipient), transfer_amount); - } - - // Benchmark `set_balance` coming from ROOT account. This always creates an account. - set_balance_creating { - let user: T::AccountId = account("user", 0, SEED); - let user_lookup: ::Source = T::Lookup::unlookup(user.clone()); - - // Give the user some initial balance. - let existential_deposit = T::ExistentialDeposit::get(); - let balance_amount = existential_deposit.saturating_mul(ED_MULTIPLIER.into()); - let _ = as Currency<_>>::make_free_balance_be(&user, balance_amount); - }: set_balance(RawOrigin::Root, user_lookup, balance_amount, balance_amount) - verify { - assert_eq!(Balances::::free_balance(&user), balance_amount); - assert_eq!(Balances::::reserved_balance(&user), balance_amount); - } - - // Benchmark `set_balance` coming from ROOT account. This always kills an account. - set_balance_killing { - let user: T::AccountId = account("user", 0, SEED); - let user_lookup: ::Source = T::Lookup::unlookup(user.clone()); - - // Give the user some initial balance. - let existential_deposit = T::ExistentialDeposit::get(); - let balance_amount = existential_deposit.saturating_mul(ED_MULTIPLIER.into()); - let _ = as Currency<_>>::make_free_balance_be(&user, balance_amount); - }: set_balance(RawOrigin::Root, user_lookup, Zero::zero(), Zero::zero()) - verify { - assert!(Balances::::free_balance(&user).is_zero()); - } - - // Benchmark `force_transfer` extrinsic with the worst possible conditions: - // * Transfer will kill the sender account. - // * Transfer will create the recipient account. - force_transfer { - let existential_deposit = T::ExistentialDeposit::get(); - let source: T::AccountId = account("source", 0, SEED); - let source_lookup: ::Source = T::Lookup::unlookup(source.clone()); - - // Give some multiple of the existential deposit + creation fee + transfer fee - let balance = existential_deposit.saturating_mul(ED_MULTIPLIER.into()); - let _ = as Currency<_>>::make_free_balance_be(&source, balance); - - // Transfer `e - 1` existential deposits + 1 unit, which guarantees to create one account, and reap this user. - let recipient: T::AccountId = account("recipient", 0, SEED); - let recipient_lookup: ::Source = T::Lookup::unlookup(recipient.clone()); - let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1u32.into(); - }: force_transfer(RawOrigin::Root, source_lookup, recipient_lookup, transfer_amount) - verify { - assert_eq!(Balances::::free_balance(&source), Zero::zero()); - assert_eq!(Balances::::free_balance(&recipient), transfer_amount); - } -} diff --git a/pallets/balances/src/lib.rs b/pallets/balances/src/lib.rs deleted file mode 100644 index e2d9e60ec..000000000 --- a/pallets/balances/src/lib.rs +++ /dev/null @@ -1,1759 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#![allow(clippy::all)] - -//! # Balances Pallet -//! -//! The Balances pallet provides functionality for handling accounts and balances. -//! -//! - [`Config`] -//! - [`Call`] -//! - [`Pallet`] -//! -//! ## Overview -//! -//! The Balances pallet provides functions for: -//! -//! - Getting and setting free balances. -//! - Retrieving total, reserved and unreserved balances. -//! - Repatriating a reserved balance to a beneficiary account that exists. -//! - Transferring a balance between accounts (when not reserved). -//! - Slashing an account balance. -//! - Account creation and removal. -//! - Managing total issuance. -//! - Setting and managing locks. -//! -//! ### Terminology -//! -//! - **Existential Deposit:** The minimum balance required to create or keep an account open. This prevents -//! "dust accounts" from filling storage. When the free plus the reserved balance (i.e. the total balance) -//! fall below this, then the account is said to be dead; and it loses its functionality as well as any -//! prior history and all information on it is removed from the chain's state. -//! No account should ever have a total balance that is strictly between 0 and the existential -//! deposit (exclusive). If this ever happens, it indicates either a bug in this pallet or an -//! erroneous raw mutation of storage. -//! -//! - **Total Issuance:** The total number of units in existence in a system. -//! -//! - **Reaping an account:** The act of removing an account by resetting its nonce. Happens after its -//! total balance has become zero (or, strictly speaking, less than the Existential Deposit). -//! -//! - **Free Balance:** The portion of a balance that is not reserved. The free balance is the only -//! balance that matters for most operations. -//! -//! - **Reserved Balance:** Reserved balance still belongs to the account holder, but is suspended. -//! Reserved balance can still be slashed, but only after all the free balance has been slashed. -//! -//! - **Imbalance:** A condition when some funds were credited or debited without equal and opposite accounting -//! (i.e. a difference between total issuance and account balances). Functions that result in an imbalance will -//! return an object of the `Imbalance` trait that can be managed within your runtime logic. (If an imbalance is -//! simply dropped, it should automatically maintain any book-keeping such as total issuance.) -//! -//! - **Lock:** A freeze on a specified amount of an account's free balance until a specified block number. Multiple -//! locks always operate over the same funds, so they "overlay" rather than "stack". -//! -//! ### Implementations -//! -//! The Balances pallet provides implementations for the following traits. If these traits provide the functionality -//! that you need, then you can avoid coupling with the Balances pallet. -//! -//! - [`Currency`](frame_support::traits::Currency): Functions for dealing with a -//! fungible assets system. -//! - [`ReservableCurrency`](frame_support::traits::ReservableCurrency): -//! Functions for dealing with assets that can be reserved from an account. -//! - [`LockableCurrency`](frame_support::traits::LockableCurrency): Functions for -//! dealing with accounts that allow liquidity restrictions. -//! - [`Imbalance`](frame_support::traits::Imbalance): Functions for handling -//! imbalances between total issuance in the system and account balances. Must be used when a function -//! creates new funds (e.g. a reward) or destroys some funds (e.g. a system fee). -//! -//! ## Interface -//! -//! ### Dispatchable Functions -//! -//! - `transfer` - Transfer some liquid free balance to another account. -//! - `set_balance` - Set the balances of a given account. The origin of this call must be root. -//! -//! ## Usage -//! -//! The following examples show how to use the Balances pallet in your custom pallet. -//! -//! ### Examples from the FRAME -//! -//! The Contract pallet uses the `Currency` trait to handle gas payment, and its types inherit from `Currency`: -//! -//! ``` -//! use frame_support::traits::Currency; -//! # pub trait Config: frame_system::Config { -//! # type Currency: Currency; -//! # } -//! -//! pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; -//! pub type NegativeImbalanceOf = <::Currency as Currency<::AccountId>>::NegativeImbalance; -//! -//! # fn main() {} -//! ``` -//! -//! The Staking pallet uses the `LockableCurrency` trait to lock a stash account's funds: -//! -//! ``` -//! use frame_support::traits::{WithdrawReasons, LockableCurrency}; -//! use sp_runtime::traits::Bounded; -//! pub trait Config: frame_system::Config { -//! type Currency: LockableCurrency; -//! } -//! # struct StakingLedger { -//! # stash: ::AccountId, -//! # total: <::Currency as frame_support::traits::Currency<::AccountId>>::Balance, -//! # phantom: std::marker::PhantomData, -//! # } -//! # const STAKING_ID: [u8; 8] = *b"staking "; -//! -//! fn update_ledger( -//! controller: &T::AccountId, -//! ledger: &StakingLedger -//! ) { -//! T::Currency::set_lock( -//! STAKING_ID, -//! &ledger.stash, -//! ledger.total, -//! WithdrawReasons::all() -//! ); -//! // >::insert(controller, ledger); // Commented out as we don't have access to Staking's storage here. -//! } -//! # fn main() {} -//! ``` -//! -//! ## Genesis config -//! -//! The Balances pallet depends on the [`GenesisConfig`]. -//! -//! ## Assumptions -//! -//! * Total issued balanced of all accounts should be less than `Config::Balance::max_value()`. - -#![cfg_attr(not(feature = "std"), no_std)] - -mod benchmarking; -pub mod weights; - -pub use self::imbalances::{NegativeImbalance, PositiveImbalance}; -use codec::{Codec, Decode, Encode}; -#[cfg(feature = "std")] -use frame_support::traits::GenesisBuild; -use frame_support::{ - ensure, - traits::{ - tokens::{fungible, BalanceStatus as Status, DepositConsequence, WithdrawConsequence}, - Currency, ExistenceRequirement, - ExistenceRequirement::AllowDeath, - ExistenceRequirement::KeepAlive, - Get, Imbalance, LockIdentifier, LockableCurrency, OnUnbalanced, ReservableCurrency, SignedImbalance, StoredMap, - TryDrop, WithdrawReasons, - }, -}; -use frame_system as system; -use sp_runtime::{ - traits::{ - AtLeast32BitUnsigned, Bounded, CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Saturating, StaticLookup, - StoredMapError, Zero, - }, - DispatchError, DispatchResult, RuntimeDebug, -}; -use sp_std::prelude::*; -use sp_std::{cmp, fmt::Debug, mem, ops::BitOr, result}; -pub use weights::WeightInfo; - -pub use pallet::*; - -#[frame_support::pallet] -pub mod pallet { - use super::*; - use frame_support::pallet_prelude::*; - use frame_system::pallet_prelude::*; - - #[pallet::config] - pub trait Config: frame_system::Config { - /// The balance of an account. - type Balance: Parameter - + Member - + AtLeast32BitUnsigned - + Codec - + Default - + Copy - + MaybeSerializeDeserialize - + Debug; - - /// Handler for the unbalanced reduction when removing a dust account. - type DustRemoval: OnUnbalanced>; - - /// The overarching event type. - type Event: From> + IsType<::Event>; - - /// The minimum amount required to keep an account open. - #[pallet::constant] - type ExistentialDeposit: Get; - - /// The means of storing the balances of an account. - type AccountStore: StoredMap>; - - /// Weight information for extrinsics in this pallet. - type WeightInfo: WeightInfo; - - /// The maximum number of locks that should exist on an account. - /// Not strictly enforced, but used for weight estimation. - type MaxLocks: Get; - } - - #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] - pub struct Pallet(PhantomData<(T, I)>); - - #[pallet::hooks] - impl, I: 'static> Hooks> for Pallet {} - - #[pallet::call] - impl, I: 'static> Pallet { - /// Transfer some liquid free balance to another account. - /// - /// `transfer` will set the `FreeBalance` of the sender and receiver. - /// It will decrease the total issuance of the system by the `TransferFee`. - /// If the sender's account is below the existential deposit as a result - /// of the transfer, the account will be reaped. - /// - /// The dispatch origin for this call must be `Signed` by the transactor. - /// - /// # - /// - Dependent on arguments but not critical, given proper implementations for - /// input config types. See related functions below. - /// - It contains a limited number of reads and writes internally and no complex computation. - /// - /// Related functions: - /// - /// - `ensure_can_withdraw` is always called internally but has a bounded complexity. - /// - Transferring balances to accounts that did not exist before will cause - /// `T::OnNewAccount::on_new_account` to be called. - /// - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`. - /// - `transfer_keep_alive` works the same way as `transfer`, but has an additional - /// check that the transfer will not kill the origin account. - /// --------------------------------- - /// - Base Weight: 73.64 µs, worst case scenario (account created, account removed) - /// - DB Weight: 1 Read and 1 Write to destination account - /// - Origin account is already in memory, so no DB operations for them. - /// # - #[pallet::weight(T::WeightInfo::transfer())] - pub fn transfer( - origin: OriginFor, - dest: ::Source, - #[pallet::compact] value: T::Balance, - ) -> DispatchResultWithPostInfo { - ensure_root(origin.clone())?; - let transactor = ensure_signed(origin)?; - let dest = T::Lookup::lookup(dest)?; - >::transfer(&transactor, &dest, value, ExistenceRequirement::AllowDeath)?; - Ok(().into()) - } - - /// Set the balances of a given account. - /// - /// This will alter `FreeBalance` and `ReservedBalance` in storage. it will - /// also decrease the total issuance of the system (`TotalIssuance`). - /// If the new free or reserved balance is below the existential deposit, - /// it will reset the account nonce (`frame_system::AccountNonce`). - /// - /// The dispatch origin for this call is `root`. - /// - /// # - /// - Independent of the arguments. - /// - Contains a limited number of reads and writes. - /// --------------------- - /// - Base Weight: - /// - Creating: 27.56 µs - /// - Killing: 35.11 µs - /// - DB Weight: 1 Read, 1 Write to `who` - /// # - #[pallet::weight( - T::WeightInfo::set_balance_creating() // Creates a new account. - .max(T::WeightInfo::set_balance_killing()) // Kills an existing account. - )] - pub(super) fn set_balance( - origin: OriginFor, - who: ::Source, - #[pallet::compact] new_free: T::Balance, - #[pallet::compact] new_reserved: T::Balance, - ) -> DispatchResultWithPostInfo { - ensure_root(origin)?; - let who = T::Lookup::lookup(who)?; - let existential_deposit = T::ExistentialDeposit::get(); - - let wipeout = new_free + new_reserved < existential_deposit; - let new_free = if wipeout { Zero::zero() } else { new_free }; - let new_reserved = if wipeout { Zero::zero() } else { new_reserved }; - - let (free, reserved) = Self::mutate_account(&who, |account| { - if new_free > account.free { - mem::drop(PositiveImbalance::::new(new_free - account.free)); - } else if new_free < account.free { - mem::drop(NegativeImbalance::::new(account.free - new_free)); - } - - if new_reserved > account.reserved { - mem::drop(PositiveImbalance::::new(new_reserved - account.reserved)); - } else if new_reserved < account.reserved { - mem::drop(NegativeImbalance::::new(account.reserved - new_reserved)); - } - - account.free = new_free; - account.reserved = new_reserved; - - (account.free, account.reserved) - })?; - Self::deposit_event(Event::BalanceSet(who, free, reserved)); - Ok(().into()) - } - - /// Exactly as `transfer`, except the origin must be root and the source account may be - /// specified. - /// # - /// - Same as transfer, but additional read and write because the source account is - /// not assumed to be in the overlay. - /// # - #[pallet::weight(T::WeightInfo::force_transfer())] - pub fn force_transfer( - origin: OriginFor, - source: ::Source, - dest: ::Source, - #[pallet::compact] value: T::Balance, - ) -> DispatchResultWithPostInfo { - ensure_root(origin)?; - let source = T::Lookup::lookup(source)?; - let dest = T::Lookup::lookup(dest)?; - >::transfer(&source, &dest, value, ExistenceRequirement::AllowDeath)?; - Ok(().into()) - } - - /// Same as the [`transfer`] call, but with a check that the transfer will not kill the - /// origin account. - /// - /// 99% of the time you want [`transfer`] instead. - /// - /// [`transfer`]: struct.Pallet.html#method.transfer - /// # - /// - Cheaper than transfer because account cannot be killed. - /// - Base Weight: 51.4 µs - /// - DB Weight: 1 Read and 1 Write to dest (sender is in overlay already) - /// # - #[pallet::weight(T::WeightInfo::transfer_keep_alive())] - pub fn transfer_keep_alive( - origin: OriginFor, - dest: ::Source, - #[pallet::compact] value: T::Balance, - ) -> DispatchResultWithPostInfo { - ensure_root(origin.clone())?; - let transactor = ensure_signed(origin)?; - let dest = T::Lookup::lookup(dest)?; - >::transfer(&transactor, &dest, value, KeepAlive)?; - Ok(().into()) - } - } - - #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] - #[pallet::metadata(T::AccountId = "AccountId", T::Balance = "Balance")] - pub enum Event, I: 'static = ()> { - /// An account was created with some free balance. \[account, free_balance\] - Endowed(T::AccountId, T::Balance), - /// An account was removed whose balance was non-zero but below ExistentialDeposit, - /// resulting in an outright loss. \[account, balance\] - DustLost(T::AccountId, T::Balance), - /// Transfer succeeded. \[from, to, value\] - Transfer(T::AccountId, T::AccountId, T::Balance), - /// A balance was set by root. \[who, free, reserved\] - BalanceSet(T::AccountId, T::Balance, T::Balance), - /// Some amount was deposited (e.g. for transaction fees). \[who, deposit\] - Deposit(T::AccountId, T::Balance), - /// Some balance was reserved (moved from free to reserved). \[who, value\] - Reserved(T::AccountId, T::Balance), - /// Some balance was unreserved (moved from reserved to free). \[who, value\] - Unreserved(T::AccountId, T::Balance), - /// Some balance was moved from the reserve of the first account to the second account. - /// Final argument indicates the destination balance type. - /// \[from, to, balance, destination_status\] - ReserveRepatriated(T::AccountId, T::AccountId, T::Balance, Status), - } - - /// Old name generated by `decl_event`. - #[deprecated(note = "use `Event` instead")] - pub type RawEvent = Event; - - #[pallet::error] - pub enum Error { - /// Vesting balance too high to send value - VestingBalance, - /// Account liquidity restrictions prevent withdrawal - LiquidityRestrictions, - /// Got an overflow after adding - Overflow, - /// Balance too low to send value - InsufficientBalance, - /// Value too low to create account due to existential deposit - ExistentialDeposit, - /// Transfer/payment would kill account - KeepAlive, - /// A vesting schedule already exists for this account - ExistingVestingSchedule, - /// Beneficiary account must pre-exist - DeadAccount, - } - - /// The total units issued in the system. - #[pallet::storage] - #[pallet::getter(fn total_issuance)] - pub type TotalIssuance, I: 'static = ()> = StorageValue<_, T::Balance, ValueQuery>; - - /// The balance of an account. - /// - /// NOTE: This is only used in the case that this pallet is used to store balances. - #[pallet::storage] - pub type Account, I: 'static = ()> = - StorageMap<_, Blake2_128Concat, T::AccountId, AccountData, ValueQuery>; - - /// Any liquidity locks on some account balances. - /// NOTE: Should only be accessed when setting, changing and freeing a lock. - #[pallet::storage] - #[pallet::getter(fn locks)] - pub type Locks, I: 'static = ()> = - StorageMap<_, Blake2_128Concat, T::AccountId, Vec>, ValueQuery>; - - /// Storage version of the pallet. - /// - /// This is set to v2.0.0 for new networks. - #[pallet::storage] - pub(super) type StorageVersion, I: 'static = ()> = StorageValue<_, Releases, ValueQuery>; - - #[pallet::genesis_config] - pub struct GenesisConfig, I: 'static = ()> { - pub balances: Vec<(T::AccountId, T::Balance)>, - } - - #[cfg(feature = "std")] - impl, I: 'static> Default for GenesisConfig { - fn default() -> Self { - Self { - balances: Default::default(), - } - } - } - - #[pallet::genesis_build] - impl, I: 'static> GenesisBuild for GenesisConfig { - fn build(&self) { - let total = self - .balances - .iter() - .fold(Zero::zero(), |acc: T::Balance, &(_, n)| acc + n); - >::put(total); - - >::put(Releases::V2_0_0); - - for (_, balance) in &self.balances { - assert!( - *balance >= >::ExistentialDeposit::get(), - "the balance of any account should always be at least the existential deposit.", - ) - } - - // ensure no duplicates exist. - let endowed_accounts = self - .balances - .iter() - .map(|(x, _)| x) - .cloned() - .collect::>(); - - assert!( - endowed_accounts.len() == self.balances.len(), - "duplicate balances in genesis." - ); - - for &(ref who, free) in self.balances.iter() { - assert!(T::AccountStore::insert( - who, - AccountData { - free, - ..Default::default() - } - ) - .is_ok()); - } - } - } -} - -#[cfg(feature = "std")] -impl, I: 'static> GenesisConfig { - /// Direct implementation of `GenesisBuild::build_storage`. - /// - /// Kept in order not to break dependency. - pub fn build_storage(&self) -> Result { - >::build_storage(self) - } - - /// Direct implementation of `GenesisBuild::assimilate_storage`. - /// - /// Kept in order not to break dependency. - pub fn assimilate_storage(&self, storage: &mut sp_runtime::Storage) -> Result<(), String> { - >::assimilate_storage(self, storage) - } -} - -/// Simplified reasons for withdrawing balance. -#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)] -pub enum Reasons { - /// Paying system transaction fees. - Fee = 0, - /// Any reason other than paying system transaction fees. - Misc = 1, - /// Any reason at all. - All = 2, -} - -impl From for Reasons { - fn from(r: WithdrawReasons) -> Reasons { - if r == WithdrawReasons::from(WithdrawReasons::TRANSACTION_PAYMENT) { - Reasons::Fee - } else if r.contains(WithdrawReasons::TRANSACTION_PAYMENT) { - Reasons::All - } else { - Reasons::Misc - } - } -} - -impl BitOr for Reasons { - type Output = Reasons; - fn bitor(self, other: Reasons) -> Reasons { - if self == other { - return self; - } - Reasons::All - } -} - -/// A single lock on a balance. There can be many of these on an account and they "overlap", so the -/// same balance is frozen by multiple locks. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] -pub struct BalanceLock { - /// An identifier for this lock. Only one lock may be in existence for each identifier. - pub id: LockIdentifier, - /// The amount which the free balance may not drop below when this lock is in effect. - pub amount: Balance, - /// If true, then the lock remains in effect even for payment of transaction fees. - pub reasons: Reasons, -} - -/// All balance information for an account. -#[derive(Encode, Decode, Clone, PartialEq, Eq, Default, RuntimeDebug)] -pub struct AccountData { - /// Non-reserved part of the balance. There may still be restrictions on this, but it is the - /// total pool what may in principle be transferred, reserved and used for tipping. - /// - /// This is the only balance that matters in terms of most operations on tokens. It - /// alone is used to determine the balance when in the contract execution environment. - pub free: Balance, - /// Balance which is reserved and may not be used at all. - /// - /// This can still get slashed, but gets slashed last of all. - /// - /// This balance is a 'reserve' balance that other subsystems use in order to set aside tokens - /// that are still 'owned' by the account holder, but which are suspendable. - pub reserved: Balance, - /// The amount that `free` may not drop below when withdrawing for *anything except transaction - /// fee payment*. - pub misc_frozen: Balance, - /// The amount that `free` may not drop below when withdrawing specifically for transaction - /// fee payment. - pub fee_frozen: Balance, -} - -impl AccountData { - /// How much this account's balance can be reduced for the given `reasons`. - fn usable(&self, reasons: Reasons) -> Balance { - self.free.saturating_sub(self.frozen(reasons)) - } - /// The amount that this account's free balance may not be reduced beyond for the given - /// `reasons`. - fn frozen(&self, reasons: Reasons) -> Balance { - match reasons { - Reasons::All => self.misc_frozen.max(self.fee_frozen), - Reasons::Misc => self.misc_frozen, - Reasons::Fee => self.fee_frozen, - } - } - /// The total balance in this account including any that is reserved and ignoring any frozen. - fn total(&self) -> Balance { - self.free.saturating_add(self.reserved) - } -} - -// A value placed in storage that represents the current version of the Balances storage. -// This value is used by the `on_runtime_upgrade` logic to determine whether we run -// storage migration logic. This should match directly with the semantic versions of the Rust crate. -#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)] -enum Releases { - V1_0_0, - V2_0_0, -} - -impl Default for Releases { - fn default() -> Self { - Releases::V1_0_0 - } -} - -pub struct DustCleaner, I: 'static = ()>(Option<(T::AccountId, NegativeImbalance)>); - -impl, I: 'static> Drop for DustCleaner { - fn drop(&mut self) { - if let Some((who, dust)) = self.0.take() { - Pallet::::deposit_event(Event::DustLost(who, dust.peek())); - T::DustRemoval::on_unbalanced(dust); - } - } -} - -impl, I: 'static> Pallet { - /// Get the free balance of an account. - pub fn free_balance(who: impl sp_std::borrow::Borrow) -> T::Balance { - Self::account(who.borrow()).free - } - - /// Get the balance of an account that can be used for transfers, reservations, or any other - /// non-locking, non-transaction-fee activity. Will be at most `free_balance`. - pub fn usable_balance(who: impl sp_std::borrow::Borrow) -> T::Balance { - Self::account(who.borrow()).usable(Reasons::Misc) - } - - /// Get the balance of an account that can be used for paying transaction fees (not tipping, - /// or any other kind of fees, though). Will be at most `free_balance`. - pub fn usable_balance_for_fees(who: impl sp_std::borrow::Borrow) -> T::Balance { - Self::account(who.borrow()).usable(Reasons::Fee) - } - - /// Get the reserved balance of an account. - pub fn reserved_balance(who: impl sp_std::borrow::Borrow) -> T::Balance { - Self::account(who.borrow()).reserved - } - - /// Get both the free and reserved balances of an account. - fn account(who: &T::AccountId) -> AccountData { - T::AccountStore::get(&who) - } - - /// Handles any steps needed after mutating an account. - /// - /// This includes DustRemoval unbalancing, in the case than the `new` account's total balance - /// is non-zero but below ED. - /// - /// Returns two values: - /// - `Some` containing the the `new` account, iff the account has sufficient balance. - /// - `Some` containing the dust to be dropped, iff some dust should be dropped. - fn post_mutation( - _who: &T::AccountId, - new: AccountData, - ) -> (Option>, Option>) { - let total = new.total(); - if total < T::ExistentialDeposit::get() { - if total.is_zero() { - (None, None) - } else { - (None, Some(NegativeImbalance::new(total))) - } - } else { - (Some(new), None) - } - } - - fn deposit_consequence( - _who: &T::AccountId, - amount: T::Balance, - account: &AccountData, - ) -> DepositConsequence { - if amount.is_zero() { - return DepositConsequence::Success; - } - - if TotalIssuance::::get().checked_add(&amount).is_none() { - return DepositConsequence::Overflow; - } - - let new_total_balance = match account.total().checked_add(&amount) { - Some(x) => x, - None => return DepositConsequence::Overflow, - }; - - if new_total_balance < T::ExistentialDeposit::get() { - return DepositConsequence::BelowMinimum; - } - - // NOTE: We assume that we are a provider, so don't need to do any checks in the - // case of account creation. - - DepositConsequence::Success - } - - fn withdraw_consequence( - who: &T::AccountId, - amount: T::Balance, - account: &AccountData, - ) -> WithdrawConsequence { - if amount.is_zero() { - return WithdrawConsequence::Success; - } - - if TotalIssuance::::get().checked_sub(&amount).is_none() { - return WithdrawConsequence::Underflow; - } - - let new_total_balance = match account.total().checked_sub(&amount) { - Some(x) => x, - None => return WithdrawConsequence::NoFunds, - }; - - // Provider restriction - total account balance cannot be reduced to zero if it cannot - // sustain the loss of a provider reference. - // NOTE: This assumes that the pallet is a provider (which is true). Is this ever changes, - // then this will need to adapt accordingly. - let ed = T::ExistentialDeposit::get(); - let success = if new_total_balance < ed { - if frame_system::Pallet::::can_dec_provider(who) { - WithdrawConsequence::ReducedToZero(new_total_balance) - } else { - return WithdrawConsequence::WouldDie; - } - } else { - WithdrawConsequence::Success - }; - - // Enough free funds to have them be reduced. - let new_free_balance = match account.free.checked_sub(&amount) { - Some(b) => b, - None => return WithdrawConsequence::NoFunds, - }; - - // Eventual free funds must be no less than the frozen balance. - let min_balance = account.frozen(Reasons::All); - if new_free_balance < min_balance { - return WithdrawConsequence::Frozen; - } - - success - } - - /// Mutate an account to some new value, or delete it entirely with `None`. Will enforce - /// `ExistentialDeposit` law, annulling the account as needed. - /// - /// NOTE: Doesn't do any preparatory work for creating a new account, so should only be used - /// when it is known that the account already exists. - /// - /// NOTE: LOW-LEVEL: This will not attempt to maintain total issuance. It is expected that - /// the caller will do this. - pub fn mutate_account( - who: &T::AccountId, - f: impl FnOnce(&mut AccountData) -> R, - ) -> Result { - Self::try_mutate_account(who, |a, _| -> Result { Ok(f(a)) }) - } - - /// Mutate an account to some new value, or delete it entirely with `None`. Will enforce - /// `ExistentialDeposit` law, annulling the account as needed. This will do nothing if the - /// result of `f` is an `Err`. - /// - /// NOTE: Doesn't do any preparatory work for creating a new account, so should only be used - /// when it is known that the account already exists. - /// - /// NOTE: LOW-LEVEL: This will not attempt to maintain total issuance. It is expected that - /// the caller will do this. - fn try_mutate_account>( - who: &T::AccountId, - f: impl FnOnce(&mut AccountData, bool) -> Result, - ) -> Result { - Self::try_mutate_account_with_dust(who, f).map(|(result, dust_cleaner)| { - drop(dust_cleaner); - result - }) - } - - /// Mutate an account to some new value, or delete it entirely with `None`. Will enforce - /// `ExistentialDeposit` law, annulling the account as needed. This will do nothing if the - /// result of `f` is an `Err`. - /// - /// It returns both the result from the closure, and an optional `DustCleaner` instance which - /// should be dropped once it is known that all nested mutates that could affect storage items - /// what the dust handler touches have completed. - /// - /// NOTE: Doesn't do any preparatory work for creating a new account, so should only be used - /// when it is known that the account already exists. - /// - /// NOTE: LOW-LEVEL: This will not attempt to maintain total issuance. It is expected that - /// the caller will do this. - fn try_mutate_account_with_dust>( - who: &T::AccountId, - f: impl FnOnce(&mut AccountData, bool) -> Result, - ) -> Result<(R, DustCleaner), E> { - let result = T::AccountStore::try_mutate_exists(who, |maybe_account| { - let is_new = maybe_account.is_none(); - let mut account = maybe_account.take().unwrap_or_default(); - f(&mut account, is_new).map(move |result| { - let maybe_endowed = if is_new { Some(account.free) } else { None }; - let maybe_account_maybe_dust = Self::post_mutation(who, account); - *maybe_account = maybe_account_maybe_dust.0; - (maybe_endowed, maybe_account_maybe_dust.1, result) - }) - }); - result.map(|(maybe_endowed, maybe_dust, result)| { - if let Some(endowed) = maybe_endowed { - Self::deposit_event(Event::Endowed(who.clone(), endowed)); - } - let dust_cleaner = DustCleaner(maybe_dust.map(|dust| (who.clone(), dust))); - (result, dust_cleaner) - }) - } - - /// Update the account entry for `who`, given the locks. - fn update_locks(who: &T::AccountId, locks: &[BalanceLock]) { - if locks.len() as u32 > T::MaxLocks::get() { - log::warn!( - target: "runtime::balances", - "Warning: A user has more currency locks than expected. \ - A runtime configuration adjustment may be needed." - ); - } - // No way this can fail since we do not alter the existential balances. - let res = Self::mutate_account(who, |b| { - b.misc_frozen = Zero::zero(); - b.fee_frozen = Zero::zero(); - for l in locks.iter() { - if l.reasons == Reasons::All || l.reasons == Reasons::Misc { - b.misc_frozen = b.misc_frozen.max(l.amount); - } - if l.reasons == Reasons::All || l.reasons == Reasons::Fee { - b.fee_frozen = b.fee_frozen.max(l.amount); - } - } - }); - debug_assert!(res.is_ok()); - - let existed = Locks::::contains_key(who); - if locks.is_empty() { - Locks::::remove(who); - if existed { - // TODO: use Locks::::hashed_key - // https://github.com/paritytech/substrate/issues/4969 - system::Pallet::::dec_consumers(who); - } - } else { - Locks::::insert(who, locks); - if !existed { - if system::Pallet::::inc_consumers(who).is_err() { - // No providers for the locks. This is impossible under normal circumstances - // since the funds that are under the lock will themselves be stored in the - // account and therefore will need a reference. - log::warn!( - target: "runtime::balances", - "Warning: Attempt to introduce lock consumer reference, yet no providers. \ - This is unexpected but should be safe." - ); - } - } - } - } - - /// Move the reserved balance of one account into the balance of another, according to `status`. - /// - /// Is a no-op if: - /// - the value to be moved is zero; or - /// - the `slashed` id equal to `beneficiary` and the `status` is `Reserved`. - fn do_transfer_reserved( - slashed: &T::AccountId, - beneficiary: &T::AccountId, - value: T::Balance, - best_effort: bool, - status: Status, - ) -> Result { - if value.is_zero() { - return Ok(Zero::zero()); - } - - if slashed == beneficiary { - return match status { - Status::Free => Ok(Self::unreserve(slashed, value)), - Status::Reserved => Ok(value.saturating_sub(Self::reserved_balance(slashed))), - }; - } - - let ((actual, _maybe_one_dust), _maybe_other_dust) = Self::try_mutate_account_with_dust( - beneficiary, - |to_account, is_new| -> Result<(T::Balance, DustCleaner), DispatchError> { - ensure!(!is_new, Error::::DeadAccount); - Self::try_mutate_account_with_dust(slashed, |from_account, _| -> Result { - let actual = cmp::min(from_account.reserved, value); - ensure!(best_effort || actual == value, Error::::InsufficientBalance); - match status { - Status::Free => { - to_account.free = to_account.free.checked_add(&actual).ok_or(Error::::Overflow)? - } - Status::Reserved => { - to_account.reserved = to_account - .reserved - .checked_add(&actual) - .ok_or(Error::::Overflow)? - } - } - from_account.reserved -= actual; - Ok(actual) - }) - }, - )?; - - Self::deposit_event(Event::ReserveRepatriated( - slashed.clone(), - beneficiary.clone(), - actual, - status, - )); - Ok(actual) - } -} - -impl, I: 'static> fungible::Inspect for Pallet { - type Balance = T::Balance; - - fn total_issuance() -> Self::Balance { - TotalIssuance::::get() - } - fn minimum_balance() -> Self::Balance { - T::ExistentialDeposit::get() - } - fn balance(who: &T::AccountId) -> Self::Balance { - Self::account(who).total() - } - fn reducible_balance(who: &T::AccountId, keep_alive: bool) -> Self::Balance { - let a = Self::account(who); - // Liquid balance is what is neither reserved nor locked/frozen. - let liquid = a.free.saturating_sub(a.fee_frozen.max(a.misc_frozen)); - if frame_system::Pallet::::can_dec_provider(who) && !keep_alive { - liquid - } else { - // `must_remain_to_exist` is the part of liquid balance which must remain to keep total over - // ED. - let must_remain_to_exist = T::ExistentialDeposit::get().saturating_sub(a.total() - liquid); - liquid.saturating_sub(must_remain_to_exist) - } - } - fn can_deposit(who: &T::AccountId, amount: Self::Balance) -> DepositConsequence { - Self::deposit_consequence(who, amount, &Self::account(who)) - } - fn can_withdraw(who: &T::AccountId, amount: Self::Balance) -> WithdrawConsequence { - Self::withdraw_consequence(who, amount, &Self::account(who)) - } -} - -impl, I: 'static> fungible::Mutate for Pallet { - fn mint_into(who: &T::AccountId, amount: Self::Balance) -> DispatchResult { - if amount.is_zero() { - return Ok(()); - } - Self::try_mutate_account(who, |account, _is_new| -> DispatchResult { - Self::deposit_consequence(who, amount, &account).into_result()?; - account.free += amount; - Ok(()) - })?; - TotalIssuance::::mutate(|t| *t += amount); - Ok(()) - } - - fn burn_from(who: &T::AccountId, amount: Self::Balance) -> Result { - if amount.is_zero() { - return Ok(Self::Balance::zero()); - } - let actual = Self::try_mutate_account(who, |account, _is_new| -> Result { - let extra = Self::withdraw_consequence(who, amount, &account).into_result()?; - let actual = amount + extra; - account.free -= actual; - Ok(actual) - })?; - TotalIssuance::::mutate(|t| *t -= actual); - Ok(actual) - } -} - -impl, I: 'static> fungible::Transfer for Pallet { - fn transfer( - source: &T::AccountId, - dest: &T::AccountId, - amount: T::Balance, - keep_alive: bool, - ) -> Result { - let er = if keep_alive { KeepAlive } else { AllowDeath }; - >::transfer(source, dest, amount, er).map(|_| amount) - } -} - -impl, I: 'static> fungible::Unbalanced for Pallet { - fn set_balance(who: &T::AccountId, amount: Self::Balance) -> DispatchResult { - Self::mutate_account(who, |account| account.free = amount)?; - Ok(()) - } - - fn set_total_issuance(amount: Self::Balance) { - TotalIssuance::::mutate(|t| *t = amount); - } -} - -impl, I: 'static> fungible::InspectHold for Pallet { - fn balance_on_hold(who: &T::AccountId) -> T::Balance { - Self::account(who).reserved - } - fn can_hold(who: &T::AccountId, amount: T::Balance) -> bool { - let a = Self::account(who); - let min_balance = T::ExistentialDeposit::get().max(a.frozen(Reasons::All)); - if a.reserved.checked_add(&amount).is_none() { - return false; - } - // We require it to be min_balance + amount to ensure that the full reserved funds may be - // slashed without compromising locked funds or destroying the account. - let required_free = match min_balance.checked_add(&amount) { - Some(x) => x, - None => return false, - }; - a.free >= required_free - } -} -impl, I: 'static> fungible::MutateHold for Pallet { - fn hold(who: &T::AccountId, amount: Self::Balance) -> DispatchResult { - if amount.is_zero() { - return Ok(()); - } - ensure!(Self::can_reserve(who, amount), Error::::InsufficientBalance); - Self::mutate_account(who, |a| { - a.free -= amount; - a.reserved += amount; - })?; - Ok(()) - } - fn release(who: &T::AccountId, amount: Self::Balance, best_effort: bool) -> Result { - if amount.is_zero() { - return Ok(amount); - } - // Done on a best-effort basis. - Self::try_mutate_account(who, |a, _| { - let new_free = a.free.saturating_add(amount.min(a.reserved)); - let actual = new_free - a.free; - ensure!(best_effort || actual == amount, Error::::InsufficientBalance); - // ^^^ Guaranteed to be <= amount and <= a.reserved - a.free = new_free; - a.reserved = a.reserved.saturating_sub(actual.clone()); - Ok(actual) - }) - } - fn transfer_held( - source: &T::AccountId, - dest: &T::AccountId, - amount: Self::Balance, - best_effort: bool, - on_hold: bool, - ) -> Result { - let status = if on_hold { Status::Reserved } else { Status::Free }; - Self::do_transfer_reserved(source, dest, amount, best_effort, status) - } -} - -// wrapping these imbalances in a private module is necessary to ensure absolute privacy -// of the inner member. -mod imbalances { - use super::{result, Config, Imbalance, RuntimeDebug, Saturating, TryDrop, Zero}; - use frame_support::traits::SameOrOther; - use sp_std::mem; - - /// Opaque, move-only struct with private fields that serves as a token denoting that - /// funds have been created without any equal and opposite accounting. - #[must_use] - #[derive(RuntimeDebug, PartialEq, Eq)] - pub struct PositiveImbalance, I: 'static = ()>(T::Balance); - - impl, I: 'static> PositiveImbalance { - /// Create a new positive imbalance from a balance. - pub fn new(amount: T::Balance) -> Self { - PositiveImbalance(amount) - } - } - - /// Opaque, move-only struct with private fields that serves as a token denoting that - /// funds have been destroyed without any equal and opposite accounting. - #[must_use] - #[derive(RuntimeDebug, PartialEq, Eq)] - pub struct NegativeImbalance, I: 'static = ()>(T::Balance); - - impl, I: 'static> NegativeImbalance { - /// Create a new negative imbalance from a balance. - pub fn new(amount: T::Balance) -> Self { - NegativeImbalance(amount) - } - } - - impl, I: 'static> TryDrop for PositiveImbalance { - fn try_drop(self) -> result::Result<(), Self> { - self.drop_zero() - } - } - - impl, I: 'static> Default for PositiveImbalance { - fn default() -> Self { - Self::zero() - } - } - - impl, I: 'static> Imbalance for PositiveImbalance { - type Opposite = NegativeImbalance; - - fn zero() -> Self { - Self(Zero::zero()) - } - fn drop_zero(self) -> result::Result<(), Self> { - if self.0.is_zero() { - Ok(()) - } else { - Err(self) - } - } - fn split(self, amount: T::Balance) -> (Self, Self) { - let first = self.0.min(amount); - let second = self.0 - first; - - mem::forget(self); - (Self(first), Self(second)) - } - fn merge(mut self, other: Self) -> Self { - self.0 = self.0.saturating_add(other.0); - mem::forget(other); - - self - } - fn subsume(&mut self, other: Self) { - self.0 = self.0.saturating_add(other.0); - mem::forget(other); - } - fn offset(self, other: Self::Opposite) -> SameOrOther { - let (a, b) = (self.0, other.0); - mem::forget((self, other)); - - if a > b { - SameOrOther::Same(Self(a - b)) - } else if b > a { - SameOrOther::Other(NegativeImbalance::new(b - a)) - } else { - SameOrOther::None - } - } - fn peek(&self) -> T::Balance { - self.0.clone() - } - } - - impl, I: 'static> TryDrop for NegativeImbalance { - fn try_drop(self) -> result::Result<(), Self> { - self.drop_zero() - } - } - - impl, I: 'static> Default for NegativeImbalance { - fn default() -> Self { - Self::zero() - } - } - - impl, I: 'static> Imbalance for NegativeImbalance { - type Opposite = PositiveImbalance; - - fn zero() -> Self { - Self(Zero::zero()) - } - fn drop_zero(self) -> result::Result<(), Self> { - if self.0.is_zero() { - Ok(()) - } else { - Err(self) - } - } - fn split(self, amount: T::Balance) -> (Self, Self) { - let first = self.0.min(amount); - let second = self.0 - first; - - mem::forget(self); - (Self(first), Self(second)) - } - fn merge(mut self, other: Self) -> Self { - self.0 = self.0.saturating_add(other.0); - mem::forget(other); - - self - } - fn subsume(&mut self, other: Self) { - self.0 = self.0.saturating_add(other.0); - mem::forget(other); - } - fn offset(self, other: Self::Opposite) -> SameOrOther { - let (a, b) = (self.0, other.0); - mem::forget((self, other)); - - if a > b { - SameOrOther::Same(Self(a - b)) - } else if b > a { - SameOrOther::Other(PositiveImbalance::new(b - a)) - } else { - SameOrOther::None - } - } - fn peek(&self) -> T::Balance { - self.0.clone() - } - } - - impl, I: 'static> Drop for PositiveImbalance { - /// Basic drop handler will just square up the total issuance. - fn drop(&mut self) { - >::mutate(|v| *v = v.saturating_add(self.0)); - } - } - - impl, I: 'static> Drop for NegativeImbalance { - /// Basic drop handler will just square up the total issuance. - fn drop(&mut self) { - >::mutate(|v| *v = v.saturating_sub(self.0)); - } - } -} - -impl, I: 'static> Currency for Pallet -where - T::Balance: MaybeSerializeDeserialize + Debug, -{ - type Balance = T::Balance; - type PositiveImbalance = PositiveImbalance; - type NegativeImbalance = NegativeImbalance; - - fn total_balance(who: &T::AccountId) -> Self::Balance { - Self::account(who).total() - } - - // Check if `value` amount of free balance can be slashed from `who`. - fn can_slash(who: &T::AccountId, value: Self::Balance) -> bool { - if value.is_zero() { - return true; - } - Self::free_balance(who) >= value - } - - fn total_issuance() -> Self::Balance { - >::get() - } - - fn minimum_balance() -> Self::Balance { - T::ExistentialDeposit::get() - } - - // Burn funds from the total issuance, returning a positive imbalance for the amount burned. - // Is a no-op if amount to be burned is zero. - fn burn(mut amount: Self::Balance) -> Self::PositiveImbalance { - if amount.is_zero() { - return PositiveImbalance::zero(); - } - >::mutate(|issued| { - *issued = issued.checked_sub(&amount).unwrap_or_else(|| { - amount = *issued; - Zero::zero() - }); - }); - PositiveImbalance::new(amount) - } - - // Create new funds into the total issuance, returning a negative imbalance - // for the amount issued. - // Is a no-op if amount to be issued it zero. - fn issue(mut amount: Self::Balance) -> Self::NegativeImbalance { - if amount.is_zero() { - return NegativeImbalance::zero(); - } - >::mutate(|issued| { - *issued = issued.checked_add(&amount).unwrap_or_else(|| { - amount = Self::Balance::max_value() - *issued; - Self::Balance::max_value() - }) - }); - NegativeImbalance::new(amount) - } - - fn free_balance(who: &T::AccountId) -> Self::Balance { - Self::account(who).free - } - - // Ensure that an account can withdraw from their free balance given any existing withdrawal - // restrictions like locks and vesting balance. - // Is a no-op if amount to be withdrawn is zero. - // - // # - // Despite iterating over a list of locks, they are limited by the number of - // lock IDs, which means the number of runtime pallets that intend to use and create locks. - // # - fn ensure_can_withdraw( - who: &T::AccountId, - amount: T::Balance, - reasons: WithdrawReasons, - new_balance: T::Balance, - ) -> DispatchResult { - if amount.is_zero() { - return Ok(()); - } - let min_balance = Self::account(who).frozen(reasons.into()); - ensure!(new_balance >= min_balance, Error::::LiquidityRestrictions); - Ok(()) - } - - // Transfer some free balance from `transactor` to `dest`, respecting existence requirements. - // Is a no-op if value to be transferred is zero or the `transactor` is the same as `dest`. - fn transfer( - transactor: &T::AccountId, - dest: &T::AccountId, - value: Self::Balance, - existence_requirement: ExistenceRequirement, - ) -> DispatchResult { - if value.is_zero() || transactor == dest { - return Ok(()); - } - - Self::try_mutate_account_with_dust(dest, |to_account, _| -> Result, DispatchError> { - Self::try_mutate_account_with_dust(transactor, |from_account, _| -> DispatchResult { - from_account.free = from_account - .free - .checked_sub(&value) - .ok_or(Error::::InsufficientBalance)?; - - // NOTE: total stake being stored in the same type means that this could never overflow - // but better to be safe than sorry. - to_account.free = to_account.free.checked_add(&value).ok_or(Error::::Overflow)?; - - let ed = T::ExistentialDeposit::get(); - ensure!(to_account.total() >= ed, Error::::ExistentialDeposit); - - Self::ensure_can_withdraw(transactor, value, WithdrawReasons::TRANSFER, from_account.free) - .map_err(|_| Error::::LiquidityRestrictions)?; - - // TODO: This is over-conservative. There may now be other providers, and this pallet - // may not even be a provider. - let allow_death = existence_requirement == ExistenceRequirement::AllowDeath; - let allow_death = allow_death && !system::Pallet::::is_provider_required(transactor); - ensure!(allow_death || from_account.total() >= ed, Error::::KeepAlive); - - Ok(()) - }) - .map(|(_, maybe_dust_cleaner)| maybe_dust_cleaner) - })?; - - // Emit transfer event. - Self::deposit_event(Event::Transfer(transactor.clone(), dest.clone(), value)); - - Ok(()) - } - - /// Slash a target account `who`, returning the negative imbalance created and any left over - /// amount that could not be slashed. - /// - /// Is a no-op if `value` to be slashed is zero or the account does not exist. - /// - /// NOTE: `slash()` prefers free balance, but assumes that reserve balance can be drawn - /// from in extreme circumstances. `can_slash()` should be used prior to `slash()` to avoid having - /// to draw from reserved funds, however we err on the side of punishment if things are inconsistent - /// or `can_slash` wasn't used appropriately. - fn slash(who: &T::AccountId, value: Self::Balance) -> (Self::NegativeImbalance, Self::Balance) { - if value.is_zero() { - return (NegativeImbalance::zero(), Zero::zero()); - } - if Self::total_balance(&who).is_zero() { - return (NegativeImbalance::zero(), value); - } - - for attempt in 0..2 { - match Self::try_mutate_account( - who, - |account, _is_new| -> Result<(Self::NegativeImbalance, Self::Balance), StoredMapError> { - // Best value is the most amount we can slash following liveness rules. - let best_value = match attempt { - // First attempt we try to slash the full amount, and see if liveness issues happen. - 0 => value, - // If acting as a critical provider (i.e. first attempt failed), then slash - // as much as possible while leaving at least at ED. - _ => value.min((account.free + account.reserved).saturating_sub(T::ExistentialDeposit::get())), - }; - - let free_slash = cmp::min(account.free, best_value); - account.free -= free_slash; // Safe because of above check - let remaining_slash = best_value - free_slash; // Safe because of above check - - if !remaining_slash.is_zero() { - // If we have remaining slash, take it from reserved balance. - let reserved_slash = cmp::min(account.reserved, remaining_slash); - account.reserved -= reserved_slash; // Safe because of above check - Ok(( - NegativeImbalance::new(free_slash + reserved_slash), - value - free_slash - reserved_slash, // Safe because value is gt or eq total slashed - )) - } else { - // Else we are done! - Ok(( - NegativeImbalance::new(free_slash), - value - free_slash, // Safe because value is gt or eq to total slashed - )) - } - }, - ) { - Ok(r) => return r, - Err(_) => (), - } - } - - // Should never get here. But we'll be defensive anyway. - (Self::NegativeImbalance::zero(), value) - } - - /// Deposit some `value` into the free balance of an existing target account `who`. - /// - /// Is a no-op if the `value` to be deposited is zero. - fn deposit_into_existing( - who: &T::AccountId, - value: Self::Balance, - ) -> Result { - if value.is_zero() { - return Ok(PositiveImbalance::zero()); - } - - Self::try_mutate_account( - who, - |account, is_new| -> Result { - ensure!(!is_new, Error::::DeadAccount); - account.free = account.free.checked_add(&value).ok_or(Error::::Overflow)?; - Ok(PositiveImbalance::new(value)) - }, - ) - } - - /// Deposit some `value` into the free balance of `who`, possibly creating a new account. - /// - /// This function is a no-op if: - /// - the `value` to be deposited is zero; or - /// - the `value` to be deposited is less than the required ED and the account does not yet exist; or - /// - the deposit would necessitate the account to exist and there are no provider references; or - /// - `value` is so large it would cause the balance of `who` to overflow. - fn deposit_creating(who: &T::AccountId, value: Self::Balance) -> Self::PositiveImbalance { - if value.is_zero() { - return Self::PositiveImbalance::zero(); - } - - let r = Self::try_mutate_account( - who, - |account, is_new| -> Result { - let ed = T::ExistentialDeposit::get(); - ensure!(value >= ed || !is_new, Error::::ExistentialDeposit); - - // defensive only: overflow should never happen, however in case it does, then this - // operation is a no-op. - account.free = match account.free.checked_add(&value) { - Some(x) => x, - None => return Ok(Self::PositiveImbalance::zero()), - }; - - Ok(PositiveImbalance::new(value)) - }, - ) - .unwrap_or_else(|_| Self::PositiveImbalance::zero()); - - r - } - - /// Withdraw some free balance from an account, respecting existence requirements. - /// - /// Is a no-op if value to be withdrawn is zero. - fn withdraw( - who: &T::AccountId, - value: Self::Balance, - reasons: WithdrawReasons, - liveness: ExistenceRequirement, - ) -> result::Result { - if value.is_zero() { - return Ok(NegativeImbalance::zero()); - } - - Self::try_mutate_account(who, |account, _| -> Result { - let new_free_account = account - .free - .checked_sub(&value) - .ok_or(Error::::InsufficientBalance)?; - - // bail if we need to keep the account alive and this would kill it. - let ed = T::ExistentialDeposit::get(); - let would_be_dead = new_free_account + account.reserved < ed; - let would_kill = would_be_dead && account.free + account.reserved >= ed; - ensure!(liveness == AllowDeath || !would_kill, Error::::KeepAlive); - - Self::ensure_can_withdraw(who, value, reasons, new_free_account)?; - - account.free = new_free_account; - - Ok(NegativeImbalance::new(value)) - }) - } - - /// Force the new free balance of a target account `who` to some new value `balance`. - fn make_free_balance_be( - who: &T::AccountId, - value: Self::Balance, - ) -> SignedImbalance { - Self::try_mutate_account( - who, - |account, is_new| -> Result, DispatchError> { - let ed = T::ExistentialDeposit::get(); - let total = value.saturating_add(account.reserved); - // If we're attempting to set an existing account to less than ED, then - // bypass the entire operation. It's a no-op if you follow it through, but - // since this is an instance where we might account for a negative imbalance - // (in the dust cleaner of set_account) before we account for its actual - // equal and opposite cause (returned as an Imbalance), then in the - // instance that there's no other accounts on the system at all, we might - // underflow the issuance and our arithmetic will be off. - ensure!(total >= ed || !is_new, Error::::ExistentialDeposit); - - let imbalance = if account.free <= value { - SignedImbalance::Positive(PositiveImbalance::new(value - account.free)) - } else { - SignedImbalance::Negative(NegativeImbalance::new(account.free - value)) - }; - account.free = value; - Ok(imbalance) - }, - ) - .unwrap_or_else(|_| SignedImbalance::Positive(Self::PositiveImbalance::zero())) - } -} - -impl, I: 'static> ReservableCurrency for Pallet -where - T::Balance: MaybeSerializeDeserialize + Debug, -{ - /// Check if `who` can reserve `value` from their free balance. - /// - /// Always `true` if value to be reserved is zero. - fn can_reserve(who: &T::AccountId, value: Self::Balance) -> bool { - if value.is_zero() { - return true; - } - Self::account(who) - .free - .checked_sub(&value) - .map_or(false, |new_balance| { - Self::ensure_can_withdraw(who, value, WithdrawReasons::RESERVE, new_balance).is_ok() - }) - } - - fn reserved_balance(who: &T::AccountId) -> Self::Balance { - Self::account(who).reserved - } - - /// Move `value` from the free balance from `who` to their reserved balance. - /// - /// Is a no-op if value to be reserved is zero. - fn reserve(who: &T::AccountId, value: Self::Balance) -> DispatchResult { - if value.is_zero() { - return Ok(()); - } - - Self::try_mutate_account(who, |account, _| -> DispatchResult { - account.free = account - .free - .checked_sub(&value) - .ok_or(Error::::InsufficientBalance)?; - account.reserved = account.reserved.checked_add(&value).ok_or(Error::::Overflow)?; - Self::ensure_can_withdraw(&who, value.clone(), WithdrawReasons::RESERVE, account.free) - })?; - - Self::deposit_event(Event::Reserved(who.clone(), value)); - Ok(()) - } - - /// Unreserve some funds, returning any amount that was unable to be unreserved. - /// - /// Is a no-op if the value to be unreserved is zero or the account does not exist. - fn unreserve(who: &T::AccountId, value: Self::Balance) -> Self::Balance { - if value.is_zero() { - return Zero::zero(); - } - if Self::total_balance(&who).is_zero() { - return value; - } - - let actual = match Self::mutate_account(who, |account| { - let actual = cmp::min(account.reserved, value); - account.reserved -= actual; - // defensive only: this can never fail since total issuance which is at least free+reserved - // fits into the same data type. - account.free = account.free.saturating_add(actual); - actual - }) { - Ok(x) => x, - Err(_) => { - // This should never happen since we don't alter the total amount in the account. - // If it ever does, then we should fail gracefully though, indicating that nothing - // could be done. - return value; - } - }; - - Self::deposit_event(Event::Unreserved(who.clone(), actual.clone())); - value - actual - } - - /// Slash from reserved balance, returning the negative imbalance created, - /// and any amount that was unable to be slashed. - /// - /// Is a no-op if the value to be slashed is zero or the account does not exist. - fn slash_reserved(who: &T::AccountId, value: Self::Balance) -> (Self::NegativeImbalance, Self::Balance) { - if value.is_zero() { - return (NegativeImbalance::zero(), Zero::zero()); - } - if Self::total_balance(&who).is_zero() { - return (NegativeImbalance::zero(), value); - } - - // NOTE: `mutate_account` may fail if it attempts to reduce the balance to the point that an - // account is attempted to be illegally destroyed. - - for attempt in 0..2 { - match Self::mutate_account(who, |account| { - let best_value = match attempt { - 0 => value, - // If acting as a critical provider (i.e. first attempt failed), then ensure - // slash leaves at least the ED. - _ => value.min((account.free + account.reserved).saturating_sub(T::ExistentialDeposit::get())), - }; - - let actual = cmp::min(account.reserved, best_value); - account.reserved -= actual; - - // underflow should never happen, but it if does, there's nothing to be done here. - (NegativeImbalance::new(actual), value - actual) - }) { - Ok(r) => return r, - Err(_) => (), - } - } - // Should never get here as we ensure that ED is left in the second attempt. - // In case we do, though, then we fail gracefully. - (Self::NegativeImbalance::zero(), value) - } - - /// Move the reserved balance of one account into the balance of another, according to `status`. - /// - /// Is a no-op if: - /// - the value to be moved is zero; or - /// - the `slashed` id equal to `beneficiary` and the `status` is `Reserved`. - fn repatriate_reserved( - slashed: &T::AccountId, - beneficiary: &T::AccountId, - value: Self::Balance, - status: Status, - ) -> Result { - let actual = Self::do_transfer_reserved(slashed, beneficiary, value, true, status)?; - Ok(value.saturating_sub(actual)) - } -} - -impl, I: 'static> LockableCurrency for Pallet -where - T::Balance: MaybeSerializeDeserialize + Debug, -{ - type Moment = T::BlockNumber; - - type MaxLocks = T::MaxLocks; - - // Set a lock on the balance of `who`. - // Is a no-op if lock amount is zero or `reasons` `is_none()`. - fn set_lock(id: LockIdentifier, who: &T::AccountId, amount: T::Balance, reasons: WithdrawReasons) { - if amount.is_zero() || reasons.is_empty() { - return; - } - let mut new_lock = Some(BalanceLock { - id, - amount, - reasons: reasons.into(), - }); - let mut locks = Self::locks(who) - .into_iter() - .filter_map(|l| if l.id == id { new_lock.take() } else { Some(l) }) - .collect::>(); - if let Some(lock) = new_lock { - locks.push(lock) - } - Self::update_locks(who, &locks[..]); - } - - // Extend a lock on the balance of `who`. - // Is a no-op if lock amount is zero or `reasons` `is_none()`. - fn extend_lock(id: LockIdentifier, who: &T::AccountId, amount: T::Balance, reasons: WithdrawReasons) { - if amount.is_zero() || reasons.is_empty() { - return; - } - let mut new_lock = Some(BalanceLock { - id, - amount, - reasons: reasons.into(), - }); - let mut locks = Self::locks(who) - .into_iter() - .filter_map(|l| { - if l.id == id { - new_lock.take().map(|nl| BalanceLock { - id: l.id, - amount: l.amount.max(nl.amount), - reasons: l.reasons | nl.reasons, - }) - } else { - Some(l) - } - }) - .collect::>(); - if let Some(lock) = new_lock { - locks.push(lock) - } - Self::update_locks(who, &locks[..]); - } - - fn remove_lock(id: LockIdentifier, who: &T::AccountId) { - let mut locks = Self::locks(who); - locks.retain(|l| l.id != id); - Self::update_locks(who, &locks[..]); - } -} diff --git a/pallets/balances/src/tests.rs b/pallets/balances/src/tests.rs deleted file mode 100644 index 776cda140..000000000 --- a/pallets/balances/src/tests.rs +++ /dev/null @@ -1,978 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Macro for creating the tests for the module. - -#![cfg(test)] - -#[macro_export] -macro_rules! decl_tests { - ($test:ty, $ext_builder:ty, $existential_deposit:expr) => { - - use crate::*; - use sp_runtime::{FixedPointNumber, traits::{SignedExtension, BadOrigin}}; - use frame_support::{ - assert_noop, assert_storage_noop, assert_ok, assert_err, StorageValue, - traits::{ - LockableCurrency, LockIdentifier, WithdrawReasons, - Currency, ReservableCurrency, ExistenceRequirement::AllowDeath - } - }; - use pallet_transaction_payment::{ChargeTransactionPayment, Multiplier}; - use frame_system::RawOrigin; - - const ID_1: LockIdentifier = *b"1 "; - const ID_2: LockIdentifier = *b"2 "; - - pub const CALL: &<$test as frame_system::Config>::Call = - &Call::Balances(pallet_balances::Call::transfer(0, 0)); - - /// create a transaction info struct from weight. Handy to avoid building the whole struct. - pub fn info_from_weight(w: Weight) -> DispatchInfo { - DispatchInfo { weight: w, ..Default::default() } - } - - fn events() -> Vec { - let evt = System::events().into_iter().map(|evt| evt.event).collect::>(); - - System::reset_events(); - - evt - } - - fn last_event() -> Event { - system::Module::::events().pop().expect("Event expected").event - } - - #[test] - fn basic_locking_should_work() { - <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { - assert_eq!(Balances::free_balance(1), 10); - Balances::set_lock(ID_1, &1, 9, WithdrawReasons::all()); - assert_noop!( - >::transfer(&1, &2, 5, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - }); - } - - #[test] - fn account_should_be_reaped() { - <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { - assert_eq!(Balances::free_balance(1), 10); - assert_ok!(>::transfer(&1, &2, 10, AllowDeath)); - // Check that the account is dead. - assert!(!frame_system::Account::::contains_key(&1)); - }); - } - - #[test] - fn partial_locking_should_work() { - <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { - Balances::set_lock(ID_1, &1, 5, WithdrawReasons::all()); - assert_ok!(>::transfer(&1, &2, 1, AllowDeath)); - }); - } - - #[test] - fn lock_removal_should_work() { - <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { - Balances::set_lock(ID_1, &1, u64::max_value(), WithdrawReasons::all()); - Balances::remove_lock(ID_1, &1); - assert_ok!(>::transfer(&1, &2, 1, AllowDeath)); - }); - } - - #[test] - fn lock_replacement_should_work() { - <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { - Balances::set_lock(ID_1, &1, u64::max_value(), WithdrawReasons::all()); - Balances::set_lock(ID_1, &1, 5, WithdrawReasons::all()); - assert_ok!(>::transfer(&1, &2, 1, AllowDeath)); - }); - } - - #[test] - fn double_locking_should_work() { - <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { - Balances::set_lock(ID_1, &1, 5, WithdrawReasons::all()); - Balances::set_lock(ID_2, &1, 5, WithdrawReasons::all()); - assert_ok!(>::transfer(&1, &2, 1, AllowDeath)); - }); - } - - #[test] - fn combination_locking_should_work() { - <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { - Balances::set_lock(ID_1, &1, u64::max_value(), WithdrawReasons::empty()); - Balances::set_lock(ID_2, &1, 0, WithdrawReasons::all()); - assert_ok!(>::transfer(&1, &2, 1, AllowDeath)); - }); - } - - #[test] - fn lock_value_extension_should_work() { - <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { - Balances::set_lock(ID_1, &1, 5, WithdrawReasons::all()); - assert_noop!( - >::transfer(&1, &2, 6, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - Balances::extend_lock(ID_1, &1, 2, WithdrawReasons::all()); - assert_noop!( - >::transfer(&1, &2, 6, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - Balances::extend_lock(ID_1, &1, 8, WithdrawReasons::all()); - assert_noop!( - >::transfer(&1, &2, 3, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - }); - } - - #[test] - fn lock_reasons_should_work() { - <$ext_builder>::default() - .existential_deposit(1) - .monied(true) - .build() - .execute_with(|| { - pallet_transaction_payment::NextFeeMultiplier::put(Multiplier::saturating_from_integer(1)); - Balances::set_lock(ID_1, &1, 10, WithdrawReasons::RESERVE); - assert_noop!( - >::transfer(&1, &2, 1, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - assert_noop!( - >::reserve(&1, 1), - Error::<$test, _>::LiquidityRestrictions, - ); - assert!( as SignedExtension>::pre_dispatch( - ChargeTransactionPayment::from(1), - &1, - CALL, - &info_from_weight(1), - 1, - ).is_err()); - assert!( as SignedExtension>::pre_dispatch( - ChargeTransactionPayment::from(0), - &1, - CALL, - &info_from_weight(1), - 1, - ).is_ok()); - - Balances::set_lock(ID_1, &1, 10, WithdrawReasons::TRANSACTION_PAYMENT); - assert_ok!(>::transfer(&1, &2, 1, AllowDeath)); - assert_ok!(>::reserve(&1, 1)); - assert!( as SignedExtension>::pre_dispatch( - ChargeTransactionPayment::from(1), - &1, - CALL, - &info_from_weight(1), - 1, - ).is_err()); - assert!( as SignedExtension>::pre_dispatch( - ChargeTransactionPayment::from(0), - &1, - CALL, - &info_from_weight(1), - 1, - ).is_err()); - }); - } - - #[test] - fn lock_block_number_extension_should_work() { - <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { - Balances::set_lock(ID_1, &1, 10, WithdrawReasons::all()); - assert_noop!( - >::transfer(&1, &2, 6, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - Balances::extend_lock(ID_1, &1, 10, WithdrawReasons::all()); - assert_noop!( - >::transfer(&1, &2, 6, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - System::set_block_number(2); - Balances::extend_lock(ID_1, &1, 10, WithdrawReasons::all()); - assert_noop!( - >::transfer(&1, &2, 3, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - }); - } - - #[test] - fn lock_reasons_extension_should_work() { - <$ext_builder>::default().existential_deposit(1).monied(true).build().execute_with(|| { - Balances::set_lock(ID_1, &1, 10, WithdrawReasons::TRANSFER); - assert_noop!( - >::transfer(&1, &2, 6, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - Balances::extend_lock(ID_1, &1, 10, WithdrawReasons::empty()); - assert_noop!( - >::transfer(&1, &2, 6, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - Balances::extend_lock(ID_1, &1, 10, WithdrawReasons::RESERVE); - assert_noop!( - >::transfer(&1, &2, 6, AllowDeath), - Error::<$test, _>::LiquidityRestrictions - ); - }); - } - - #[test] - fn default_indexing_on_new_accounts_should_not_work2() { - <$ext_builder>::default() - .existential_deposit(10) - .monied(true) - .build() - .execute_with(|| { - // account 5 should not exist - // ext_deposit is 10, value is 9, not satisfies for ext_deposit - assert_noop!( - Balances::transfer(Some(1).into(), 5, 9), - Error::<$test, _>::ExistentialDeposit, - ); - assert_eq!(Balances::free_balance(1), 100); - }); - } - - #[test] - fn reserved_balance_should_prevent_reclaim_count() { - <$ext_builder>::default() - .existential_deposit(256 * 1) - .monied(true) - .build() - .execute_with(|| { - System::inc_account_nonce(&2); - assert_eq!(Balances::total_balance(&2), 256 * 20); - - assert_ok!(Balances::reserve(&2, 256 * 19 + 1)); // account 2 becomes mostly reserved - assert_eq!(Balances::free_balance(2), 255); // "free" account deleted." - assert_eq!(Balances::total_balance(&2), 256 * 20); // reserve still exists. - assert_eq!(System::account_nonce(&2), 1); - - // account 4 tries to take index 1 for account 5. - assert_ok!(Balances::transfer(Some(4).into(), 5, 256 * 1 + 0x69)); - assert_eq!(Balances::total_balance(&5), 256 * 1 + 0x69); - - assert!(Balances::slash(&2, 256 * 19 + 2).1.is_zero()); // account 2 gets slashed - // "reserve" account reduced to 255 (below ED) so account deleted - assert_eq!(Balances::total_balance(&2), 0); - assert_eq!(System::account_nonce(&2), 0); // nonce zero - - // account 4 tries to take index 1 again for account 6. - assert_ok!(Balances::transfer(Some(4).into(), 6, 256 * 1 + 0x69)); - assert_eq!(Balances::total_balance(&6), 256 * 1 + 0x69); - }); - } - - #[test] - fn reward_should_work() { - <$ext_builder>::default().monied(true).build().execute_with(|| { - assert_eq!(Balances::total_balance(&1), 10); - assert_ok!(Balances::deposit_into_existing(&1, 10).map(drop)); - assert_eq!(Balances::total_balance(&1), 20); - assert_eq!(>::get(), 120); - }); - } - - #[test] - fn dust_account_removal_should_work() { - <$ext_builder>::default() - .existential_deposit(100) - .monied(true) - .build() - .execute_with(|| { - System::inc_account_nonce(&2); - assert_eq!(System::account_nonce(&2), 1); - assert_eq!(Balances::total_balance(&2), 2000); - // index 1 (account 2) becomes zombie - assert_ok!(Balances::transfer(Some(2).into(), 5, 1901)); - assert_eq!(Balances::total_balance(&2), 0); - assert_eq!(Balances::total_balance(&5), 1901); - assert_eq!(System::account_nonce(&2), 0); - }); - } - - #[test] - fn balance_works() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 42); - assert_eq!(Balances::free_balance(1), 42); - assert_eq!(Balances::reserved_balance(1), 0); - assert_eq!(Balances::total_balance(&1), 42); - assert_eq!(Balances::free_balance(2), 0); - assert_eq!(Balances::reserved_balance(2), 0); - assert_eq!(Balances::total_balance(&2), 0); - }); - } - - #[test] - fn balance_transfer_works() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 111); - assert_ok!(Balances::transfer(Some(1).into(), 2, 69)); - assert_eq!(Balances::total_balance(&1), 42); - assert_eq!(Balances::total_balance(&2), 69); - }); - } - - #[test] - fn force_transfer_works() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 111); - assert_noop!( - Balances::force_transfer(Some(2).into(), 1, 2, 69), - BadOrigin, - ); - assert_ok!(Balances::force_transfer(RawOrigin::Root.into(), 1, 2, 69)); - assert_eq!(Balances::total_balance(&1), 42); - assert_eq!(Balances::total_balance(&2), 69); - }); - } - - #[test] - fn reserving_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 111); - - assert_eq!(Balances::total_balance(&1), 111); - assert_eq!(Balances::free_balance(1), 111); - assert_eq!(Balances::reserved_balance(1), 0); - - assert_ok!(Balances::reserve(&1, 69)); - - assert_eq!(Balances::total_balance(&1), 111); - assert_eq!(Balances::free_balance(1), 42); - assert_eq!(Balances::reserved_balance(1), 69); - }); - } - - #[test] - fn balance_transfer_when_reserved_should_not_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 111); - assert_ok!(Balances::reserve(&1, 69)); - assert_noop!( - Balances::transfer(Some(1).into(), 2, 69), - Error::<$test, _>::InsufficientBalance, - ); - }); - } - - #[test] - fn deducting_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 111); - assert_ok!(Balances::reserve(&1, 69)); - assert_eq!(Balances::free_balance(1), 42); - }); - } - - #[test] - fn refunding_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 42); - assert!(Balances::mutate_account(&1, |a| a.reserved = 69).is_ok()); - Balances::unreserve(&1, 69); - assert_eq!(Balances::free_balance(1), 111); - assert_eq!(Balances::reserved_balance(1), 0); - }); - } - - #[test] - fn slashing_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 111); - assert_ok!(Balances::reserve(&1, 69)); - assert!(Balances::slash(&1, 69).1.is_zero()); - assert_eq!(Balances::free_balance(1), 0); - assert_eq!(Balances::reserved_balance(1), 42); - assert_eq!(>::get(), 42); - }); - } - - #[test] - fn slashing_incomplete_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 42); - assert_ok!(Balances::reserve(&1, 21)); - assert_eq!(Balances::slash(&1, 69).1, 27); - assert_eq!(Balances::free_balance(1), 0); - assert_eq!(Balances::reserved_balance(1), 0); - assert_eq!(>::get(), 0); - }); - } - - #[test] - fn unreserving_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 111); - assert_ok!(Balances::reserve(&1, 111)); - Balances::unreserve(&1, 42); - assert_eq!(Balances::reserved_balance(1), 69); - assert_eq!(Balances::free_balance(1), 42); - }); - } - - #[test] - fn slashing_reserved_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 111); - assert_ok!(Balances::reserve(&1, 111)); - assert_eq!(Balances::slash_reserved(&1, 42).1, 0); - assert_eq!(Balances::reserved_balance(1), 69); - assert_eq!(Balances::free_balance(1), 0); - assert_eq!(>::get(), 69); - }); - } - - #[test] - fn slashing_incomplete_reserved_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 111); - assert_ok!(Balances::reserve(&1, 42)); - assert_eq!(Balances::slash_reserved(&1, 69).1, 27); - assert_eq!(Balances::free_balance(1), 69); - assert_eq!(Balances::reserved_balance(1), 0); - assert_eq!(>::get(), 69); - }); - } - - #[test] - fn repatriating_reserved_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 110); - let _ = Balances::deposit_creating(&2, 1); - assert_ok!(Balances::reserve(&1, 110)); - assert_ok!(Balances::repatriate_reserved(&1, &2, 41, Status::Free), 0); - assert_eq!( - last_event(), - Event::pallet_balances(crate::Event::ReserveRepatriated(1, 2, 41, Status::Free)), - ); - assert_eq!(Balances::reserved_balance(1), 69); - assert_eq!(Balances::free_balance(1), 0); - assert_eq!(Balances::reserved_balance(2), 0); - assert_eq!(Balances::free_balance(2), 42); - }); - } - - #[test] - fn transferring_reserved_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 110); - let _ = Balances::deposit_creating(&2, 1); - assert_ok!(Balances::reserve(&1, 110)); - assert_ok!(Balances::repatriate_reserved(&1, &2, 41, Status::Reserved), 0); - assert_eq!(Balances::reserved_balance(1), 69); - assert_eq!(Balances::free_balance(1), 0); - assert_eq!(Balances::reserved_balance(2), 41); - assert_eq!(Balances::free_balance(2), 1); - }); - } - - #[test] - fn transferring_reserved_balance_to_nonexistent_should_fail() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 111); - assert_ok!(Balances::reserve(&1, 111)); - assert_noop!(Balances::repatriate_reserved(&1, &2, 42, Status::Free), Error::<$test, _>::DeadAccount); - }); - } - - #[test] - fn transferring_incomplete_reserved_balance_should_work() { - <$ext_builder>::default().build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 110); - let _ = Balances::deposit_creating(&2, 1); - assert_ok!(Balances::reserve(&1, 41)); - assert_ok!(Balances::repatriate_reserved(&1, &2, 69, Status::Free), 28); - assert_eq!(Balances::reserved_balance(1), 0); - assert_eq!(Balances::free_balance(1), 69); - assert_eq!(Balances::reserved_balance(2), 0); - assert_eq!(Balances::free_balance(2), 42); - }); - } - - #[test] - fn transferring_too_high_value_should_not_panic() { - <$ext_builder>::default().build().execute_with(|| { - Balances::make_free_balance_be(&1, u64::max_value()); - Balances::make_free_balance_be(&2, 1); - - assert_err!( - Balances::transfer(Some(1).into(), 2, u64::max_value()), - Error::<$test, _>::Overflow, - ); - - assert_eq!(Balances::free_balance(1), u64::max_value()); - assert_eq!(Balances::free_balance(2), 1); - }); - } - - #[test] - fn account_create_on_free_too_low_with_other() { - <$ext_builder>::default().existential_deposit(100).build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 100); - assert_eq!(>::get(), 100); - - // No-op. - let _ = Balances::deposit_creating(&2, 50); - assert_eq!(Balances::free_balance(2), 0); - assert_eq!(>::get(), 100); - }) - } - - #[test] - fn account_create_on_free_too_low() { - <$ext_builder>::default().existential_deposit(100).build().execute_with(|| { - // No-op. - let _ = Balances::deposit_creating(&2, 50); - assert_eq!(Balances::free_balance(2), 0); - assert_eq!(>::get(), 0); - }) - } - - #[test] - fn account_removal_on_free_too_low() { - <$ext_builder>::default().existential_deposit(100).build().execute_with(|| { - assert_eq!(>::get(), 0); - - // Setup two accounts with free balance above the existential threshold. - let _ = Balances::deposit_creating(&1, 110); - let _ = Balances::deposit_creating(&2, 110); - - assert_eq!(Balances::free_balance(1), 110); - assert_eq!(Balances::free_balance(2), 110); - assert_eq!(>::get(), 220); - - // Transfer funds from account 1 of such amount that after this transfer - // the balance of account 1 will be below the existential threshold. - // This should lead to the removal of all balance of this account. - assert_ok!(Balances::transfer(Some(1).into(), 2, 20)); - - // Verify free balance removal of account 1. - assert_eq!(Balances::free_balance(1), 0); - assert_eq!(Balances::free_balance(2), 130); - - // Verify that TotalIssuance tracks balance removal when free balance is too low. - assert_eq!(>::get(), 130); - }); - } - - #[test] - fn burn_must_work() { - <$ext_builder>::default().monied(true).build().execute_with(|| { - let init_total_issuance = Balances::total_issuance(); - let imbalance = Balances::burn(10); - assert_eq!(Balances::total_issuance(), init_total_issuance - 10); - drop(imbalance); - assert_eq!(Balances::total_issuance(), init_total_issuance); - }); - } - - #[test] - fn transfer_keep_alive_works() { - <$ext_builder>::default().existential_deposit(1).build().execute_with(|| { - let _ = Balances::deposit_creating(&1, 100); - assert_noop!( - Balances::transfer_keep_alive(Some(1).into(), 2, 100), - Error::<$test, _>::KeepAlive - ); - assert_eq!(Balances::total_balance(&1), 100); - assert_eq!(Balances::total_balance(&2), 0); - }); - } - - #[test] - #[should_panic = "the balance of any account should always be at least the existential deposit."] - fn cannot_set_genesis_value_below_ed() { - ($existential_deposit).with(|v| *v.borrow_mut() = 11); - let mut t = frame_system::GenesisConfig::default().build_storage::<$test>().unwrap(); - let _ = pallet_balances::GenesisConfig::<$test> { - balances: vec![(1, 10)], - }.assimilate_storage(&mut t).unwrap(); - } - - #[test] - #[should_panic = "duplicate balances in genesis."] - fn cannot_set_genesis_value_twice() { - let mut t = frame_system::GenesisConfig::default().build_storage::<$test>().unwrap(); - let _ = pallet_balances::GenesisConfig::<$test> { - balances: vec![(1, 10), (2, 20), (1, 15)], - }.assimilate_storage(&mut t).unwrap(); - } - - #[test] - fn dust_moves_between_free_and_reserved() { - <$ext_builder>::default() - .existential_deposit(100) - .build() - .execute_with(|| { - // Set balance to free and reserved at the existential deposit - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 1, 100, 0)); - // Check balance - assert_eq!(Balances::free_balance(1), 100); - assert_eq!(Balances::reserved_balance(1), 0); - - // Reserve some free balance - assert_ok!(Balances::reserve(&1, 50)); - // Check balance, the account should be ok. - assert_eq!(Balances::free_balance(1), 50); - assert_eq!(Balances::reserved_balance(1), 50); - - // Reserve the rest of the free balance - assert_ok!(Balances::reserve(&1, 50)); - // Check balance, the account should be ok. - assert_eq!(Balances::free_balance(1), 0); - assert_eq!(Balances::reserved_balance(1), 100); - - // Unreserve everything - Balances::unreserve(&1, 100); - // Check balance, all 100 should move to free_balance - assert_eq!(Balances::free_balance(1), 100); - assert_eq!(Balances::reserved_balance(1), 0); - }); - } - - #[test] - fn account_deleted_when_just_dust() { - <$ext_builder>::default() - .existential_deposit(100) - .build() - .execute_with(|| { - // Set balance to free and reserved at the existential deposit - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 1, 50, 50)); - // Check balance - assert_eq!(Balances::free_balance(1), 50); - assert_eq!(Balances::reserved_balance(1), 50); - - // Reserve some free balance - let _ = Balances::slash(&1, 1); - // The account should be dead. - assert_eq!(Balances::free_balance(1), 0); - assert_eq!(Balances::reserved_balance(1), 0); - }); - } - - #[test] - fn emit_events_with_reserve_and_unreserve() { - <$ext_builder>::default() - .build() - .execute_with(|| { - let _ = Balances::deposit_creating(&1, 100); - - System::set_block_number(2); - let _ = Balances::reserve(&1, 10); - - assert_eq!( - last_event(), - Event::pallet_balances(crate::Event::Reserved(1, 10)), - ); - - System::set_block_number(3); - let _ = Balances::unreserve(&1, 5); - - assert_eq!( - last_event(), - Event::pallet_balances(crate::Event::Unreserved(1, 5)), - ); - - System::set_block_number(4); - let _ = Balances::unreserve(&1, 6); - - // should only unreserve 5 - assert_eq!( - last_event(), - Event::pallet_balances(crate::Event::Unreserved(1, 5)), - ); - }); - } - - #[test] - fn emit_events_with_existential_deposit() { - <$ext_builder>::default() - .existential_deposit(100) - .build() - .execute_with(|| { - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 1, 100, 0)); - - assert_eq!( - events(), - [ - Event::frame_system(system::Event::NewAccount(1)), - Event::pallet_balances(crate::Event::Endowed(1, 100)), - Event::pallet_balances(crate::Event::BalanceSet(1, 100, 0)), - ] - ); - - let _ = Balances::slash(&1, 1); - - assert_eq!( - events(), - [ - Event::frame_system(system::Event::KilledAccount(1)), - Event::pallet_balances(crate::Event::DustLost(1, 99)), - ] - ); - }); - } - - #[test] - fn emit_events_with_no_existential_deposit_suicide() { - <$ext_builder>::default() - .existential_deposit(1) - .build() - .execute_with(|| { - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 1, 100, 0)); - - assert_eq!( - events(), - [ - Event::frame_system(system::Event::NewAccount(1)), - Event::pallet_balances(crate::Event::Endowed(1, 100)), - Event::pallet_balances(crate::Event::BalanceSet(1, 100, 0)), - ] - ); - - let _ = Balances::slash(&1, 100); - - assert_eq!( - events(), - [ - Event::frame_system(system::Event::KilledAccount(1)) - ] - ); - }); - } - - #[test] - fn slash_loop_works() { - <$ext_builder>::default() - .existential_deposit(100) - .build() - .execute_with(|| { - /* User has no reference counter, so they can die in these scenarios */ - - // SCENARIO: Slash would not kill account. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 0)); - // Slashed completed in full - assert_eq!(Balances::slash(&1, 900), (NegativeImbalance::new(900), 0)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Slash will kill account because not enough balance left. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 0)); - // Slashed completed in full - assert_eq!(Balances::slash(&1, 950), (NegativeImbalance::new(950), 0)); - // Account is killed - assert!(!System::account_exists(&1)); - - // SCENARIO: Over-slash will kill account, and report missing slash amount. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 0)); - // Slashed full free_balance, and reports 300 not slashed - assert_eq!(Balances::slash(&1, 1_300), (NegativeImbalance::new(1000), 300)); - // Account is dead - assert!(!System::account_exists(&1)); - - // SCENARIO: Over-slash can take from reserved, but keep alive. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 400)); - // Slashed full free_balance and 300 of reserved balance - assert_eq!(Balances::slash(&1, 1_300), (NegativeImbalance::new(1300), 0)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Over-slash can take from reserved, and kill. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 350)); - // Slashed full free_balance and 300 of reserved balance - assert_eq!(Balances::slash(&1, 1_300), (NegativeImbalance::new(1300), 0)); - // Account is dead because 50 reserved balance is not enough to keep alive - assert!(!System::account_exists(&1)); - - // SCENARIO: Over-slash can take as much as possible from reserved, kill, and report missing amount. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 250)); - // Slashed full free_balance and 300 of reserved balance - assert_eq!(Balances::slash(&1, 1_300), (NegativeImbalance::new(1250), 50)); - // Account is super dead - assert!(!System::account_exists(&1)); - - /* User will now have a reference counter on them, keeping them alive in these scenarios */ - - // SCENARIO: Slash would not kill account. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 0)); - assert_ok!(System::inc_consumers(&1)); // <-- Reference counter added here is enough for all tests - // Slashed completed in full - assert_eq!(Balances::slash(&1, 900), (NegativeImbalance::new(900), 0)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Slash will take as much as possible without killing account. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 0)); - // Slashed completed in full - assert_eq!(Balances::slash(&1, 950), (NegativeImbalance::new(900), 50)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Over-slash will not kill account, and report missing slash amount. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 0)); - // Slashed full free_balance minus ED, and reports 400 not slashed - assert_eq!(Balances::slash(&1, 1_300), (NegativeImbalance::new(900), 400)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Over-slash can take from reserved, but keep alive. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 400)); - // Slashed full free_balance and 300 of reserved balance - assert_eq!(Balances::slash(&1, 1_300), (NegativeImbalance::new(1300), 0)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Over-slash can take from reserved, but keep alive. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 350)); - // Slashed full free_balance and 250 of reserved balance to leave ED - assert_eq!(Balances::slash(&1, 1_300), (NegativeImbalance::new(1250), 50)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Over-slash can take as much as possible from reserved and report missing amount. - assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 250)); - // Slashed full free_balance and 300 of reserved balance - assert_eq!(Balances::slash(&1, 1_300), (NegativeImbalance::new(1150), 150)); - // Account is still alive - assert!(System::account_exists(&1)); - - // Slash on non-existent account is okay. - assert_eq!(Balances::slash(&12345, 1_300), (NegativeImbalance::new(0), 1300)); - }); - } - - #[test] - fn slash_reserved_loop_works() { - <$ext_builder>::default() - .existential_deposit(100) - .build() - .execute_with(|| { - /* User has no reference counter, so they can die in these scenarios */ - - // SCENARIO: Slash would not kill account. - assert_ok!(Balances::set_balance(Origin::root(), 1, 50, 1_000)); - // Slashed completed in full - assert_eq!(Balances::slash_reserved(&1, 900), (NegativeImbalance::new(900), 0)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Slash would kill account. - assert_ok!(Balances::set_balance(Origin::root(), 1, 50, 1_000)); - // Slashed completed in full - assert_eq!(Balances::slash_reserved(&1, 1_000), (NegativeImbalance::new(1_000), 0)); - // Account is dead - assert!(!System::account_exists(&1)); - - // SCENARIO: Over-slash would kill account, and reports left over slash. - assert_ok!(Balances::set_balance(Origin::root(), 1, 50, 1_000)); - // Slashed completed in full - assert_eq!(Balances::slash_reserved(&1, 1_300), (NegativeImbalance::new(1_000), 300)); - // Account is dead - assert!(!System::account_exists(&1)); - - // SCENARIO: Over-slash does not take from free balance. - assert_ok!(Balances::set_balance(Origin::root(), 1, 300, 1_000)); - // Slashed completed in full - assert_eq!(Balances::slash_reserved(&1, 1_300), (NegativeImbalance::new(1_000), 300)); - // Account is alive because of free balance - assert!(System::account_exists(&1)); - - /* User has a reference counter, so they cannot die */ - - // SCENARIO: Slash would not kill account. - assert_ok!(Balances::set_balance(Origin::root(), 1, 50, 1_000)); - assert_ok!(System::inc_consumers(&1)); // <-- Reference counter added here is enough for all tests - // Slashed completed in full - assert_eq!(Balances::slash_reserved(&1, 900), (NegativeImbalance::new(900), 0)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Slash as much as possible without killing. - assert_ok!(Balances::set_balance(Origin::root(), 1, 50, 1_000)); - // Slashed as much as possible - assert_eq!(Balances::slash_reserved(&1, 1_000), (NegativeImbalance::new(950), 50)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Over-slash reports correctly, where reserved is needed to keep alive. - assert_ok!(Balances::set_balance(Origin::root(), 1, 50, 1_000)); - // Slashed as much as possible - assert_eq!(Balances::slash_reserved(&1, 1_300), (NegativeImbalance::new(950), 350)); - // Account is still alive - assert!(System::account_exists(&1)); - - // SCENARIO: Over-slash reports correctly, where full reserved is removed. - assert_ok!(Balances::set_balance(Origin::root(), 1, 200, 1_000)); - // Slashed as much as possible - assert_eq!(Balances::slash_reserved(&1, 1_300), (NegativeImbalance::new(1_000), 300)); - // Account is still alive - assert!(System::account_exists(&1)); - - // Slash on non-existent account is okay. - assert_eq!(Balances::slash_reserved(&12345, 1_300), (NegativeImbalance::new(0), 1300)); - }); - } - - #[test] - fn operations_on_dead_account_should_not_change_state() { - // These functions all use `mutate_account` which may introduce a storage change when - // the account never existed to begin with, and shouldn't exist in the end. - <$ext_builder>::default() - .existential_deposit(0) - .build() - .execute_with(|| { - assert!(!frame_system::Account::::contains_key(&1337)); - - // Unreserve - assert_storage_noop!(assert_eq!(Balances::unreserve(&1337, 42), 42)); - // Reserve - assert_noop!(Balances::reserve(&1337, 42), Error::::InsufficientBalance); - // Slash Reserve - assert_storage_noop!(assert_eq!(Balances::slash_reserved(&1337, 42).1, 42)); - // Repatriate Reserve - assert_noop!(Balances::repatriate_reserved(&1337, &1338, 42, Status::Free), Error::::DeadAccount); - // Slash - assert_storage_noop!(assert_eq!(Balances::slash(&1337, 42).1, 42)); - }); - } - - #[test] - fn transfer_keep_alive_all_free_succeed() { - <$ext_builder>::default() - .existential_deposit(100) - .build() - .execute_with(|| { - assert_ok!(Balances::set_balance(Origin::root(), 1, 100, 100)); - assert_ok!(Balances::transfer_keep_alive(Some(1).into(), 2, 100)); - assert_eq!(Balances::total_balance(&1), 100); - assert_eq!(Balances::total_balance(&2), 100); - }); - } - } -} diff --git a/pallets/balances/src/tests_composite.rs b/pallets/balances/src/tests_composite.rs deleted file mode 100644 index 14dfd0c4b..000000000 --- a/pallets/balances/src/tests_composite.rs +++ /dev/null @@ -1,146 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Test utilities - -#![cfg(test)] - -use sp_runtime::{ - traits::IdentityLookup, - testing::Header, -}; -use sp_core::H256; -use sp_io; -use frame_support::parameter_types; -use frame_support::weights::{Weight, DispatchInfo, IdentityFee}; -use pallet_transaction_payment::CurrencyAdapter; -use crate::{ - self as pallet_balances, - Module, Config, decl_tests, -}; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; - -frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system::{Module, Call, Config, Storage, Event}, - Balances: pallet_balances::{Module, Call, Storage, Config, Event}, - } -); - -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(1024); - pub static ExistentialDeposit: u64 = 0; -} -impl frame_system::Config for Test { - type BaseCallFilter = (); - type BlockWeights = BlockWeights; - type BlockLength = (); - type DbWeight = (); - type Origin = Origin; - type Index = u64; - type BlockNumber = u64; - type Call = Call; - type Hash = H256; - type Hashing = ::sp_runtime::traits::BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Header = Header; - type Event = Event; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = super::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); -} -parameter_types! { - pub const TransactionByteFee: u64 = 1; -} -impl pallet_transaction_payment::Config for Test { - type OnChargeTransaction = CurrencyAdapter, ()>; - type TransactionByteFee = TransactionByteFee; - type WeightToFee = IdentityFee; - type FeeMultiplierUpdate = (); -} - -impl Config for Test { - type Balance = u64; - type DustRemoval = (); - type Event = Event; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = frame_system::Pallet; - type MaxLocks = (); - type WeightInfo = (); -} - -pub struct ExtBuilder { - existential_deposit: u64, - monied: bool, -} -impl Default for ExtBuilder { - fn default() -> Self { - Self { - existential_deposit: 1, - monied: false, - } - } -} -impl ExtBuilder { - pub fn existential_deposit(mut self, existential_deposit: u64) -> Self { - self.existential_deposit = existential_deposit; - self - } - pub fn monied(mut self, monied: bool) -> Self { - self.monied = monied; - self - } - pub fn set_associated_consts(&self) { - EXISTENTIAL_DEPOSIT.with(|v| *v.borrow_mut() = self.existential_deposit); - } - pub fn build(self) -> sp_io::TestExternalities { - self.set_associated_consts(); - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - pallet_balances::GenesisConfig:: { - balances: if self.monied { - vec![ - (1, 10 * self.existential_deposit), - (2, 20 * self.existential_deposit), - (3, 30 * self.existential_deposit), - (4, 40 * self.existential_deposit), - (12, 10 * self.existential_deposit) - ] - } else { - vec![] - }, - }.assimilate_storage(&mut t).unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} - -decl_tests!{ Test, ExtBuilder, EXISTENTIAL_DEPOSIT } diff --git a/pallets/balances/src/tests_local.rs b/pallets/balances/src/tests_local.rs deleted file mode 100644 index 02088e88b..000000000 --- a/pallets/balances/src/tests_local.rs +++ /dev/null @@ -1,192 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Test utilities - -#![cfg(test)] - -use sp_runtime::{ - traits::IdentityLookup, - testing::Header, -}; -use sp_core::H256; -use sp_io; -use frame_support::parameter_types; -use frame_support::traits::StorageMapShim; -use frame_support::weights::{Weight, DispatchInfo, IdentityFee}; -use crate::{ - self as pallet_balances, - Module, Config, decl_tests, -}; -use pallet_transaction_payment::CurrencyAdapter; - -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; - -frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system::{Module, Call, Config, Storage, Event}, - Balances: pallet_balances::{Module, Call, Storage, Config, Event}, - } -); - -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(1024); - pub static ExistentialDeposit: u64 = 0; -} -impl frame_system::Config for Test { - type BaseCallFilter = (); - type BlockWeights = BlockWeights; - type BlockLength = (); - type DbWeight = (); - type Origin = Origin; - type Index = u64; - type BlockNumber = u64; - type Call = Call; - type Hash = H256; - type Hashing = ::sp_runtime::traits::BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Header = Header; - type Event = Event; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); -} -parameter_types! { - pub const TransactionByteFee: u64 = 1; -} -impl pallet_transaction_payment::Config for Test { - type OnChargeTransaction = CurrencyAdapter, ()>; - type TransactionByteFee = TransactionByteFee; - type WeightToFee = IdentityFee; - type FeeMultiplierUpdate = (); -} -parameter_types! { - pub const MaxLocks: u32 = 50; -} -impl Config for Test { - type Balance = u64; - type DustRemoval = (); - type Event = Event; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = StorageMapShim< - super::Account, - system::Provider, - u64, - super::AccountData, - >; - type MaxLocks = MaxLocks; - type WeightInfo = (); -} - -pub struct ExtBuilder { - existential_deposit: u64, - monied: bool, -} -impl Default for ExtBuilder { - fn default() -> Self { - Self { - existential_deposit: 1, - monied: false, - } - } -} -impl ExtBuilder { - pub fn existential_deposit(mut self, existential_deposit: u64) -> Self { - self.existential_deposit = existential_deposit; - self - } - pub fn monied(mut self, monied: bool) -> Self { - self.monied = monied; - if self.existential_deposit == 0 { - self.existential_deposit = 1; - } - self - } - pub fn set_associated_consts(&self) { - EXISTENTIAL_DEPOSIT.with(|v| *v.borrow_mut() = self.existential_deposit); - } - pub fn build(self) -> sp_io::TestExternalities { - self.set_associated_consts(); - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - pallet_balances::GenesisConfig:: { - balances: if self.monied { - vec![ - (1, 10 * self.existential_deposit), - (2, 20 * self.existential_deposit), - (3, 30 * self.existential_deposit), - (4, 40 * self.existential_deposit), - (12, 10 * self.existential_deposit) - ] - } else { - vec![] - }, - }.assimilate_storage(&mut t).unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} - -decl_tests!{ Test, ExtBuilder, EXISTENTIAL_DEPOSIT } - -#[test] -fn emit_events_with_no_existential_deposit_suicide_with_dust() { - ::default() - .existential_deposit(2) - .build() - .execute_with(|| { - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 1, 100, 0)); - - assert_eq!( - events(), - [ - Event::frame_system(system::Event::NewAccount(1)), - Event::pallet_balances(crate::Event::Endowed(1, 100)), - Event::pallet_balances(crate::Event::BalanceSet(1, 100, 0)), - ] - ); - - let _ = Balances::slash(&1, 98); - - // no events - assert_eq!(events(), []); - - let _ = Balances::slash(&1, 1); - - assert_eq!( - events(), - [ - Event::frame_system(system::Event::KilledAccount(1)), - Event::pallet_balances(crate::Event::DustLost(1, 1)), - ] - ); - }); -} diff --git a/pallets/balances/src/tests_reentrancy.rs b/pallets/balances/src/tests_reentrancy.rs deleted file mode 100644 index 020c514b6..000000000 --- a/pallets/balances/src/tests_reentrancy.rs +++ /dev/null @@ -1,310 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Test setup for potential reentracy and lost updates of nested mutations. - -#![cfg(test)] - -use sp_runtime::{ - traits::IdentityLookup, - testing::Header, -}; -use sp_core::H256; -use sp_io; -use frame_support::parameter_types; -use frame_support::traits::StorageMapShim; -use frame_support::weights::{IdentityFee}; -use crate::{ - self as pallet_balances, - Module, Config, -}; -use pallet_transaction_payment::CurrencyAdapter; - -use crate::*; -use frame_support::{ - assert_ok, - traits::{ - Currency, ReservableCurrency, - } -}; -use frame_system::RawOrigin; - -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; - -fn last_event() -> Event { - system::Module::::events().pop().expect("Event expected").event -} - -frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system::{Module, Call, Config, Storage, Event}, - Balances: pallet_balances::{Module, Call, Storage, Config, Event}, - } -); - -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(1024); - pub static ExistentialDeposit: u64 = 0; -} -impl frame_system::Config for Test { - type BaseCallFilter = (); - type BlockWeights = BlockWeights; - type BlockLength = (); - type DbWeight = (); - type Origin = Origin; - type Index = u64; - type BlockNumber = u64; - type Call = Call; - type Hash = H256; - type Hashing = ::sp_runtime::traits::BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Header = Header; - type Event = Event; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); -} -parameter_types! { - pub const TransactionByteFee: u64 = 1; -} -impl pallet_transaction_payment::Config for Test { - type OnChargeTransaction = CurrencyAdapter, ()>; - type TransactionByteFee = TransactionByteFee; - type WeightToFee = IdentityFee; - type FeeMultiplierUpdate = (); -} - -pub struct OnDustRemoval; -impl OnUnbalanced> for OnDustRemoval { - fn on_nonzero_unbalanced(amount: NegativeImbalance) { - let _ = Balances::resolve_into_existing(&1, amount); - } -} -parameter_types! { - pub const MaxLocks: u32 = 50; -} -impl Config for Test { - type Balance = u64; - type DustRemoval = OnDustRemoval; - type Event = Event; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = StorageMapShim< - super::Account, - system::Provider, - u64, - super::AccountData, - >; - type MaxLocks = MaxLocks; - type WeightInfo = (); -} - -pub struct ExtBuilder { - existential_deposit: u64, -} -impl Default for ExtBuilder { - fn default() -> Self { - Self { - existential_deposit: 1, - } - } -} -impl ExtBuilder { - - pub fn existential_deposit(mut self, existential_deposit: u64) -> Self { - self.existential_deposit = existential_deposit; - self - } - - pub fn set_associated_consts(&self) { - EXISTENTIAL_DEPOSIT.with(|v| *v.borrow_mut() = self.existential_deposit); - } - - pub fn build(self) -> sp_io::TestExternalities { - self.set_associated_consts(); - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - pallet_balances::GenesisConfig:: { - balances: vec![], - }.assimilate_storage(&mut t).unwrap(); - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} - -#[test] -fn transfer_dust_removal_tst1_should_work() { - ExtBuilder::default() - .existential_deposit(100) - .build() - .execute_with(|| { - // Verification of reentrancy in dust removal - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 1, 1000, 0)); - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 2, 500, 0)); - - // In this transaction, account 2 free balance - // drops below existential balance - // and dust balance is removed from account 2 - assert_ok!(Balances::transfer(RawOrigin::Signed(2).into(), 3, 450)); - - // As expected dust balance is removed. - assert_eq!(Balances::free_balance(&2), 0); - - // As expected beneficiary account 3 - // received the transfered fund. - assert_eq!(Balances::free_balance(&3), 450); - - // Dust balance is deposited to account 1 - // during the process of dust removal. - assert_eq!(Balances::free_balance(&1), 1050); - - // Verify the events - // Number of events expected is 8 - assert_eq!(System::events().len(), 11); - - assert!( - System::events().iter().any( - |er| - er.event == Event::pallet_balances( - crate::Event::Transfer(2, 3, 450), - ), - ), - ); - - assert!( - System::events().iter().any( - |er| - er.event == Event::pallet_balances( - crate::Event::DustLost(2, 50) - ), - ), - ); - } - ); -} - -#[test] -fn transfer_dust_removal_tst2_should_work() { - ExtBuilder::default() - .existential_deposit(100) - .build() - .execute_with(|| { - // Verification of reentrancy in dust removal - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 1, 1000, 0)); - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 2, 500, 0)); - - // In this transaction, account 2 free balance - // drops below existential balance - // and dust balance is removed from account 2 - assert_ok!(Balances::transfer(RawOrigin::Signed(2).into(), 1, 450)); - - // As expected dust balance is removed. - assert_eq!(Balances::free_balance(&2), 0); - - // Dust balance is deposited to account 1 - // during the process of dust removal. - assert_eq!(Balances::free_balance(&1), 1500); - - // Verify the events - // Number of events expected is 8 - assert_eq!(System::events().len(), 9); - - assert!( - System::events().iter().any( - |er| - er.event == Event::pallet_balances( - crate::Event::Transfer(2, 1, 450), - ), - ), - ); - - assert!( - System::events().iter().any( - |er| - er.event == Event::pallet_balances( - crate::Event::DustLost(2, 50), - ), - ), - ); - } - ); -} - -#[test] -fn repatriating_reserved_balance_dust_removal_should_work() { - ExtBuilder::default() - .existential_deposit(100) - .build() - .execute_with(|| { - // Verification of reentrancy in dust removal - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 1, 1000, 0)); - assert_ok!(Balances::set_balance(RawOrigin::Root.into(), 2, 500, 0)); - - // Reserve a value on account 2, - // Such that free balance is lower than - // Exestintial deposit. - assert_ok!(Balances::reserve(&2, 450)); - - // Transfer of reserved fund from slashed account 2 to - // beneficiary account 1 - assert_ok!(Balances::repatriate_reserved(&2, &1, 450, Status::Free), 0); - - // Since free balance of account 2 is lower than - // existential deposit, dust amount is - // removed from the account 2 - assert_eq!(Balances::reserved_balance(2), 0); - assert_eq!(Balances::free_balance(2), 0); - - // account 1 is credited with reserved amount - // together with dust balance during dust - // removal. - assert_eq!(Balances::reserved_balance(1), 0); - assert_eq!(Balances::free_balance(1), 1500); - - // Verify the events - // Number of events expected is 10 - assert_eq!(System::events().len(), 10); - - assert!( - System::events().iter().any( - |er| - er.event == Event::pallet_balances( - crate::Event::ReserveRepatriated(2, 1, 450, Status::Free), - ), - ), - ); - - assert_eq!( - last_event(), - Event::pallet_balances(crate::Event::DustLost(2, 50)), - ); - - } - ); -} diff --git a/pallets/balances/src/weights.rs b/pallets/balances/src/weights.rs deleted file mode 100644 index 463ac7dd3..000000000 --- a/pallets/balances/src/weights.rs +++ /dev/null @@ -1,111 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2021 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Autogenerated weights for pallet_balances -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 -//! DATE: 2021-01-06, STEPS: \[50, \], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 - -// Executed Command: -// target/release/substrate -// benchmark -// --chain=dev -// --steps=50 -// --repeat=20 -// --pallet=pallet_balances -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./frame/balances/src/weights.rs -// --template=./.maintain/frame-weight-template.hbs - - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions needed for pallet_balances. -pub trait WeightInfo { - fn transfer() -> Weight; - fn transfer_keep_alive() -> Weight; - fn set_balance_creating() -> Weight; - fn set_balance_killing() -> Weight; - fn force_transfer() -> Weight; -} - -/// Weights for pallet_balances using the Substrate node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight { - fn transfer() -> Weight { - (100_698_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn transfer_keep_alive() -> Weight { - (69_407_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_balance_creating() -> Weight { - (38_489_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_balance_killing() -> Weight { - (48_458_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn force_transfer() -> Weight { - (99_320_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - fn transfer() -> Weight { - (100_698_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } - fn transfer_keep_alive() -> Weight { - (69_407_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } - fn set_balance_creating() -> Weight { - (38_489_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } - fn set_balance_killing() -> Weight { - (48_458_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } - fn force_transfer() -> Weight { - (99_320_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(2 as Weight)) - .saturating_add(RocksDbWeight::get().writes(2 as Weight)) - } -} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 11ca2aad6..7512f0877 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -27,7 +27,7 @@ tracing-core = {optional = true, version = '0.1.17'} # local dependencies pallet-asset-registry = {path = '../pallets/asset-registry', default-features = false} -pallet-balances = {path = '../pallets/balances', default-features = false} +pallet-balances = {default-features = false, version = "3.0.0"} pallet-claims = {path = '../pallets/claims', default-features = false} pallet-exchange = {path = '../pallets/exchange', default-features = false} pallet-exchange-benchmarking = {path = '../pallets/exchange/benchmarking', default-features = false, optional = true} diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index f7603119a..fbe4405ab 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -180,12 +180,12 @@ pub fn native_version() -> NativeVersion { } pub struct BaseFilter; + impl Filter for BaseFilter { fn filter(call: &Call) -> bool { match call { Call::AuthorityDiscovery(_) | Call::Authorship(_) - | Call::Balances(_) | Call::Babe(_) | Call::Claims(_) | Call::Council(_) @@ -210,6 +210,7 @@ impl Filter for BaseFilter { Call::XYK(_) | Call::AssetRegistry(_) + | Call::Balances(_) | Call::Currencies(_) | Call::Exchange(_) | Call::Faucet(_) @@ -334,6 +335,7 @@ impl pallet_timestamp::Config for Runtime { parameter_types! { pub const ExistentialDeposit: u128 = 0; pub const MaxLocks: u32 = 50; + pub const MaxReserves: u32 = 50; } impl pallet_balances::Config for Runtime { @@ -346,6 +348,8 @@ impl pallet_balances::Config for Runtime { type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = (); + type MaxReserves = MaxReserves; + type ReserveIdentifier = [u8; 8]; } parameter_types! { @@ -433,6 +437,7 @@ impl orml_tokens::Config for Runtime { type WeightInfo = (); type ExistentialDeposits = ExistentialDeposits; type OnDust = (); + type MaxLocks = MaxLocks; } impl orml_currencies::Config for Runtime { @@ -491,6 +496,14 @@ pub mod constants; /// Staking pallets configurations pub mod impls; use constants::{currency::*, time::*}; +#[cfg(feature = "runtime-benchmarks")] +use frame_benchmarking::frame_support::max_encoded_len::MaxEncodedLen; +#[cfg(feature = "runtime-benchmarks")] +use frame_benchmarking::frame_support::pallet_prelude::EnsureOrigin; +#[cfg(feature = "runtime-benchmarks")] +use frame_benchmarking::frame_support::pallet_prelude::{Get, Member}; +#[cfg(feature = "runtime-benchmarks")] +use frame_benchmarking::frame_support::Parameter; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; pub use pallet_staking::StakerStatus; use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment}; @@ -552,6 +565,7 @@ impl pallet_staking::Config for Runtime { type UnixTime = Timestamp; type CurrencyToVote = U128CurrencyToVote; type ElectionProvider = ElectionProviderMultiPhase; + type GenesisElectionProvider = ElectionProviderMultiPhase; const MAX_NOMINATIONS: u32 = MAX_NOMINATIONS; type RewardRemainder = Treasury; type Event = Event; @@ -686,7 +700,9 @@ impl pallet_election_provider_multi_phase::Config for Runtime { type Fallback = Fallback; type BenchmarkingConfig = (); type WeightInfo = (); - type MinerMaxLength = (); // TODO: what value here ? + type MinerMaxLength = (); + type OffchainRepeat = (); + type ForceOrigin = EnsureRootOrHalfCouncil; } parameter_types! { @@ -698,6 +714,8 @@ parameter_types! { pub OffchainSolutionWeightLimit: Weight = BlockWeights::get().max_block .saturating_sub(BlockExecutionWeight::get()) .saturating_sub(ExtrinsicBaseWeight::get()); + + pub const MaxApprovals: u32 = 100; } type AllCouncilMembers = pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, CouncilCollective>; @@ -717,6 +735,7 @@ impl pallet_treasury::Config for Runtime { type BurnDestination = (); type WeightInfo = (); type SpendFunds = (); + type MaxApprovals = MaxApprovals; } parameter_types! { @@ -942,7 +961,6 @@ impl pallet_offences::Config for Runtime { type Event = Event; type IdentificationTuple = pallet_session::historical::IdentificationTuple; type OnOffenceHandler = Staking; - type WeightSoftLimit = OffencesWeightSoftLimit; } parameter_types! { @@ -961,6 +979,8 @@ impl pallet_scheduler::Config for Runtime { type WeightInfo = (); } +impl pallet_randomness_collective_flip::Config for Runtime {} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -971,7 +991,6 @@ construct_runtime!( System: frame_system::{Pallet, Call, Config, Storage, Event}, RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage}, - Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, @@ -1141,10 +1160,6 @@ impl_runtime_apis! { ) -> sp_inherents::CheckInherentsResult { data.check_extrinsics(&block) } - - fn random_seed() -> ::Hash { - RandomnessCollectiveFlip::random_seed().0 - } } impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { diff --git a/rust-toolchain b/rust-toolchain index 155d94b33..5ac2df348 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2021-02-12" +channel = "nightly-2021-06-01" components = [ "rustfmt", "clippy" ] targets = [ "wasm32-unknown-unknown" ] profile = "minimal" From 549ca5d37d1020338edef9d29714fde8a421a54e Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Mon, 21 Jun 2021 15:41:44 +0200 Subject: [PATCH 02/11] update toolchain in gh workflow --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dfc090cf2..91d5d7d53 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -72,7 +72,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2021-02-12 + toolchain: nightly-2021-06-01 target: wasm32-unknown-unknown override: true default: true From a1e080d60e96745608048a0515b4e8d120c8ae47 Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Mon, 21 Jun 2021 16:01:13 +0200 Subject: [PATCH 03/11] happy clippy - happy life --- node/src/chain_spec.rs | 4 ++-- node/src/service.rs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 04fd454c5..4859feddb 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -422,7 +422,7 @@ fn lerna_genesis( AuthorityDiscoveryId, )>, root_key: AccountId, - endowed_accounts: Vec, + _endowed_accounts: Vec, _enable_println: bool, ) -> GenesisConfig { GenesisConfig { @@ -482,7 +482,7 @@ fn lerna_genesis( fallback_account: hex!["6d6f646c70792f74727372790000000000000000000000000000000000000000"].into(), }, tokens: TokensConfig { - balances: endowed_accounts.iter().flat_map(|_x| vec![]).collect(), + balances: vec![], }, faucet: FaucetConfig { rampage: false, diff --git a/node/src/service.rs b/node/src/service.rs index 016da5fd7..09886f16e 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -7,7 +7,6 @@ use hydra_dx_runtime::{self, opaque::Block, RuntimeApi}; use futures::prelude::*; use sc_client_api::{ExecutorProvider, RemoteBackend}; use sc_client_db::PruningMode; -use sc_consensus_babe; use sc_consensus_babe::SlotProportion; use sc_executor::native_executor_instance; use sc_network::{Event, NetworkService}; From ecad2c15e09ef435ce4d71e440eea5282bf549ce Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Mon, 21 Jun 2021 16:32:59 +0200 Subject: [PATCH 04/11] fix test build (exchange tests still failing) --- pallets/claims/src/mock.rs | 2 ++ pallets/exchange/benchmarking/src/mock.rs | 3 ++- pallets/exchange/src/mock.rs | 3 ++- pallets/faucet/src/mock.rs | 5 +++-- pallets/transaction-multi-payment/benchmarking/src/mock.rs | 5 ++++- pallets/transaction-multi-payment/src/mock.rs | 5 ++++- pallets/xyk/src/mock.rs | 3 ++- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pallets/claims/src/mock.rs b/pallets/claims/src/mock.rs index cd29baab0..fa5646eca 100644 --- a/pallets/claims/src/mock.rs +++ b/pallets/claims/src/mock.rs @@ -82,6 +82,8 @@ impl pallet_balances::Config for Test { type ExistentialDeposit = (); type AccountStore = frame_system::Pallet; type WeightInfo = (); + type MaxReserves = (); + type ReserveIdentifier = (); } parameter_types! { diff --git a/pallets/exchange/benchmarking/src/mock.rs b/pallets/exchange/benchmarking/src/mock.rs index 92d165229..9f1036d3d 100644 --- a/pallets/exchange/benchmarking/src/mock.rs +++ b/pallets/exchange/benchmarking/src/mock.rs @@ -109,6 +109,7 @@ impl orml_tokens::Config for Test { type WeightInfo = (); type ExistentialDeposits = ExistentialDeposits; type OnDust = (); + type MaxLocks = (); } pub struct AssetPairAccountIdTest(); @@ -187,7 +188,7 @@ impl ExtBuilder { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); orml_tokens::GenesisConfig:: { - endowed_accounts: self.endowed_accounts, + balances: self.endowed_accounts, } .assimilate_storage(&mut t) .unwrap(); diff --git a/pallets/exchange/src/mock.rs b/pallets/exchange/src/mock.rs index b63c2efb3..aa85fde59 100644 --- a/pallets/exchange/src/mock.rs +++ b/pallets/exchange/src/mock.rs @@ -115,6 +115,7 @@ impl orml_tokens::Config for Test { type WeightInfo = (); type ExistentialDeposits = ExistentialDeposits; type OnDust = (); + type MaxLocks = (); } impl pallet_asset_registry::Config for Test { @@ -191,7 +192,7 @@ impl ExtBuilder { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); orml_tokens::GenesisConfig:: { - endowed_accounts: self.endowed_accounts, + balances: self.endowed_accounts, } .assimilate_storage(&mut t) .unwrap(); diff --git a/pallets/faucet/src/mock.rs b/pallets/faucet/src/mock.rs index a9afbc601..7f260c63f 100644 --- a/pallets/faucet/src/mock.rs +++ b/pallets/faucet/src/mock.rs @@ -90,6 +90,7 @@ impl orml_tokens::Config for Test { type WeightInfo = (); type ExistentialDeposits = ExistentialDeposits; type OnDust = (); + type MaxLocks = (); } impl Config for Test { @@ -121,7 +122,7 @@ impl ExtBuilder { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); orml_tokens::GenesisConfig:: { - endowed_accounts: self.endowed_accounts, + balances: self.endowed_accounts, } .assimilate_storage(&mut t) .unwrap(); @@ -149,7 +150,7 @@ impl ExtBuilder { .unwrap(); orml_tokens::GenesisConfig:: { - endowed_accounts: self.endowed_accounts, + balances: self.endowed_accounts, } .assimilate_storage(&mut t) .unwrap(); diff --git a/pallets/transaction-multi-payment/benchmarking/src/mock.rs b/pallets/transaction-multi-payment/benchmarking/src/mock.rs index 8308f07fd..0ce4461fd 100644 --- a/pallets/transaction-multi-payment/benchmarking/src/mock.rs +++ b/pallets/transaction-multi-payment/benchmarking/src/mock.rs @@ -135,6 +135,8 @@ impl pallet_balances::Config for Test { type AccountStore = System; type WeightInfo = (); type MaxLocks = MaxLocks; + type MaxReserves = (); + type ReserveIdentifier = (); } impl pallet_transaction_payment::Config for Test { @@ -182,6 +184,7 @@ impl orml_tokens::Config for Test { type WeightInfo = (); type ExistentialDeposits = ExistentialDeposits; type OnDust = (); + type MaxLocks = (); } impl orml_currencies::Config for Test { @@ -227,7 +230,7 @@ impl ExtBuilder { .unwrap(); orml_tokens::GenesisConfig:: { - endowed_accounts: self.endowed_accounts, + balances: self.endowed_accounts, } .assimilate_storage(&mut t) .unwrap(); diff --git a/pallets/transaction-multi-payment/src/mock.rs b/pallets/transaction-multi-payment/src/mock.rs index 47e7b741d..577a39a50 100644 --- a/pallets/transaction-multi-payment/src/mock.rs +++ b/pallets/transaction-multi-payment/src/mock.rs @@ -166,6 +166,8 @@ impl pallet_balances::Config for Test { type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = (); + type MaxReserves = (); + type ReserveIdentifier = (); } impl pallet_transaction_payment::Config for Test { @@ -212,6 +214,7 @@ impl orml_tokens::Config for Test { type WeightInfo = (); type ExistentialDeposits = ExistentialDeposits; type OnDust = (); + type MaxLocks = (); } impl orml_currencies::Config for Test { @@ -271,7 +274,7 @@ impl ExtBuilder { .unwrap(); orml_tokens::GenesisConfig:: { - endowed_accounts: self.endowed_accounts, + balances: self.endowed_accounts, } .assimilate_storage(&mut t) .unwrap(); diff --git a/pallets/xyk/src/mock.rs b/pallets/xyk/src/mock.rs index 773f94bfc..271eebd1f 100644 --- a/pallets/xyk/src/mock.rs +++ b/pallets/xyk/src/mock.rs @@ -107,6 +107,7 @@ impl orml_tokens::Config for Test { type WeightInfo = (); type ExistentialDeposits = ExistentialDeposits; type OnDust = (); + type MaxLocks = (); } pub struct AssetPairAccountIdTest(); @@ -165,7 +166,7 @@ impl ExtBuilder { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); orml_tokens::GenesisConfig:: { - endowed_accounts: self.endowed_accounts, + balances: self.endowed_accounts, } .assimilate_storage(&mut t) .unwrap(); From a24aaa2f6b36824e42df44e1904c687e3a1ed00b Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Mon, 21 Jun 2021 18:22:21 +0200 Subject: [PATCH 05/11] fix some exchange tests --- pallets/exchange/src/tests.rs | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/pallets/exchange/src/tests.rs b/pallets/exchange/src/tests.rs index 431512ec0..c2ffbbe3d 100644 --- a/pallets/exchange/src/tests.rs +++ b/pallets/exchange/src/tests.rs @@ -540,6 +540,10 @@ fn sell_test_exact_match() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 2, 1000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 2000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 4000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 2000000000).into(), Event::IntentionResolvedDirectTrade( user_2, user_3, @@ -1600,6 +1604,10 @@ fn discount_tests_no_discount() { user_4_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 4, 1500000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 3000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 4, 6000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 3000000000).into(), Event::IntentionResolvedDirectTrade( user_4, user_3, @@ -1768,6 +1776,10 @@ fn discount_tests_with_discount() { user_4_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 4, 1500000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 3000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 4, 6000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 3000000000).into(), Event::IntentionResolvedDirectTrade( user_4, user_3, @@ -1907,6 +1919,10 @@ fn buy_test_exact_match() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 3, 1000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 2000000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 2000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 4000000000).into(), Event::IntentionResolvedDirectTrade( user_3, user_2, @@ -2033,6 +2049,10 @@ fn buy_test_group_buys() { user_4_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 2, 2500000000000).into(), + orml_tokens::Event::Reserved(asset_b, 4, 5000000000000).into(), + orml_tokens::Event::Reserved(asset_a, 2, 5000000000).into(), + orml_tokens::Event::Reserved(asset_b, 4, 10000000000).into(), xyk::Event::BuyExecuted( user_4, asset_a, @@ -2911,6 +2931,10 @@ fn matching_limits_buy_buy_should_work() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_b, 2, 200000000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 100000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 400000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 200000000000).into(), xyk::Event::BuyExecuted( 3, asset_b, @@ -3033,6 +3057,10 @@ fn matching_limits_sell_buy_should_work() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_b, 2, 60000000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 30000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 120000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 60000000000).into(), //TODO: this is strange ?! should asset_a!! xyk::Event::SellExecuted( 3, asset_a, @@ -3158,6 +3186,10 @@ fn exact_match_limit_should_work() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_b, 2, 100000000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 50000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 200000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 100000000000).into(), Event::IntentionResolvedDirectTrade( user_2, user_3, @@ -3265,6 +3297,10 @@ fn matching_limit_scenario_2() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_b, 2, 180000000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 90000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 360000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 180000000000).into(), Event::IntentionResolvedDirectTrade( user_2, user_3, @@ -3390,6 +3426,10 @@ fn matching_limit_scenario_3() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_b, 2, 200000000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 100000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 400000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 200000000000).into(), Event::IntentionResolvedDirectTrade( user_2, user_3, From e695eb1ee0d58f20f572c3e720fcf9685d7ded6b Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Tue, 22 Jun 2021 08:32:33 +0200 Subject: [PATCH 06/11] fix exchange test (new events) --- pallets/exchange/src/tests.rs | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/pallets/exchange/src/tests.rs b/pallets/exchange/src/tests.rs index c2ffbbe3d..cf2123dd9 100644 --- a/pallets/exchange/src/tests.rs +++ b/pallets/exchange/src/tests.rs @@ -177,6 +177,10 @@ fn sell_test_pool_finalization_states() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 2, 1000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 2000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 2000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 4000000000).into(), Event::IntentionResolvedDirectTrade( user_2, user_3, @@ -307,6 +311,10 @@ fn sell_test_standard() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 2, 1000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 2000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 2000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 4000000000).into(), Event::IntentionResolvedDirectTrade( user_2, user_3, @@ -425,6 +433,10 @@ fn sell_test_inverse_standard() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 2, 1000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 2000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 4000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 2000000000).into(), xyk::Event::SellExecuted(3, 2000, 3000, 2000000000000, 988118811882, 3000, 1980198019).into(), Event::IntentionResolvedAMMTrade( user_3, @@ -1032,6 +1044,10 @@ fn sell_test_single_multiple_sells() { user_6_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 2, 1000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 6, 2000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 4000000000).into(), + orml_tokens::Event::Reserved(asset_a, 6, 2000000000).into(), Event::IntentionResolvedDirectTrade( user_2, user_6, @@ -1057,6 +1073,10 @@ fn sell_test_single_multiple_sells() { 2000000000, ) .into(), + orml_tokens::Event::Reserved(asset_a, 4, 500000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 1000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 4, 2000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 1000000000).into(), Event::IntentionResolvedDirectTrade( user_4, user_3, @@ -1219,6 +1239,10 @@ fn sell_test_group_sells() { user_4_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 4, 2500000000000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 5000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 4, 10000000000).into(), + orml_tokens::Event::Reserved(asset_a, 2, 5000000000).into(), Event::IntentionResolvedDirectTrade( user_4, user_2, @@ -1244,6 +1268,10 @@ fn sell_test_group_sells() { 5000000000, ) .into(), + orml_tokens::Event::Reserved(asset_a, 4, 1500000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 3000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 4, 6000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 3000000000).into(), Event::IntentionResolvedDirectTrade( user_4, user_3, @@ -1442,6 +1470,10 @@ fn sell_test_mixed_buy_sells() { user_4_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 4, 1500000000000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 3000000000000).into(), + orml_tokens::Event::Reserved(asset_b, 4, 6000000000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 3000000000).into(), Event::IntentionResolvedDirectTrade( user_4, user_3, @@ -2338,6 +2370,10 @@ fn simple_sell_sell() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 2, 500).into(), + orml_tokens::Event::Reserved(asset_b, 3, 1000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 2).into(), + orml_tokens::Event::Reserved(asset_a, 3, 1).into(), Event::IntentionResolvedDirectTrade( user_2, user_3, @@ -2425,6 +2461,10 @@ fn simple_buy_buy() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 3, 500).into(), + orml_tokens::Event::Reserved(asset_b, 2, 1000).into(), + orml_tokens::Event::Reserved(asset_a, 3, 1).into(), + orml_tokens::Event::Reserved(asset_b, 2, 2).into(), xyk::Event::BuyExecuted(2, 3000, 2000, 1500, 3001, 2000, 6).into(), Event::IntentionResolvedAMMTrade(user_2, IntentionType::BUY, user_2_sell_intention_id, 1500, 3007).into(), Event::IntentionResolvedDirectTrade( @@ -2513,6 +2553,10 @@ fn simple_sell_buy() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 2, 1000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 2000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 2).into(), + orml_tokens::Event::Reserved(asset_b, 3, 4).into(), Event::IntentionResolvedDirectTrade( user_2, user_3, @@ -2601,6 +2645,10 @@ fn simple_buy_sell() { user_3_sell_intention_id, ) .into(), + orml_tokens::Event::Reserved(asset_a, 3, 1000).into(), + orml_tokens::Event::Reserved(asset_b, 2, 2000).into(), + orml_tokens::Event::Reserved(asset_b, 3, 2).into(), + orml_tokens::Event::Reserved(asset_b, 2, 4).into(), xyk::Event::BuyExecuted(user_2, 3000, 2000, 1000, 2001, 2000, 4).into(), Event::IntentionResolvedAMMTrade(user_2, IntentionType::BUY, user_2_sell_intention_id, 1000, 2005).into(), Event::IntentionResolvedDirectTrade( From 6ba6ac6be2a10a57d547873550d47a8517f5ae3d Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Tue, 22 Jun 2021 08:55:00 +0200 Subject: [PATCH 07/11] fix xyk test (new events) --- pallets/xyk/src/tests.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pallets/xyk/src/tests.rs b/pallets/xyk/src/tests.rs index 9b796b4dd..29c0964c4 100644 --- a/pallets/xyk/src/tests.rs +++ b/pallets/xyk/src/tests.rs @@ -207,6 +207,7 @@ fn add_liquidity_as_another_user_should_work() { expect_events(vec![ Event::PoolCreated(ALICE, asset_b, asset_a, 1000000000000).into(), Event::LiquidityAdded(ALICE, asset_b, asset_a, 400000, 4000000000).into(), + orml_tokens::Event::Endowed(0, 2, 10000000000).into(), Event::LiquidityAdded(BOB, asset_b, asset_a, 1000000, 10000000000).into(), ]); }); @@ -512,6 +513,7 @@ fn work_flow_happy_path_should_work() { expect_events(vec![ Event::PoolCreated(user_1, asset_a, asset_b, 350_000_000_000).into(), + orml_tokens::Event::Endowed(0, 2, 300000000000).into(), Event::LiquidityAdded(user_2, asset_a, asset_b, 300_000_000_000, 12_000_000_000_000).into(), Event::SellExecuted( user_2, @@ -673,6 +675,9 @@ fn discount_sell_fees_should_work() { expect_events(vec![ Event::PoolCreated(user_1, asset_a, HDX, 10_000).into(), frame_system::Event::NewAccount(pair_account).into(), + orml_tokens::Event::Endowed(asset_a, pair_account, 30000).into(), + orml_tokens::Event::Endowed(asset_b, pair_account, 60000).into(), + orml_tokens::Event::Endowed(1, 1, 60000).into(), Event::PoolCreated(user_1, asset_a, asset_b, 60_000).into(), Event::SellExecuted(user_1, asset_a, asset_b, 10_000, 14_991, asset_b, 10).into(), ]); @@ -803,6 +808,9 @@ fn single_buy_with_discount_should_work() { expect_events(vec![ Event::PoolCreated(user_1, asset_a, asset_b, 640_000_000_000).into(), frame_system::Event::NewAccount(native_pair_account).into(), + orml_tokens::Event::Endowed(asset_a, 1003000, 50000000000).into(), + orml_tokens::Event::Endowed(1000, 1003000, 100000000000).into(), + orml_tokens::Event::Endowed(1, 1, 100000000000).into(), Event::PoolCreated(user_1, asset_a, HDX, 100_000_000_000).into(), Event::BuyExecuted( user_1, @@ -1021,6 +1029,9 @@ fn destroy_pool_on_remove_liquidity_and_recreate_should_work() { Event::LiquidityRemoved(user, asset_a, asset_b, 100_000_000).into(), Event::PoolDestroyed(user, asset_a, asset_b).into(), frame_system::Event::NewAccount(pair_account).into(), + orml_tokens::Event::Endowed(asset_a, pair_account, 100000000).into(), + orml_tokens::Event::Endowed(asset_b, pair_account, 1000000000000).into(), + orml_tokens::Event::Endowed(0, 1, 100000000).into(), Event::PoolCreated(user, asset_a, asset_b, 100_000_000).into(), ]); }); From ec51184bfd1ef744c7f51dd3233b8e56f70635cc Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Sun, 27 Jun 2021 08:18:10 +0200 Subject: [PATCH 08/11] fix deps after merge --- runtime/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index d0d0f8390..9bcfa355c 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -47,7 +47,6 @@ orml-traits = {default-features = false, version = '0.4.1-dev'} pallet-authority-discovery = {default-features = false, version = '3.0.0'} pallet-authorship = {default-features = false, version = '3.0.0'} pallet-babe = {default-features = false, version = '3.0.0'} -pallet-balances = {default-features = false, version = "3.0.0"} pallet-collective = {default-features = false, version = '3.0.0'} pallet-democracy = {default-features = false, version = '3.0.0'} pallet-election-provider-multi-phase = {default-features = false, version = '3.0.0'} From a701b3c05f1e1184514a2ab27d122f9a6d64f061 Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Sun, 27 Jun 2021 08:34:11 +0200 Subject: [PATCH 09/11] fix incorrect merge confict resolution --- Cargo.lock | 2 -- runtime/src/lib.rs | 1 - 2 files changed, 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 90de5c925..64960ec94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4201,7 +4201,6 @@ dependencies = [ [[package]] name = "pallet-balances" version = "3.0.0" - source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.5#9c572625f6557dfdb19f47474369a0327d51dfbc" dependencies = [ "frame-benchmarking", @@ -4228,7 +4227,6 @@ dependencies = [ "orml-traits", "orml-utilities", "pallet-balances", - "parity-scale-codec 2.1.3", "primitives", "rustc-hex", diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index fecaca3b7..fbe4405ab 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -209,7 +209,6 @@ impl Filter for BaseFilter { | Call::Sudo(_) => true, Call::XYK(_) - | Call::Balances(_) | Call::AssetRegistry(_) | Call::Balances(_) | Call::Currencies(_) From dc6dc703855e5fd6c8f25c60ae77b7944bde975d Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Sun, 27 Jun 2021 11:38:04 +0200 Subject: [PATCH 10/11] bump version --- Cargo.lock | 2 +- runtime/Cargo.toml | 2 +- runtime/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 64960ec94..894f772e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2394,7 +2394,7 @@ dependencies = [ [[package]] name = "hydra-dx-runtime" -version = "17.0.0" +version = "18.0.0" dependencies = [ "frame-benchmarking", "frame-executive", diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 9bcfa355c..18c8d84a9 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -5,7 +5,7 @@ homepage = 'https://github.com/galacticcouncil/hydradx-node' license = 'Apache 2.0' name = 'hydra-dx-runtime' repository = 'https://github.com/galacticcouncil/hydradx-node' -version = '17.0.0' +version = '18.0.0' [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index fbe4405ab..faeeefc6b 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -148,7 +148,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydra-dx"), impl_name: create_runtime_str!("hydra-dx"), authoring_version: 1, - spec_version: 17, + spec_version: 18, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 59dbf9d6beff8d5b0f7fdf37746fe1131a42fbd5 Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Sun, 27 Jun 2021 14:20:02 +0200 Subject: [PATCH 11/11] bump node version --- node/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/Cargo.toml b/node/Cargo.toml index 5db36d662..0ea52eb90 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -7,7 +7,7 @@ homepage = 'https://github.com/galacticcouncil/hydradx-node' license = 'Apache 2.0' name = 'hydra-dx' repository = 'https://github.com/galacticcouncil/hydradx-node' -version = '5.1.0' +version = '6.0.0' [[bin]] name = 'hydra-dx'