From 8eaa3572a71aa3e7ec0754298ed82f48355bfd91 Mon Sep 17 00:00:00 2001 From: librelois <c@elo.tf> Date: Wed, 14 Jul 2021 12:13:46 +0200 Subject: [PATCH] poc universal dividend --- Cargo.lock | 1255 +++++++++-------- Cargo.toml | 13 +- README.md | 28 +- node/Cargo.toml | 214 ++- node/build.rs | 16 - node/src/chain_spec.rs | 138 +- node/src/cli.rs | 16 - node/src/command.rs | 32 +- node/src/lib.rs | 16 - node/src/main.rs | 16 - node/src/rpc.rs | 20 +- node/src/service.rs | 158 ++- pallets/identity/Cargo.toml | 81 ++ pallets/identity/README.md | 1 + pallets/identity/src/lib.rs | 626 ++++++++ pallets/identity/src/mock.rs | 145 ++ pallets/identity/src/tests.rs | 103 ++ pallets/identity/src/traits.rs | 135 ++ pallets/ud-accounts-storage/Cargo.toml | 78 + pallets/ud-accounts-storage/src/lib.rs | 179 +++ pallets/universal-dividend/Cargo.toml | 83 ++ .../universal-dividend/src/benchmarking.rs | 52 + pallets/universal-dividend/src/lib.rs | 249 ++++ pallets/universal-dividend/src/mock.rs | 142 ++ pallets/universal-dividend/src/tests.rs | 107 ++ runtime/Cargo.toml | 308 +++- runtime/src/authorizations.rs | 41 + runtime/src/entities.rs | 96 ++ runtime/src/handlers.rs | 42 + runtime/src/lib.rs | 153 +- rust-toolchain | 5 + scripts/docker_run.sh | 2 + types-bundle/types_definition.json | 35 + 33 files changed, 3576 insertions(+), 1009 deletions(-) create mode 100644 pallets/identity/Cargo.toml create mode 100644 pallets/identity/README.md create mode 100644 pallets/identity/src/lib.rs create mode 100644 pallets/identity/src/mock.rs create mode 100644 pallets/identity/src/tests.rs create mode 100644 pallets/identity/src/traits.rs create mode 100644 pallets/ud-accounts-storage/Cargo.toml create mode 100644 pallets/ud-accounts-storage/src/lib.rs create mode 100644 pallets/universal-dividend/Cargo.toml create mode 100644 pallets/universal-dividend/src/benchmarking.rs create mode 100644 pallets/universal-dividend/src/lib.rs create mode 100644 pallets/universal-dividend/src/mock.rs create mode 100644 pallets/universal-dividend/src/tests.rs create mode 100644 runtime/src/authorizations.rs create mode 100644 runtime/src/entities.rs create mode 100644 runtime/src/handlers.rs create mode 100644 rust-toolchain create mode 100644 types-bundle/types_definition.json diff --git a/Cargo.lock b/Cargo.lock index 3208cd03e..5d85d56b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "Inflector" version = "0.11.4" @@ -12,20 +14,11 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" -dependencies = [ - "gimli 0.23.0", -] - -[[package]] -name = "addr2line" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03345e98af8f3d786b6d9f656ccfa6ac316d954e92bc4841f0bba20789d5fb5a" +checksum = "e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a" dependencies = [ - "gimli 0.24.0", + "gimli", ] [[package]] @@ -103,17 +96,6 @@ 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" @@ -134,24 +116,15 @@ 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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" -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", ] @@ -179,9 +152,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" @@ -232,12 +205,11 @@ dependencies = [ [[package]] name = "async-io" -version = "1.4.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bbfd5cf2794b1e908ea8457e6c45f8f8f1f6ec5f74617bf4662623f47503c3b" +checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" dependencies = [ "concurrent-queue", - "fastrand", "futures-lite", "libc", "log", @@ -296,7 +268,7 @@ dependencies = [ "async-io", "async-lock", "async-process", - "crossbeam-utils 0.8.4", + "crossbeam-utils 0.8.5", "futures-channel", "futures-core", "futures-io", @@ -307,7 +279,7 @@ dependencies = [ "memchr", "num_cpus", "once_cell", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", "pin-utils", "slab", "wasm-bindgen-futures", @@ -354,7 +326,7 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", ] [[package]] @@ -367,7 +339,7 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", ] [[package]] @@ -404,16 +376,16 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.59" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4717cfcbfaa661a0fd48f8453951837ae7e8f81e481fbb136e3202d72805a744" +checksum = "b7815ea54e4d821e791162e078acbebfd6d8c8939cd559c9335dceb1c8ca7282" dependencies = [ - "addr2line 0.15.1", + "addr2line", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object 0.24.0", + "object 0.25.3", "rustc-demangle", ] @@ -532,9 +504,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", @@ -631,9 +603,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" @@ -716,9 +688,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", ] @@ -884,9 +856,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8" +checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" dependencies = [ "libc", ] @@ -899,38 +871,36 @@ 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", "cranelift-entity", - "gimli 0.23.0", + "gimli", "log", "regalloc", "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", @@ -938,27 +908,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", @@ -968,9 +938,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", @@ -978,14 +948,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", @@ -1009,7 +979,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.4", + "crossbeam-utils 0.8.5", ] [[package]] @@ -1030,8 +1000,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ "cfg-if 1.0.0", - "crossbeam-epoch 0.9.4", - "crossbeam-utils 0.8.4", + "crossbeam-epoch 0.9.5", + "crossbeam-utils 0.8.5", ] [[package]] @@ -1051,14 +1021,14 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52fb27eab85b17fbb9f6fd667089e07d6a2eb8743d02639ee7f6a7a7729c9c94" +checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.4", + "crossbeam-utils 0.8.5", "lazy_static", - "memoffset 0.6.3", + "memoffset 0.6.4", "scopeguard", ] @@ -1086,11 +1056,10 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4feb231f0d4d6af81aed15928e58ecf5816aa62a2393e2c82f46973e92a9a278" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" dependencies = [ - "autocfg", "cfg-if 1.0.0", "lazy_static", ] @@ -1185,9 +1154,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", @@ -1195,9 +1164,9 @@ 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", @@ -1205,9 +1174,9 @@ dependencies = [ [[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", @@ -1284,6 +1253,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" @@ -1373,9 +1348,9 @@ 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", ] @@ -1480,9 +1455,9 @@ dependencies = [ [[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.15", @@ -1500,7 +1475,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", ] @@ -1533,7 +1508,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "parity-scale-codec", ] @@ -1551,7 +1526,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "3.1.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-support", "frame-system", @@ -1570,7 +1545,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "Inflector", "chrono", @@ -1593,7 +1568,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-support", "frame-system", @@ -1608,7 +1583,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "13.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "parity-scale-codec", "serde", @@ -1619,13 +1594,14 @@ dependencies = [ [[package]] name = "frame-support" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "bitflags", "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", "log", + "max-encoded-len", "once_cell", "parity-scale-codec", "paste", @@ -1645,7 +1621,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -1657,7 +1633,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.0.0", @@ -1669,7 +1645,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "proc-macro2", "quote", @@ -1679,7 +1655,7 @@ dependencies = [ [[package]] name = "frame-system" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1696,7 +1672,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-benchmarking", "frame-support", @@ -1710,7 +1686,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "parity-scale-codec", "sp-api", @@ -1813,22 +1789,6 @@ 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.15", - "lazy_static", - "log", - "parking_lot 0.9.0", - "pin-project 0.4.28", - "serde", - "serde_json", -] - [[package]] name = "futures-executor" version = "0.3.15" @@ -1849,16 +1809,16 @@ 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", "futures-io", "memchr", "parking", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", "waker-fn", ] @@ -1925,7 +1885,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1947,15 +1907,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" @@ -1979,9 +1930,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", @@ -2000,21 +1951,15 @@ 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", "stable_deref_trait", ] -[[package]] -name = "gimli" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" - [[package]] name = "glob" version = "0.3.0" @@ -2023,9 +1968,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", @@ -2123,20 +2068,26 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + [[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", ] [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] @@ -2428,12 +2379,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.11.2", "serde", ] @@ -2494,9 +2445,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" @@ -2509,9 +2460,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", ] @@ -2738,6 +2689,86 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "lc-core" +version = "3.0.0" +dependencies = [ + "frame-benchmarking", + "frame-benchmarking-cli", + "jsonrpc-core", + "lc-core-runtime", + "maplit", + "pallet-transaction-payment-rpc", + "sc-basic-authorship", + "sc-cli", + "sc-client-api", + "sc-consensus", + "sc-consensus-aura", + "sc-executor", + "sc-finality-grandpa", + "sc-keystore", + "sc-rpc", + "sc-rpc-api", + "sc-service", + "sc-telemetry", + "sc-transaction-pool", + "serde_json", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-aura", + "sp-core", + "sp-finality-grandpa", + "sp-inherents", + "sp-runtime", + "sp-timestamp", + "sp-transaction-pool", + "structopt", + "substrate-build-script-utils", + "substrate-frame-rpc-system", +] + +[[package]] +name = "lc-core-runtime" +version = "3.0.0" +dependencies = [ + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "hex-literal", + "pallet-aura", + "pallet-balances", + "pallet-grandpa", + "pallet-identity", + "pallet-randomness-collective-flip", + "pallet-sudo", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-ud-accounts-storage", + "pallet-universal-dividend", + "parity-scale-codec", + "serde", + "smallvec 1.6.1", + "sp-api", + "sp-arithmetic", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "substrate-wasm-builder", +] + [[package]] name = "leb128" version = "0.2.4" @@ -2746,9 +2777,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" @@ -2975,7 +3006,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "rand 0.8.3", + "rand 0.8.4", "smallvec 1.6.1", "socket2 0.4.0", "void", @@ -3266,11 +3297,11 @@ dependencies = [ [[package]] name = "linregress" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b36162d2e1dcbdeb61223cb788f029f8ac9f2ab19969b89c5a8f4517aad4d940" +checksum = "1e6e407dadb4ca4b31bc69c27aff00e7ca4534fdcee855159b039a7cebb5f395" dependencies = [ - "nalgebra 0.25.4", + "nalgebra", "statrs", ] @@ -3308,7 +3339,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f374d42cdfc1d7dbf3d3dec28afab2eb97ffbf43a3234d795b5986dbf4b90ba" dependencies = [ - "hashbrown", + "hashbrown 0.9.1", ] [[package]] @@ -3358,20 +3389,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.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ - "rawpointer", + "impl-trait-for-tuples", + "max-encoded-len-derive", + "parity-scale-codec", + "primitive-types", +] + +[[package]] +name = "max-encoded-len-derive" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" +dependencies = [ + "proc-macro-crate 1.0.0", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -3388,9 +3432,9 @@ 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", ] @@ -3406,9 +3450,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", ] @@ -3420,7 +3464,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "814bbecfc0451fc314eeea34f05bbcd5b98a7ad7af37faee088b86a1e633f1d4" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.9.1", "parity-util-mem", ] @@ -3583,11 +3627,11 @@ dependencies = [ [[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", @@ -3617,37 +3661,31 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.19.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0abb021006c01b126a936a8dd1351e0720d83995f4fc942d0d426c654f990745" +checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" 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", + "matrixmultiply", + "nalgebra-macros", + "num-complex", + "num-rational 0.4.0", "num-traits", - "rand 0.7.3", + "rand 0.8.4", "rand_distr", + "simba", "typenum", ] [[package]] -name = "nalgebra" -version = "0.25.4" +name = "nalgebra-macros" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c70c9e8c5f213c8e93fc8c112ade4edd3ee62062fb897776c23dcebac7932900" +checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" dependencies = [ - "approx 0.4.0", - "generic-array 0.14.4", - "matrixmultiply 0.3.1", - "num-complex 0.3.1", - "num-rational 0.3.2", - "num-traits", - "serde", - "simba", - "typenum", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -3670,78 +3708,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "node-template" -version = "3.0.0" -dependencies = [ - "frame-benchmarking", - "frame-benchmarking-cli", - "jsonrpc-core", - "node-template-runtime", - "pallet-transaction-payment-rpc", - "sc-basic-authorship", - "sc-cli", - "sc-client-api", - "sc-consensus", - "sc-consensus-aura", - "sc-executor", - "sc-finality-grandpa", - "sc-keystore", - "sc-rpc", - "sc-rpc-api", - "sc-service", - "sc-telemetry", - "sc-transaction-pool", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-aura", - "sp-core", - "sp-finality-grandpa", - "sp-inherents", - "sp-runtime", - "sp-transaction-pool", - "structopt", - "substrate-build-script-utils", - "substrate-frame-rpc-system", -] - -[[package]] -name = "node-template-runtime" -version = "3.0.0" -dependencies = [ - "frame-benchmarking", - "frame-executive", - "frame-support", - "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "hex-literal", - "pallet-aura", - "pallet-balances", - "pallet-grandpa", - "pallet-randomness-collective-flip", - "pallet-sudo", - "pallet-template", - "pallet-timestamp", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "parity-scale-codec", - "sp-api", - "sp-block-builder", - "sp-consensus-aura", - "sp-core", - "sp-inherents", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-std", - "sp-transaction-pool", - "sp-version", - "substrate-wasm-builder", -] - [[package]] name = "nodrop" version = "0.1.14" @@ -3777,19 +3743,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" -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", ] @@ -3818,9 +3774,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" dependencies = [ "autocfg", "num-integer", @@ -3849,9 +3805,9 @@ 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", @@ -3859,15 +3815,18 @@ dependencies = [ [[package]] name = "object" -version = "0.24.0" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5b3dd1c072ee7963717671d1ca129f1048fda25edea6b752bfc71ac8854170" +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", ] @@ -3902,7 +3861,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-support", "frame-system", @@ -3918,14 +3877,13 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", "parity-scale-codec", "sp-authorship", - "sp-inherents", "sp-runtime", "sp-std", ] @@ -3933,12 +3891,13 @@ dependencies = [ [[package]] name = "pallet-balances" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", "log", + "max-encoded-len", "parity-scale-codec", "sp-runtime", "sp-std", @@ -3946,8 +3905,8 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +version = "3.1.0" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-benchmarking", "frame-support", @@ -3959,16 +3918,32 @@ dependencies = [ "sp-application-crypto", "sp-core", "sp-finality-grandpa", + "sp-io", "sp-runtime", "sp-session", "sp-staking", "sp-std", ] +[[package]] +name = "pallet-identity" +version = "3.0.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-randomness-collective-flip" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-support", "frame-system", @@ -3981,11 +3956,12 @@ dependencies = [ [[package]] name = "pallet-session" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", + "log", "pallet-timestamp", "parity-scale-codec", "sp-core", @@ -4000,7 +3976,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-support", "frame-system", @@ -4010,24 +3986,10 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-template" -version = "3.0.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "serde", - "sp-core", - "sp-io", - "sp-runtime", -] - [[package]] name = "pallet-timestamp" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-benchmarking", "frame-support", @@ -4045,7 +4007,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-support", "frame-system", @@ -4061,7 +4023,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4078,7 +4040,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -4086,11 +4048,44 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "pallet-ud-accounts-storage" +version = "3.0.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-balances", + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-universal-dividend" +version = "3.0.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-balances", + "parity-scale-codec", + "serde", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[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", @@ -4100,7 +4095,7 @@ dependencies = [ "log", "memmap2", "parking_lot 0.11.1", - "rand 0.8.3", + "rand 0.8.4", ] [[package]] @@ -4123,11 +4118,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", "byte-slice-cast", "parity-scale-codec-derive", @@ -4136,11 +4131,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", @@ -4178,7 +4173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "664a8c6b8e62d8f9f2f937e391982eb433ab285b4cd9545b342441e04a906e42" dependencies = [ "cfg-if 1.0.0", - "hashbrown", + "hashbrown 0.9.1", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot 0.11.1", @@ -4209,9 +4204,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" @@ -4307,7 +4302,7 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.2.8", + "redox_syscall 0.2.9", "smallvec 1.6.1", "winapi 0.3.9", ] @@ -4462,9 +4457,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" [[package]] name = "pin-utils" @@ -4486,14 +4481,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", ] @@ -4593,9 +4588,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", ] @@ -4667,22 +4662,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]] @@ -4762,14 +4757,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]] @@ -4784,12 +4779,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]] @@ -4818,20 +4813,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]] @@ -4845,11 +4841,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]] @@ -4869,9 +4865,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", @@ -4881,13 +4877,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.4", + "crossbeam-utils 0.8.5", "lazy_static", "num_cpus", ] @@ -4909,9 +4905,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" +checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" dependencies = [ "bitflags", ] @@ -4922,8 +4918,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.8", + "getrandom 0.2.3", + "redox_syscall 0.2.9", ] [[package]] @@ -4971,11 +4967,10 @@ 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", ] @@ -5059,9 +5054,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "410f7acf3cb3a44527c5d9546bad4bf4e6c460915d5f9f2fc524498bfe8f70ce" +checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" [[package]] name = "rustc-hash" @@ -5124,9 +5119,9 @@ dependencies = [ [[package]] name = "ruzstd" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d425143485a37727c7a46e689bbe3b883a00f42b4a52c4ac0f44855c1009b00" +checksum = "8cada0ef59efa6a5f4dc5e491f93d9f31e3fc7758df421ff1de8a706338e1100" dependencies = [ "byteorder", "twox-hash", @@ -5176,10 +5171,22 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "sc-allocator" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" +dependencies = [ + "log", + "sp-core", + "sp-std", + "sp-wasm-interface", + "thiserror", +] + [[package]] name = "sc-basic-authorship" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "futures 0.3.15", "futures-timer 3.0.2", @@ -5202,7 +5209,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5218,7 +5225,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5230,7 +5237,6 @@ dependencies = [ "sc-telemetry", "serde", "serde_json", - "sp-chain-spec", "sp-consensus-babe", "sp-core", "sp-runtime", @@ -5239,7 +5245,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -5250,7 +5256,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "chrono", "fdlimit", @@ -5288,7 +5294,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "derive_more", "fnv", @@ -5322,7 +5328,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "blake2-rfc", "hash-db", @@ -5352,8 +5358,9 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ + "async-trait", "parking_lot 0.11.1", "sc-client-api", "sp-blockchain", @@ -5364,7 +5371,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "async-trait", "derive_more", @@ -5388,7 +5395,6 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-timestamp", "sp-version", "substrate-prometheus-endpoint", ] @@ -5396,7 +5402,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "async-trait", "derive_more", @@ -5434,7 +5440,6 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-timestamp", "sp-utils", "sp-version", "substrate-prometheus-endpoint", @@ -5443,7 +5448,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "fork-tree", "parity-scale-codec", @@ -5456,11 +5461,12 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "async-trait", "futures 0.3.15", "futures-timer 3.0.2", + "impl-trait-for-tuples", "log", "parity-scale-codec", "sc-client-api", @@ -5483,28 +5489,25 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" 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.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "derive_more", "lazy_static", "libsecp256k1", "log", "parity-scale-codec", - "parity-wasm 0.41.0", + "parity-wasm 0.42.2", "parking_lot 0.11.1", "sc-executor-common", "sc-executor-wasmi", @@ -5513,7 +5516,6 @@ dependencies = [ "sp-core", "sp-externalities", "sp-io", - "sp-maybe-compressed-blob", "sp-panic-handler", "sp-runtime-interface", "sp-serializer", @@ -5527,14 +5529,14 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "derive_more", "parity-scale-codec", - "parity-wasm 0.41.0", "pwasm-utils", - "sp-allocator", + "sc-allocator", "sp-core", + "sp-maybe-compressed-blob", "sp-serializer", "sp-wasm-interface", "thiserror", @@ -5544,12 +5546,12 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "log", "parity-scale-codec", + "sc-allocator", "sc-executor-common", - "sp-allocator", "sp-core", "sp-runtime-interface", "sp-wasm-interface", @@ -5559,15 +5561,16 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ + "cfg-if 1.0.0", + "libc", "log", "parity-scale-codec", - "parity-wasm 0.41.0", - "pwasm-utils", + "parity-wasm 0.42.2", + "sc-allocator", "sc-executor-common", "scoped-tls", - "sp-allocator", "sp-core", "sp-runtime-interface", "sp-wasm-interface", @@ -5577,7 +5580,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "async-trait", "derive_more", @@ -5612,15 +5615,17 @@ dependencies = [ "sp-runtime", "sp-utils", "substrate-prometheus-endpoint", + "wasm-timer", ] [[package]] name = "sc-informant" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "ansi_term 0.12.1", "futures 0.3.15", + "futures-timer 3.0.2", "log", "parity-util-mem", "sc-client-api", @@ -5628,14 +5633,13 @@ 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.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "async-trait", "derive_more", @@ -5655,7 +5659,7 @@ dependencies = [ [[package]] name = "sc-light" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "hash-db", "lazy_static", @@ -5674,7 +5678,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "async-std", "async-trait", @@ -5727,7 +5731,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "futures 0.3.15", "futures-timer 3.0.2", @@ -5744,7 +5748,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "bytes 0.5.6", "fnv", @@ -5772,7 +5776,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "futures 0.3.15", "libp2p", @@ -5785,7 +5789,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -5794,7 +5798,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "futures 0.3.15", "hash-db", @@ -5804,6 +5808,7 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.11.1", "sc-block-builder", + "sc-chain-spec", "sc-client-api", "sc-executor", "sc-keystore", @@ -5812,7 +5817,6 @@ dependencies = [ "serde_json", "sp-api", "sp-blockchain", - "sp-chain-spec", "sp-core", "sp-keystore", "sp-offchain", @@ -5820,6 +5824,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-state-machine", + "sp-tracing", "sp-transaction-pool", "sp-utils", "sp-version", @@ -5828,7 +5833,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "derive_more", "futures 0.3.15", @@ -5839,12 +5844,13 @@ dependencies = [ "log", "parity-scale-codec", "parking_lot 0.11.1", + "sc-chain-spec", "serde", "serde_json", - "sp-chain-spec", "sp-core", "sp-rpc", "sp-runtime", + "sp-tracing", "sp-transaction-pool", "sp-version", ] @@ -5852,7 +5858,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "futures 0.1.31", "jsonrpc-core", @@ -5870,7 +5876,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "async-trait", "directories", @@ -5918,8 +5924,10 @@ dependencies = [ "sp-runtime", "sp-session", "sp-state-machine", + "sp-storage", "sp-tracing", "sp-transaction-pool", + "sp-transaction-storage-proof", "sp-trie", "sp-utils", "sp-version", @@ -5934,7 +5942,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "log", "parity-scale-codec", @@ -5949,7 +5957,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "chrono", "futures 0.3.15", @@ -5969,7 +5977,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "ansi_term 0.12.1", "atty", @@ -5980,23 +5988,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.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -6007,7 +6025,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "derive_more", "futures 0.3.15", @@ -6029,10 +6047,9 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "futures 0.3.15", - "futures-diagnose", "intervalier", "log", "parity-scale-codec", @@ -6075,7 +6092,6 @@ dependencies = [ "merlin", "rand 0.7.3", "rand_core 0.5.1", - "serde", "sha2 0.8.2", "subtle 2.4.0", "zeroize", @@ -6308,9 +6324,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", @@ -6318,27 +6334,27 @@ 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", ] [[package]] name = "signature" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0242b8e50dd9accdd56170e94ca1ebd223b098eb9c83539a6e367d0f36ae68" +checksum = "c19772be3c4dd2ceaacf03cb41d5885f2a02c4d8804884918e3a258480803335" [[package]] name = "simba" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5132a955559188f3d13c9ba831e77c802ddc8782783f050ed0c52f5988b95f4c" +checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" dependencies = [ - "approx 0.4.0", - "num-complex 0.3.1", + "approx", + "num-complex", "num-traits", "paste", ] @@ -6349,6 +6365,15 @@ 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" @@ -6419,22 +6444,10 @@ dependencies = [ "sha-1 0.9.6", ] -[[package]] -name = "sp-allocator" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" -dependencies = [ - "log", - "sp-core", - "sp-std", - "sp-wasm-interface", - "thiserror", -] - [[package]] name = "sp-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "hash-db", "log", @@ -6451,7 +6464,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "blake2-rfc", "proc-macro-crate 1.0.0", @@ -6463,8 +6476,9 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ + "max-encoded-len", "parity-scale-codec", "serde", "sp-core", @@ -6475,7 +6489,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "integer-sqrt", "num-traits", @@ -6489,8 +6503,9 @@ dependencies = [ [[package]] name = "sp-authorship" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ + "async-trait", "parity-scale-codec", "sp-inherents", "sp-runtime", @@ -6500,7 +6515,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "parity-scale-codec", "sp-api", @@ -6512,7 +6527,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "futures 0.3.15", "log", @@ -6527,19 +6542,10 @@ dependencies = [ "thiserror", ] -[[package]] -name = "sp-chain-spec" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" -dependencies = [ - "serde", - "serde_json", -] - [[package]] name = "sp-consensus" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "async-trait", "futures 0.3.15", @@ -6566,8 +6572,9 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ + "async-trait", "parity-scale-codec", "sp-api", "sp-application-crypto", @@ -6582,8 +6589,9 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ + "async-trait", "merlin", "parity-scale-codec", "serde", @@ -6603,7 +6611,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "parity-scale-codec", "sp-arithmetic", @@ -6613,7 +6621,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -6625,7 +6633,7 @@ dependencies = [ [[package]] name = "sp-core" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "base58", "blake2-rfc", @@ -6640,6 +6648,7 @@ dependencies = [ "lazy_static", "libsecp256k1", "log", + "max-encoded-len", "merlin", "num-traits", "parity-scale-codec", @@ -6669,7 +6678,7 @@ dependencies = [ [[package]] name = "sp-database" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "kvdb", "parking_lot 0.11.1", @@ -6678,7 +6687,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "proc-macro2", "quote", @@ -6688,7 +6697,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "environmental", "parity-scale-codec", @@ -6699,7 +6708,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "finality-grandpa", "log", @@ -6716,11 +6725,13 @@ dependencies = [ [[package]] name = "sp-inherents" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ + "async-trait", + "impl-trait-for-tuples", "parity-scale-codec", - "parking_lot 0.11.1", "sp-core", + "sp-runtime", "sp-std", "thiserror", ] @@ -6728,7 +6739,7 @@ dependencies = [ [[package]] name = "sp-io" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "futures 0.3.15", "hash-db", @@ -6739,6 +6750,7 @@ dependencies = [ "sp-core", "sp-externalities", "sp-keystore", + "sp-maybe-compressed-blob", "sp-runtime-interface", "sp-state-machine", "sp-std", @@ -6752,7 +6764,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "lazy_static", "sp-core", @@ -6763,7 +6775,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "async-trait", "derive_more", @@ -6780,7 +6792,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "ruzstd", "zstd", @@ -6789,7 +6801,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "sp-api", "sp-core", @@ -6799,7 +6811,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "backtrace", ] @@ -6807,21 +6819,24 @@ dependencies = [ [[package]] name = "sp-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ + "rustc-hash", "serde", "sp-core", + "tracing-core", ] [[package]] name = "sp-runtime" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", + "max-encoded-len", "parity-scale-codec", "parity-util-mem", "paste", @@ -6837,7 +6852,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -6854,7 +6869,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "Inflector", "proc-macro-crate 1.0.0", @@ -6866,7 +6881,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "serde", "serde_json", @@ -6875,7 +6890,7 @@ dependencies = [ [[package]] name = "sp-session" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "parity-scale-codec", "sp-api", @@ -6888,7 +6903,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -6898,7 +6913,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "hash-db", "log", @@ -6913,6 +6928,7 @@ dependencies = [ "sp-std", "sp-trie", "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -6920,12 +6936,12 @@ dependencies = [ [[package]] name = "sp-std" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" [[package]] name = "sp-storage" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "impl-serde", "parity-scale-codec", @@ -6938,7 +6954,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "log", "sp-core", @@ -6951,23 +6967,32 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ + "async-trait", + "futures-timer 3.0.2", + "log", "parity-scale-codec", "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.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ + "erased-serde", "log", "parity-scale-codec", + "parking_lot 0.10.2", + "serde", + "serde_json", + "slog", "sp-std", "tracing", "tracing-core", @@ -6977,7 +7002,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "derive_more", "futures 0.3.15", @@ -6990,10 +7015,25 @@ dependencies = [ "thiserror", ] +[[package]] +name = "sp-transaction-storage-proof" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" +dependencies = [ + "async-trait", + "log", + "parity-scale-codec", + "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.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "hash-db", "memory-db", @@ -7007,7 +7047,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "futures 0.3.15", "futures-core", @@ -7019,19 +7059,32 @@ dependencies = [ [[package]] name = "sp-version" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "impl-serde", "parity-scale-codec", "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.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" +dependencies = [ + "parity-scale-codec", + "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.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7059,12 +7112,15 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "statrs" -version = "0.13.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e34b58a8f9b7462b6922e0b4e3c83d1b3c2075f7f996a56d6c66afa81590064" +checksum = "05bdbb8e4e78216a85785a85d3ec3183144f98d0097b9281802c019bb07a6f05" dependencies = [ - "nalgebra 0.19.0", - "rand 0.7.3", + "approx", + "lazy_static", + "nalgebra", + "num-traits", + "rand 0.8.4", ] [[package]] @@ -7153,7 +7209,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "platforms", ] @@ -7161,7 +7217,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.15", @@ -7184,7 +7240,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "async-std", "derive_more", @@ -7198,7 +7254,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc86cdef0cba09336acffb08bff08540aa" +source = "git+https://github.com/paritytech/substrate.git?tag=monthly-2021-07#83808aa815a9fbc528b76cd25ae1dec57e269771" dependencies = [ "ansi_term 0.12.1", "atty", @@ -7225,9 +7281,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" +checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" dependencies = [ "proc-macro2", "quote", @@ -7260,9 +7316,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" @@ -7272,8 +7328,8 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand 0.8.3", - "redox_syscall 0.2.8", + "rand 0.8.4", + "redox_syscall 0.2.9", "remove_dir_all", "winapi 0.3.9", ] @@ -7298,18 +7354,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", @@ -7673,7 +7729,7 @@ checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", "tracing-attributes", "tracing-core", ] @@ -7731,9 +7787,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa5553bf0883ba7c9cbe493b085c29926bd41b66afc31ff72cf17ff4fb60dcd5" +checksum = "ab69019741fca4d98be3c62d2b75254528b5432233fd8a4d2739fec20278de48" dependencies = [ "ansi_term 0.12.1", "chrono", @@ -7753,12 +7809,12 @@ 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", + "hashbrown 0.9.1", "log", "rustc-hex", "smallvec 1.6.1", @@ -7790,7 +7846,7 @@ dependencies = [ "ipnet", "lazy_static", "log", - "rand 0.8.3", + "rand 0.8.4", "smallvec 1.6.1", "thiserror", "tinyvec", @@ -7847,9 +7903,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] name = "uint" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e" +checksum = "6470ab50f482bde894a037a57064480a246dbfdd5960bd65a44824693f08da5f" dependencies = [ "byteorder", "crunchy", @@ -7877,18 +7933,18 @@ 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", ] [[package]] name = "unicode-segmentation" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-width" @@ -7973,18 +8029,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" @@ -8148,38 +8205,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", @@ -8187,9 +8245,11 @@ dependencies = [ "cfg-if 1.0.0", "cpp_demangle", "indexmap", + "lazy_static", "libc", "log", "paste", + "psm", "region", "rustc-demangle", "serde", @@ -8208,9 +8268,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", @@ -8229,28 +8289,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 0.23.0", + "gimli", "more-asserts", - "object 0.23.0", + "object 0.24.0", "target-lexicon", "thiserror", "wasmparser", @@ -8259,16 +8320,15 @@ 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", "cranelift-wasm", - "gimli 0.23.0", + "gimli", "indexmap", "log", "more-asserts", @@ -8279,9 +8339,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", @@ -8290,11 +8350,11 @@ 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 0.14.1", + "addr2line", "anyhow", "cfg-if 1.0.0", "cranelift-codegen", @@ -8302,10 +8362,10 @@ dependencies = [ "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli 0.23.0", + "gimli", "log", "more-asserts", - "object 0.23.0", + "object 0.24.0", "rayon", "region", "serde", @@ -8323,13 +8383,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 0.23.0", + "object 0.24.0", "target-lexicon", "wasmtime-debug", "wasmtime-environ", @@ -8337,16 +8397,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 0.23.0", + "gimli", "lazy_static", "libc", - "object 0.23.0", + "object 0.24.0", "scroll", "serde", "target-lexicon", @@ -8356,10 +8416,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", @@ -8367,29 +8428,31 @@ 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", ] @@ -8424,10 +8487,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", ] @@ -8537,7 +8600,7 @@ dependencies = [ "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 28431094f..287482311 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,10 @@ -[profile.release] -panic = 'unwind' - [workspace] members = [ - 'node', - 'pallets/*', - 'runtime', + 'node', + 'pallets/identity', + 'pallets/ud-accounts-storage', + 'pallets/universal-dividend', + 'runtime', ] +[profile.release] +panic = 'unwind' diff --git a/README.md b/README.md index 2f882d415..816c5eb4d 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,7 @@ # Substrate Node Template -[](https://playground.substrate.dev/?deploy=node-template) - A fresh FRAME-based [Substrate](https://www.substrate.io/) node, ready for hacking :rocket: -## Getting Started - -Follow the steps below to get started with the Node Template, or get it up and running right from your browser -in just a few clicks using [Playground](https://playground.substrate.dev/) :hammer_and_wrench: - -### Using Nix - -Install [nix](https://nixos.org/) and optionally [direnv](https://github.com/direnv/direnv) and [lorri](https://github.com/target/lorri) for a fully plug -and play experience for setting up the development environment. To get all the correct dependencies activate direnv `direnv allow` and lorri `lorri shell`. - ### Rust Setup First, complete the [basic Rust setup instructions](./docs/rust-setup.md). @@ -41,7 +29,7 @@ Once the project has been built, the following command can be used to explore al subcommands: ```sh -./target/release/node-template -h +./target/release/lc-core -h ``` ## Run @@ -55,19 +43,19 @@ node. This command will start the single-node development chain with persistent state: ```bash -./target/release/node-template --dev +./target/release/lc-core --dev ``` Purge the development chain's state: ```bash -./target/release/node-template purge-chain --dev +./target/release/lc-core purge-chain --dev ``` Start the development chain with detailed logging: ```bash -RUST_LOG=debug RUST_BACKTRACE=1 ./target/release/node-template -lruntime=debug --dev +RUST_LOG=debug RUST_BACKTRACE=1 ./target/release/lc-core -lruntime=debug --dev ``` ### Connect with Polkadot-JS Apps Front-end @@ -123,7 +111,7 @@ After the node has been [built](#build), refer to the embedded documentation to capabilities and configuration parameters that it exposes: ```shell -./target/release/node-template --help +./target/release/lc-core --help ``` ### Runtime @@ -183,15 +171,15 @@ Then run the following command to start a single node development chain. ``` This command will firstly compile your code, and then start a local development network. You can -also replace the default command (`cargo build --release && ./target/release/node-template --dev --ws-external`) +also replace the default command (`cargo build --release && ./target/release/lc-core --dev --ws-external`) by appending your own. A few useful ones are as follow. ```bash # Run Substrate node without re-compiling -./scripts/docker_run.sh ./target/release/node-template --dev --ws-external +./scripts/docker_run.sh ./target/release/lc-core --dev --ws-external # Purge the local dev chain -./scripts/docker_run.sh ./target/release/node-template purge-chain --dev +./scripts/docker_run.sh ./target/release/lc-core purge-chain --dev # Check whether the code is compilable ./scripts/docker_run.sh cargo check diff --git a/node/Cargo.toml b/node/Cargo.toml index 3545e94d7..97009caec 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,59 +1,181 @@ +[features] +default = [] +runtime-benchmarks = ['lc-core-runtime/runtime-benchmarks'] + +[build-dependencies.substrate-build-script-utils] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + [package] -authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>', 'tuxmain <tuxmain@zettascript.org>'] +authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>'] build = 'build.rs' -description = 'PoC Substrate-based libre currency' +description = 'A fresh FRAME-based Substrate node, ready for hacking.' edition = '2018' homepage = 'https://substrate.dev' -license = 'AGPL v3' -name = 'node-template' -repository = 'https://forge.tedomum.net/axiom-team/substrate-libre-currency' +license = 'AGPL-3.0' +name = 'lc-core' +repository = 'https://github.com/substrate-developer-hub/substrate-lc-core/' version = '3.0.0' - -[[bin]] -name = 'node-template' - [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] -[build-dependencies] -substrate-build-script-utils = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} - [dependencies] jsonrpc-core = '15.1.0' structopt = '0.3.8' -# Substrate dependencies -frame-benchmarking = {version = '3.1.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -frame-benchmarking-cli = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -pallet-transaction-payment-rpc = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-basic-authorship = {version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-cli = {features = ['wasmtime'], version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-client-api = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-consensus = {version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-consensus-aura = {version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-executor = {features = ['wasmtime'], version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-finality-grandpa = {version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-keystore = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-rpc = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-rpc-api = {version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-service = {features = ['wasmtime'], version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-telemetry = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sc-transaction-pool = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-api = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-block-builder = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-blockchain = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-consensus = {version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-consensus-aura = {version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-core = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-finality-grandpa = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-inherents = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-runtime = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-transaction-pool = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -substrate-frame-rpc-system = {version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} - -# local dependencies -node-template-runtime = {version = '3.0.0', path = '../runtime'} +[dependencies.frame-benchmarking] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.1.0' -[features] -default = [] -runtime-benchmarks = ['node-template-runtime/runtime-benchmarks'] +[dependencies.frame-benchmarking-cli] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.lc-core-runtime] +path = '../runtime' +version = '3.0.0' + +[dependencies.maplit] +version = "1.0.2" + +[dependencies.pallet-transaction-payment-rpc] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sc-basic-authorship] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sc-cli] +features = ['wasmtime'] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sc-client-api] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sc-consensus] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sc-consensus-aura] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sc-executor] +features = ['wasmtime'] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sc-finality-grandpa] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sc-keystore] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sc-rpc] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sc-rpc-api] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sc-service] +features = ['wasmtime'] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sc-telemetry] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sc-transaction-pool] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.serde_json] +version = '1.0.64' + +[dependencies.sp-api] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-block-builder] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-blockchain] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-consensus] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sp-consensus-aura] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sp-core] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-finality-grandpa] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-inherents] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-runtime] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-timestamp] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-transaction-pool] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.substrate-frame-rpc-system] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[[bin]] +name = 'lc-core' diff --git a/node/build.rs b/node/build.rs index 06701a0ae..f9d839f9b 100644 --- a/node/build.rs +++ b/node/build.rs @@ -1,19 +1,3 @@ -// Copyright 2021 Axiom-Team -// -// This file is part of Substrate-Libre-Currency. -// -// Substrate-Libre-Currency is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License. -// -// Substrate-Libre-Currency is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. - use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; fn main() { diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index f2572fe94..7671f53c0 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -1,35 +1,24 @@ -// Copyright 2021 Axiom-Team -// -// This file is part of Substrate-Libre-Currency. -// -// Substrate-Libre-Currency is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License. -// -// Substrate-Libre-Currency is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. - -use node_template_runtime::{ - AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig, Signature, SudoConfig, - SystemConfig, WASM_BINARY, +use lc_core_runtime::{ + AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig, IdentityConfig, IdtyDid, + IdtyRight, IdtyValue, Planet, Signature, SudoConfig, SystemConfig, UdAccountsStorageConfig, + UniversalDividendConfig, WASM_BINARY, }; +use maplit::btreemap; use sc_service::ChainType; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{sr25519, Pair, Public}; use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_runtime::traits::{IdentifyAccount, Verify}; - -// The URL for the telemetry server. -// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; +use std::collections::BTreeMap; /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>; +const TOKEN_DECIMALS: usize = 2; +const TOKEN_SYMBOL: &str = "ĞT"; +// The URL for the telemetry server. +// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; + /// Generate a crypto pair from seed. pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public { TPublic::Pair::from_string(&format!("//{}", seed), None) @@ -52,6 +41,16 @@ pub fn authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) { (get_from_seed::<AuraId>(s), get_from_seed::<GrandpaId>(s)) } +/// Create a fake did (for dev and testnet) +fn did(u8_: u8) -> IdtyDid { + IdtyDid { + hash: sp_core::H256::repeat_byte(u8_), + planet: Planet::Earth, + latitude: 0, + longitude: 0, + } +} + pub fn development_config() -> Result<ChainSpec, String> { let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?; @@ -66,15 +65,14 @@ pub fn development_config() -> Result<ChainSpec, String> { wasm_binary, // Initial PoA authorities vec![authority_keys_from_seed("Alice")], + // Inital identities + btreemap![ + did(1) => get_account_id_from_seed::<sr25519::Public>("Alice"), + did(2) => get_account_id_from_seed::<sr25519::Public>("Bob"), + did(3) => get_account_id_from_seed::<sr25519::Public>("Charlie"), + ], // Sudo account get_account_id_from_seed::<sr25519::Public>("Alice"), - // Pre-funded accounts - vec![ - get_account_id_from_seed::<sr25519::Public>("Alice"), - get_account_id_from_seed::<sr25519::Public>("Bob"), - get_account_id_from_seed::<sr25519::Public>("Alice//stash"), - get_account_id_from_seed::<sr25519::Public>("Bob//stash"), - ], true, ) }, @@ -85,7 +83,15 @@ pub fn development_config() -> Result<ChainSpec, String> { // Protocol ID None, // Properties - None, + Some( + serde_json::json!({ + "tokenDecimals": TOKEN_DECIMALS, + "tokenSymbol": TOKEN_SYMBOL, + }) + .as_object() + .expect("must be a map") + .clone(), + ), // Extensions None, )) @@ -108,23 +114,17 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> { authority_keys_from_seed("Alice"), authority_keys_from_seed("Bob"), ], + // Initial identities + btreemap![ + did(1) => get_account_id_from_seed::<sr25519::Public>("Alice"), + did(2) => get_account_id_from_seed::<sr25519::Public>("Bob"), + did(3) => get_account_id_from_seed::<sr25519::Public>("Charlie"), + did(4) => get_account_id_from_seed::<sr25519::Public>("Dave"), + did(5) => get_account_id_from_seed::<sr25519::Public>("Eve"), + did(6) => get_account_id_from_seed::<sr25519::Public>("Ferdie"), + ], // Sudo account get_account_id_from_seed::<sr25519::Public>("Alice"), - // Pre-funded accounts - vec![ - get_account_id_from_seed::<sr25519::Public>("Alice"), - get_account_id_from_seed::<sr25519::Public>("Bob"), - get_account_id_from_seed::<sr25519::Public>("Charlie"), - get_account_id_from_seed::<sr25519::Public>("Dave"), - get_account_id_from_seed::<sr25519::Public>("Eve"), - get_account_id_from_seed::<sr25519::Public>("Ferdie"), - get_account_id_from_seed::<sr25519::Public>("Alice//stash"), - get_account_id_from_seed::<sr25519::Public>("Bob//stash"), - get_account_id_from_seed::<sr25519::Public>("Charlie//stash"), - get_account_id_from_seed::<sr25519::Public>("Dave//stash"), - get_account_id_from_seed::<sr25519::Public>("Eve//stash"), - get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"), - ], true, ) }, @@ -135,7 +135,15 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> { // Protocol ID None, // Properties - None, + Some( + serde_json::json!({ + "tokenDecimals": TOKEN_DECIMALS, + "tokenSymbol": TOKEN_SYMBOL, + }) + .as_object() + .expect("must be a map") + .clone(), + ), // Extensions None, )) @@ -145,36 +153,50 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> { fn testnet_genesis( wasm_binary: &[u8], initial_authorities: Vec<(AuraId, GrandpaId)>, + initial_identities: BTreeMap<IdtyDid, AccountId>, root_key: AccountId, - endowed_accounts: Vec<AccountId>, _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 { - // Configure endowed accounts with initial balance of 1 << 60. - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, 1 << 60)) - .collect(), + balances: BalancesConfig { + // Configure endowed accounts with initial balance of INITIAL_BALANCE. + balances: Vec::with_capacity(0), }, - pallet_aura: AuraConfig { + aura: AuraConfig { authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(), }, - pallet_grandpa: GrandpaConfig { + grandpa: GrandpaConfig { authorities: initial_authorities .iter() .map(|x| (x.1.clone(), 1)) .collect(), }, - pallet_sudo: SudoConfig { + sudo: SudoConfig { // Assign network admin rights. key: root_key, }, + identity: IdentityConfig { + identities: initial_identities + .iter() + .map(|(did, account)| { + ( + *did, + IdtyValue::new_valid(account.clone(), vec![IdtyRight::Ud]), + ) + }) + .collect(), + }, + ud_accounts_storage: UdAccountsStorageConfig { + ud_accounts: initial_identities.values().cloned().collect(), + }, + universal_dividend: UniversalDividendConfig { + first_ud: 1_000, + initial_monetary_mass: 0, + }, } } diff --git a/node/src/cli.rs b/node/src/cli.rs index fb2582f6a..c6f35151a 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -1,19 +1,3 @@ -// Copyright 2021 Axiom-Team -// -// This file is part of Substrate-Libre-Currency. -// -// Substrate-Libre-Currency is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License. -// -// Substrate-Libre-Currency is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. - use sc_cli::RunCmd; use structopt::StructOpt; diff --git a/node/src/command.rs b/node/src/command.rs index 047767c6a..da3062c92 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -1,23 +1,23 @@ -// Copyright 2017-2021 Parity Technologies (UK) Ltd. -// Copyright 2021 Axiom-Team -// -// This file is part of Substrate-Libre-Currency. -// -// Substrate-Libre-Currency is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License. +// 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 // -// Substrate-Libre-Currency is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. +// http://www.apache.org/licenses/LICENSE-2.0 // -// You should have received a copy of the GNU Affero General Public License -// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. +// 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. use crate::cli::{Cli, Subcommand}; use crate::{chain_spec, service}; -use node_template_runtime::Block; +use lc_core_runtime::Block; use sc_cli::{ChainSpec, Role, RuntimeVersion, SubstrateCli}; use sc_service::PartialComponents; @@ -57,7 +57,7 @@ impl SubstrateCli for Cli { } fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion { - &node_template_runtime::VERSION + &lc_core_runtime::VERSION } } diff --git a/node/src/lib.rs b/node/src/lib.rs index decdc601a..f117b8aae 100644 --- a/node/src/lib.rs +++ b/node/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright 2021 Axiom-Team -// -// This file is part of Substrate-Libre-Currency. -// -// Substrate-Libre-Currency is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License. -// -// Substrate-Libre-Currency is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. - pub mod chain_spec; pub mod rpc; pub mod service; diff --git a/node/src/main.rs b/node/src/main.rs index abe45962a..a4182cd57 100644 --- a/node/src/main.rs +++ b/node/src/main.rs @@ -1,19 +1,3 @@ -// Copyright 2021 Axiom-Team -// -// This file is part of Substrate-Libre-Currency. -// -// Substrate-Libre-Currency is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License. -// -// Substrate-Libre-Currency is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. - //! Substrate Node Template CLI library. #![warn(missing_docs)] diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 0aa8dbb3d..f1819a3bf 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -1,19 +1,3 @@ -// Copyright 2021 Axiom-Team -// -// This file is part of Substrate-Libre-Currency. -// -// Substrate-Libre-Currency is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License. -// -// Substrate-Libre-Currency is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. - //! A collection of node-specific RPC methods. //! Substrate provides the `sc-rpc` crate, which defines the core RPC layer //! used by Substrate nodes. This file extends those RPC definitions with @@ -23,7 +7,7 @@ use std::sync::Arc; -use node_template_runtime::{opaque::Block, AccountId, Balance, Index}; +use lc_core_runtime::{opaque::Block, AccountId, Balance, Index}; pub use sc_rpc_api::DenyUnsafe; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; @@ -68,7 +52,7 @@ where ))); io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new( - client.clone(), + client, ))); // Extend this RPC with a custom API by using the following syntax. diff --git a/node/src/service.rs b/node/src/service.rs index 8dca2cd09..25e0e810b 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -1,22 +1,6 @@ -// Copyright 2021 Axiom-Team -// -// This file is part of Substrate-Libre-Currency. -// -// Substrate-Libre-Currency is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License. -// -// Substrate-Libre-Currency is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. - //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. -use node_template_runtime::{self, opaque::Block, RuntimeApi}; +use lc_core_runtime::{self, opaque::Block, RuntimeApi}; use sc_client_api::{ExecutorProvider, RemoteBackend}; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; use sc_executor::native_executor_instance; @@ -25,16 +9,15 @@ use sc_finality_grandpa::SharedVoterState; use sc_keystore::LocalKeystore; use sc_service::{error::Error as ServiceError, Configuration, TaskManager}; use sc_telemetry::{Telemetry, TelemetryWorker}; +use sp_consensus::SlotData; use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; -use sp_inherents::InherentDataProviders; -use std::sync::Arc; -use std::time::Duration; +use std::{sync::Arc, time::Duration}; // Our native executor instance. native_executor_instance!( pub Executor, - node_template_runtime::api::dispatch, - node_template_runtime::native_version, + lc_core_runtime::api::dispatch, + lc_core_runtime::native_version, frame_benchmarking::benchmarking::HostFunctions, ); @@ -42,6 +25,7 @@ type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>; type FullBackend = sc_service::TFullBackend<Block>; type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>; +#[allow(clippy::type_complexity)] pub fn new_partial( config: &Configuration, ) -> Result< @@ -52,16 +36,11 @@ pub fn new_partial( sp_consensus::DefaultImportQueue<Block, FullClient>, sc_transaction_pool::FullPool<Block, FullClient>, ( - sc_consensus_aura::AuraBlockImport< + sc_finality_grandpa::GrandpaBlockImport< + FullBackend, Block, FullClient, - sc_finality_grandpa::GrandpaBlockImport< - FullBackend, - Block, - FullClient, - FullSelectChain, - >, - AuraPair, + FullSelectChain, >, sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>, Option<Telemetry>, @@ -70,11 +49,10 @@ pub fn new_partial( ServiceError, > { if config.keystore_remote.is_some() { - return Err(ServiceError::Other(format!( - "Remote Keystores are not supported." - ))); + return Err(ServiceError::Other( + "Remote Keystores are not supported.".to_owned(), + )); } - let inherent_data_providers = InherentDataProviders::new(); let telemetry = config .telemetry_endpoints @@ -105,7 +83,7 @@ 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(), ); @@ -116,22 +94,28 @@ pub fn new_partial( telemetry.as_ref().map(|x| x.handle()), )?; - let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( - grandpa_block_import.clone(), - client.clone(), - ); + let slot_duration = sc_consensus_aura::slot_duration(&*client)?.slot_duration(); let import_queue = - sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _>(ImportQueueParams { - block_import: aura_block_import.clone(), + sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _, _>(ImportQueueParams { + block_import: grandpa_block_import.clone(), justification_import: Some(Box::new(grandpa_block_import.clone())), client: client.clone(), - inherent_data_providers: inherent_data_providers.clone(), + create_inherent_data_providers: move |_, ()| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = + sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration( + *timestamp, + slot_duration, + ); + + Ok((timestamp, slot)) + }, spawner: &task_manager.spawn_essential_handle(), can_author_with: sp_consensus::CanAuthorWithNativeVersion::new( client.executor().clone(), ), - slot_duration: sc_consensus_aura::slot_duration(&*client)?, registry: config.prometheus_registry(), check_for_equivocation: Default::default(), telemetry: telemetry.as_ref().map(|x| x.handle()), @@ -145,12 +129,11 @@ pub fn new_partial( keystore_container, select_chain, transaction_pool, - inherent_data_providers, - other: (aura_block_import, grandpa_link, telemetry), + other: (grandpa_block_import, grandpa_link, telemetry), }) } -fn remote_keystore(_url: &String) -> Result<Arc<LocalKeystore>, &'static str> { +fn remote_keystore(_url: &str) -> Result<Arc<LocalKeystore>, &'static str> { // FIXME: here would the concrete keystore be built, // must return a concrete type (NOT `LocalKeystore`) that // implements `CryptoStore` and `SyncCryptoStore` @@ -167,7 +150,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> mut keystore_container, select_chain, transaction_pool, - inherent_data_providers, other: (block_import, grandpa_link, mut telemetry), } = new_partial(&config)?; @@ -188,7 +170,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> .extra_sets .push(sc_finality_grandpa::grandpa_peers_set_config()); - let (network, network_status_sinks, system_rpc_tx, network_starter) = + let (network, system_rpc_tx, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, client: client.clone(), @@ -240,7 +222,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> on_demand: None, remote_blockchain: None, backend, - network_status_sinks, system_rpc_tx, config, telemetry: telemetry.as_mut(), @@ -258,20 +239,35 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> let can_author_with = sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); - let aura = sc_consensus_aura::start_aura::<AuraPair, _, _, _, _, _, _, _, _, _>( + let slot_duration = sc_consensus_aura::slot_duration(&*client)?; + let raw_slot_duration = slot_duration.slot_duration(); + + let aura = sc_consensus_aura::start_aura::<AuraPair, _, _, _, _, _, _, _, _, _, _, _>( StartAuraParams { - slot_duration: sc_consensus_aura::slot_duration(&*client)?, - client: client.clone(), + slot_duration, + client, select_chain, block_import, proposer_factory, - inherent_data_providers: inherent_data_providers.clone(), + create_inherent_data_providers: move |_, ()| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = + sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration( + *timestamp, + raw_slot_duration, + ); + + Ok((timestamp, slot)) + }, force_authoring, backoff_authoring_blocks, keystore: keystore_container.sync_keystore(), can_author_with, sync_oracle: network.clone(), + justification_sync_link: network.clone(), block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32), + max_block_proposal_slot_portion: None, telemetry: telemetry.as_ref().map(|x| x.handle()), }, )?; @@ -298,7 +294,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> name: Some(name), observer_enabled: false, keystore, - is_authority: role.is_authority(), + local_role: role, telemetry: telemetry.as_ref().map(|x| x.handle()), }; @@ -365,38 +361,44 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light( config.transaction_pool.clone(), config.prometheus_registry(), - task_manager.spawn_handle(), + task_manager.spawn_essential_handle(), client.clone(), on_demand.clone(), )); - let (grandpa_block_import, _) = sc_finality_grandpa::block_import( + let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import( client.clone(), &(client.clone() as Arc<_>), - select_chain.clone(), + select_chain, telemetry.as_ref().map(|x| x.handle()), )?; - let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( - grandpa_block_import.clone(), - client.clone(), - ); + let slot_duration = sc_consensus_aura::slot_duration(&*client)?.slot_duration(); let import_queue = - sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _>(ImportQueueParams { - block_import: aura_block_import.clone(), - justification_import: Some(Box::new(grandpa_block_import.clone())), + sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _, _>(ImportQueueParams { + block_import: grandpa_block_import.clone(), + justification_import: Some(Box::new(grandpa_block_import)), client: client.clone(), - inherent_data_providers: InherentDataProviders::new(), + create_inherent_data_providers: move |_, ()| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = + sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration( + *timestamp, + slot_duration, + ); + + Ok((timestamp, slot)) + }, spawner: &task_manager.spawn_essential_handle(), can_author_with: sp_consensus::NeverCanAuthor, - slot_duration: sc_consensus_aura::slot_duration(&*client)?, registry: config.prometheus_registry(), check_for_equivocation: Default::default(), telemetry: telemetry.as_ref().map(|x| x.handle()), })?; - let (network, network_status_sinks, system_rpc_tx, network_starter) = + let (network, system_rpc_tx, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, client: client.clone(), @@ -416,6 +418,26 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> ); } + let enable_grandpa = !config.disable_grandpa; + if enable_grandpa { + let name = config.network.node_name.clone(); + + let config = sc_finality_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", + sc_finality_grandpa::run_grandpa_observer(config, grandpa_link, network.clone())?, + ); + } + sc_service::spawn_tasks(sc_service::SpawnTasksParams { remote_blockchain: Some(backend.remote_blockchain()), transaction_pool, @@ -427,12 +449,10 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> keystore: keystore_container.sync_keystore(), backend, network, - network_status_sinks, system_rpc_tx, telemetry: telemetry.as_mut(), })?; network_starter.start_network(); - Ok(task_manager) } diff --git a/pallets/identity/Cargo.toml b/pallets/identity/Cargo.toml new file mode 100644 index 000000000..c20edfc13 --- /dev/null +++ b/pallets/identity/Cargo.toml @@ -0,0 +1,81 @@ +[package] +authors = ['librelois <c@elo.tf>'] +description = 'FRAME pallet identity.' +edition = '2018' +homepage = 'https://substrate.dev' +license = 'AGPL-3.0' +name = 'pallet-identity' +readme = 'README.md' +repository = 'https://github.com/substrate-developer-hub/substrate-lc-core/' +version = '3.0.0' + +[features] +default = ['std'] +runtime-benchmarks = ['frame-benchmarking'] +std = [ + 'codec/std', + 'frame-support/std', + 'frame-system/std', + 'frame-benchmarking/std', + 'serde', + 'sp-core/std', + 'sp-runtime/std', + 'sp-std/std', +] +try-runtime = ['frame-support/try-runtime'] + +[dependencies.codec] +default-features = false +features = ['derive'] +package = 'parity-scale-codec' +version = '2.1.0' + +[dependencies.frame-benchmarking] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +optional = true +tag = 'monthly-2021-07' + +[dependencies.frame-support] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dependencies.frame-system] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dependencies.serde] +version = "1.0.101" +optional = true +features = ["derive"] + +[dependencies.sp-core] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dependencies.sp-runtime] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dependencies.sp-std] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +### DOC ### + +[package.metadata.docs.rs] +targets = ['x86_64-unknown-linux-gnu'] +[dev-dependencies.serde] +version = '1.0.119' + +### DEV ### + +[dev-dependencies.sp-io] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' diff --git a/pallets/identity/README.md b/pallets/identity/README.md new file mode 100644 index 000000000..8d751a422 --- /dev/null +++ b/pallets/identity/README.md @@ -0,0 +1 @@ +License: Unlicense \ No newline at end of file diff --git a/pallets/identity/src/lib.rs b/pallets/identity/src/lib.rs new file mode 100644 index 000000000..71edc8456 --- /dev/null +++ b/pallets/identity/src/lib.rs @@ -0,0 +1,626 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +#![cfg_attr(not(feature = "std"), no_std)] + +pub mod traits; + +#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + +/*#[cfg(feature = "runtime-benchmarks")] +mod benchmarking;*/ + +pub use pallet::*; + +use crate::traits::*; +use frame_support::dispatch::Weight; +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; +use sp_std::collections::btree_map::BTreeMap; +use sp_std::prelude::*; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + + /// Configure the pallet by specifying the parameters and types on which it depends. + #[pallet::config] + pub trait Config: frame_system::Config { + #[pallet::constant] + /// Period during which the owner can confirm the new identity. + type ConfirmPeriod: Get<Self::BlockNumber>; + /// Because this pallet emits events, it depends on the runtime's definition of an event. + type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>; + /// Origin allowed to add a right to an identity + type AddRightOrigin: EnsureOrigin<Self::Origin>; + /// Origin allowed to delete a right to an identity + type DelRightOrigin: EnsureOrigin<Self::Origin>; + /// Management of the authorizations of the different calls. (The default implementation only allows root) + type EnsureIdtyCallAllowed: EnsureIdtyCallAllowed<Self>; + /// Identity custom data + type IdtyData: IdtyData; + /// Identity decentralized identifier + type IdtyDid: IdtyDid; + /// Origin allowed to validate identity + type IdtyValidationOrigin: EnsureOrigin<Self::Origin>; + /// Rights that an identity can have + type IdtyRight: IdtyRight; + /// On identity confirmed by it's owner + type OnIdtyConfirmed: OnIdtyConfirmed<Self>; + /// On identity removed + type OnIdtyRemoved: OnIdtyRemoved<Self>; + /// On identity validated + type OnIdtyValidated: OnIdtyValidated<Self>; + /// On right key change + type OnRightKeyChange: OnRightKeyChange<Self>; + #[pallet::constant] + /// Maximum period of inactivity, after this period, the identity is permanently deleted + type MaxInactivityPeriod: Get<Self::BlockNumber>; + #[pallet::constant] + /// Period after which a non-validated identity is deleted + type ValidationPeriod: Get<Self::BlockNumber>; + } + + // STORAGE // + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet<T>(_); + + // 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)] + pub enum Releases { + V1_0_0, + } + impl Default for Releases { + fn default() -> Self { + Releases::V1_0_0 + } + } + + #[cfg_attr(feature = "std", derive(Deserialize, Serialize))] + #[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)] + pub enum IdtyStatus { + Created, + ConfirmedByOwner, + Validated, + } + impl Default for IdtyStatus { + fn default() -> Self { + IdtyStatus::Created + } + } + + #[cfg_attr(feature = "std", derive(Deserialize, Serialize))] + #[derive(Encode, Decode, Clone, PartialEq, Eq)] + pub struct IdtyValue<T: Config> { + pub owner_key: T::AccountId, + pub removable_on: Option<T::BlockNumber>, + pub rights: Vec<(T::IdtyRight, Option<T::AccountId>)>, + pub status: IdtyStatus, + pub data: T::IdtyData, + } + impl<T: Config> IdtyValue<T> { + pub fn new_valid(owner_key: T::AccountId, rights: Vec<T::IdtyRight>) -> Self { + Self { + owner_key, + removable_on: None, + rights: rights.into_iter().map(|right| (right, None)).collect(), + status: IdtyStatus::Validated, + data: T::IdtyData::default(), + } + } + } + impl<T: Config> Default for IdtyValue<T> { + fn default() -> Self { + Self { + owner_key: Default::default(), + removable_on: None, + rights: Default::default(), + status: Default::default(), + data: Default::default(), + } + } + } + impl<T: Config> IdtyValue<T> { + pub fn get_right_key(&self, right: T::IdtyRight) -> Option<T::AccountId> { + if let Ok(index) = self + .rights + .binary_search_by(|(right_, _)| right.cmp(right_)) + { + if self.rights[index].1.is_some() { + self.rights[index].1.clone() + } else if right.allow_owner_key() { + Some(self.owner_key.clone()) + } else { + None + } + } else { + None + } + } + } + + /// Storage version of the pallet. + #[pallet::storage] + pub(super) type StorageVersion<T: Config> = StorageValue<_, Releases, ValueQuery>; + + /// Identities + #[pallet::storage] + #[pallet::getter(fn identity)] + pub type Identities<T: Config> = + StorageMap<_, Blake2_128Concat, T::IdtyDid, IdtyValue<T>, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn identities_count)] + pub(super) type IdentitiesCount<T: Config> = StorageValue<_, u64, ValueQuery>; + + /// Identities by removed block + #[pallet::storage] + #[pallet::getter(fn removable_on)] + pub type IdentitiesRemovableOn<T: Config> = + StorageMap<_, Blake2_128Concat, T::BlockNumber, Vec<(T::IdtyDid, IdtyStatus)>, ValueQuery>; + + // GENESIS // + + #[pallet::genesis_config] + pub struct GenesisConfig<T: Config> { + pub identities: BTreeMap<T::IdtyDid, IdtyValue<T>>, + } + + #[cfg(feature = "std")] + impl<T: Config> Default for GenesisConfig<T> { + fn default() -> Self { + Self { + identities: Default::default(), + } + } + } + + #[pallet::genesis_build] + impl<T: Config> GenesisBuild<T> for GenesisConfig<T> { + fn build(&self) { + for idty_value in self.identities.values() { + if idty_value.status == IdtyStatus::Validated { + if idty_value.rights.is_empty() { + assert!(idty_value.removable_on.is_some()); + } else { + assert!(idty_value.removable_on.is_none()); + } + } else { + assert!(idty_value.removable_on.is_some()); + assert!(idty_value.rights.is_empty()) + } + } + + <StorageVersion<T>>::put(Releases::V1_0_0); + <IdentitiesCount<T>>::put(self.identities.len() as u64); + for (idty_did, idty_value) in &self.identities { + if let Some(removable_on) = idty_value.removable_on { + <IdentitiesRemovableOn<T>>::append(removable_on, (idty_did, idty_value.status)) + } + <Identities<T>>::insert(idty_did, idty_value); + } + } + } + + // HOOKS // + + #[pallet::hooks] + impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> { + fn on_initialize(n: T::BlockNumber) -> Weight { + Self::prune_identities(n) + } + } + + // EVENTS // + + // Pallets use events to inform users when important changes are made. + // https://substrate.dev/docs/en/knowledgebase/runtime/events + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + #[pallet::metadata( + T::IdtyDid = "IdtyDid", + T::IdtyRight = "IdtyRight", + T::AccountId = "AccountId" + )] + pub enum Event<T: Config> { + /// A new identity has been created + /// [idty, owner_key] + IdtyCreated(T::IdtyDid, T::AccountId), + /// An identity has been confirmed by it's owner + /// [idty] + IdtyConfirmed(T::IdtyDid), + /// An identity has been validated + /// [idty] + IdtyValidated(T::IdtyDid), + /// An identity was declared dead + /// [idty] + IdtyDead(T::IdtyDid), + /// An identity has acquired a new right + /// [idty, right] + IdtyAcquireRight(T::IdtyDid, T::IdtyRight), + /// An identity lost a right + /// [idty, righ] + IdtyLostRight(T::IdtyDid, T::IdtyRight), + /// An identity has modified a subkey associated with a right + /// [idty_did, right, old_subkey_opt, new_subkey_opt] + IdtySetRightSubKey( + T::IdtyDid, + T::IdtyRight, + Option<T::AccountId>, + Option<T::AccountId>, + ), + } + + // CALLS // + + // Dispatchable functions allows users to interact with the pallet and invoke state changes. + // These functions materialize as "extrinsics", which are often compared to transactions. + // Dispatchable functions must be annotated with a weight and must return a DispatchResult. + #[pallet::call] + impl<T: Config> Pallet<T> { + #[pallet::weight(0)] + pub fn create_identity( + origin: OriginFor<T>, + creator: T::IdtyDid, + idty_did: T::IdtyDid, + owner_key: T::AccountId, + ) -> DispatchResultWithPostInfo { + if !T::EnsureIdtyCallAllowed::create_identity(origin, &creator, &idty_did, &owner_key) { + return Err(Error::<T>::IdtyCreationNotAllowed.into()); + } + if <Identities<T>>::contains_key(&idty_did) { + return Err(Error::<T>::IdtyAlreadyExist.into()); + } + + let block_number = frame_system::pallet::Pallet::<T>::block_number(); + let removable_on = block_number + T::ConfirmPeriod::get(); + + <Identities<T>>::insert( + idty_did, + IdtyValue { + owner_key: owner_key.clone(), + removable_on: Some(removable_on), + ..Default::default() + }, + ); + IdentitiesRemovableOn::<T>::append(removable_on, (idty_did, IdtyStatus::Created)); + Self::inc_identities_counter(); + Self::deposit_event(Event::IdtyCreated(idty_did, owner_key)); + Ok(().into()) + } + #[pallet::weight(0)] + pub fn confirm_identity( + origin: OriginFor<T>, + idty_did: T::IdtyDid, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + + if let Ok(mut idty_value) = <Identities<T>>::try_get(idty_did) { + if who == idty_value.owner_key { + if idty_value.status != IdtyStatus::Created { + return Err(Error::<T>::IdtyAlreadyConfirmed.into()); + } + + let block_number = frame_system::pallet::Pallet::<T>::block_number(); + let removable_on = block_number + T::ValidationPeriod::get(); + idty_value.removable_on = Some(removable_on); + idty_value.status = IdtyStatus::ConfirmedByOwner; + let owner_key = idty_value.owner_key.clone(); + + <Identities<T>>::insert(idty_did, idty_value); + IdentitiesRemovableOn::<T>::append( + removable_on, + (idty_did, IdtyStatus::ConfirmedByOwner), + ); + Self::deposit_event(Event::IdtyConfirmed(idty_did)); + T::OnIdtyConfirmed::on_idty_confirmed(idty_did, owner_key, removable_on); + Ok(().into()) + } else { + Err(Error::<T>::RequireToBeOwner.into()) + } + } else { + Err(Error::<T>::IdtyNotFound.into()) + } + } + #[pallet::weight(0)] + pub fn validate_identity( + origin: OriginFor<T>, + idty_did: T::IdtyDid, + ) -> DispatchResultWithPostInfo { + T::IdtyValidationOrigin::ensure_origin(origin)?; + + if let Ok(mut idty_value) = <Identities<T>>::try_get(idty_did) { + match idty_value.status { + IdtyStatus::Created => Err(Error::<T>::IdtyNotConfirmedByOwner.into()), + IdtyStatus::ConfirmedByOwner => { + let block_number = frame_system::pallet::Pallet::<T>::block_number(); + let removable_on = block_number + T::MaxInactivityPeriod::get(); + idty_value.removable_on = Some(removable_on); + idty_value.status = IdtyStatus::Validated; + let owner_key = idty_value.owner_key.clone(); + + <Identities<T>>::insert(idty_did, idty_value); + <IdentitiesRemovableOn<T>>::append( + removable_on, + (idty_did, IdtyStatus::Validated), + ); + Self::deposit_event(Event::IdtyValidated(idty_did)); + T::OnIdtyValidated::on_idty_validated(idty_did, owner_key)?; + Ok(().into()) + } + IdtyStatus::Validated => Err(Error::<T>::IdtyAlreadyValidated.into()), + } + } else { + Err(Error::<T>::IdtyNotFound.into()) + } + } + #[pallet::weight(0)] + pub fn validate_identity_and_add_rights( + origin: OriginFor<T>, + idty_did: T::IdtyDid, + rights: Vec<T::IdtyRight>, + ) -> DispatchResultWithPostInfo { + T::IdtyValidationOrigin::ensure_origin(origin)?; + + if let Ok(mut idty_value) = <Identities<T>>::try_get(idty_did) { + match idty_value.status { + IdtyStatus::Created => Err(Error::<T>::IdtyNotConfirmedByOwner.into()), + IdtyStatus::ConfirmedByOwner => { + idty_value.removable_on = None; + idty_value.rights = rights.iter().map(|right| (*right, None)).collect(); + idty_value.status = IdtyStatus::Validated; + let owner_key = idty_value.owner_key.clone(); + + <Identities<T>>::insert(idty_did, idty_value); + Self::deposit_event(Event::IdtyValidated(idty_did)); + for right in rights { + Self::deposit_event(Event::IdtyAcquireRight(idty_did, right)); + } + T::OnIdtyValidated::on_idty_validated(idty_did, owner_key)?; + Ok(().into()) + } + IdtyStatus::Validated => Err(Error::<T>::IdtyAlreadyValidated.into()), + } + } else { + Err(Error::<T>::IdtyNotFound.into()) + } + } + #[pallet::weight(0)] + pub fn add_right( + origin: OriginFor<T>, + idty_did: T::IdtyDid, + right: T::IdtyRight, + ) -> DispatchResultWithPostInfo { + T::AddRightOrigin::ensure_origin(origin)?; + + if let Ok(mut idty_value) = <Identities<T>>::try_get(idty_did) { + if idty_value.status != IdtyStatus::Validated { + return Err(Error::<T>::IdtyNotValidated.into()); + } + + if let Err(index) = idty_value + .rights + .binary_search_by(|(right_, _)| right.cmp(right_)) + { + idty_value.removable_on = None; + idty_value.rights.insert(index, (right, None)); + + let new_key = if right.allow_owner_key() { + Some(idty_value.owner_key.clone()) + } else { + None + }; + + <Identities<T>>::insert(idty_did, idty_value); + Self::deposit_event(Event::<T>::IdtyAcquireRight(idty_did, right)); + if new_key.is_some() { + T::OnRightKeyChange::on_right_key_change(idty_did, right, None, new_key); + } + Ok(().into()) + } else { + Err(Error::<T>::RightAlreadyAdded.into()) + } + } else { + Err(Error::<T>::IdtyNotFound.into()) + } + } + #[pallet::weight(0)] + pub fn del_right( + origin: OriginFor<T>, + idty_did: T::IdtyDid, + right: T::IdtyRight, + ) -> DispatchResultWithPostInfo { + T::DelRightOrigin::ensure_origin(origin)?; + + if let Ok(mut idty_value) = <Identities<T>>::try_get(idty_did) { + if idty_value.status != IdtyStatus::Validated { + return Err(Error::<T>::IdtyNotValidated.into()); + } + + if let Ok(index) = idty_value + .rights + .binary_search_by(|(right_, _)| right.cmp(right_)) + { + let old_key_opt = if let Some(ref subkey) = idty_value.rights[index].1 { + Some(subkey.clone()) + } else if right.allow_owner_key() { + Some(idty_value.owner_key.clone()) + } else { + None + }; + idty_value.rights.remove(index); + + if idty_value.rights.is_empty() { + let block_number = frame_system::pallet::Pallet::<T>::block_number(); + let removable_on = block_number + T::MaxInactivityPeriod::get(); + idty_value.removable_on = Some(removable_on); + <IdentitiesRemovableOn<T>>::append( + removable_on, + (idty_did, IdtyStatus::Validated), + ); + } + + <Identities<T>>::insert(idty_did, idty_value); + Self::deposit_event(Event::<T>::IdtyLostRight(idty_did, right)); + if old_key_opt.is_some() { + T::OnRightKeyChange::on_right_key_change( + idty_did, + right, + old_key_opt, + None, + ); + } + Ok(().into()) + } else { + Err(Error::<T>::RightNotExist.into()) + } + } else { + Err(Error::<T>::IdtyNotFound.into()) + } + } + #[pallet::weight(0)] + pub fn set_right_subkey( + origin: OriginFor<T>, + idty_did: T::IdtyDid, + right: T::IdtyRight, + subkey_opt: Option<T::AccountId>, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + + if let Ok(mut idty_value) = <Identities<T>>::try_get(idty_did) { + if who == idty_value.owner_key { + if idty_value.status != IdtyStatus::Validated { + return Err(Error::<T>::IdtyNotValidated.into()); + } + + if let Ok(index) = idty_value + .rights + .binary_search_by(|(right_, _)| right.cmp(right_)) + { + let old_subkey_opt = idty_value.rights[index].1.clone(); + idty_value.rights[index].1 = subkey_opt.clone(); + let new_key = if let Some(ref subkey) = subkey_opt { + Some(subkey.clone()) + } else if right.allow_owner_key() { + Some(idty_value.owner_key.clone()) + } else { + None + }; + + <Identities<T>>::insert(idty_did, idty_value); + Self::deposit_event(Event::<T>::IdtySetRightSubKey( + idty_did, + right, + old_subkey_opt.clone(), + subkey_opt, + )); + T::OnRightKeyChange::on_right_key_change( + idty_did, + right, + old_subkey_opt, + new_key, + ); + Ok(().into()) + } else { + Err(Error::<T>::RightNotExist.into()) + } + } else { + Err(Error::<T>::RequireToBeOwner.into()) + } + } else { + Err(Error::<T>::IdtyNotFound.into()) + } + } + } + + // ERRORS // + + #[pallet::error] + pub enum Error<T> { + /// Identity already confirmed + IdtyAlreadyConfirmed, + /// Identity already exist + IdtyAlreadyExist, + /// Identity already validated + IdtyAlreadyValidated, + /// You are not allowed to create a new identity now + IdtyCreationNotAllowed, + /// Identity not confirmed by owner + IdtyNotConfirmedByOwner, + /// Identity not found + IdtyNotFound, + /// Identity not validated + IdtyNotValidated, + /// This operation requires to be the owner of the identity + RequireToBeOwner, + /// Right already added + RightAlreadyAdded, + /// Right not exist + RightNotExist, + } + + // INTERNAL FUNCTIONS // + + impl<T: Config> Pallet<T> { + fn dec_identities_counter() { + if let Ok(counter) = <IdentitiesCount<T>>::try_get() { + <IdentitiesCount<T>>::put(counter.saturating_sub(1)); + } else { + panic!("storage corrupted") + } + } + fn inc_identities_counter() { + if let Ok(counter) = <IdentitiesCount<T>>::try_get() { + <IdentitiesCount<T>>::put(counter.saturating_add(1)); + } else { + <IdentitiesCount<T>>::put(1); + } + } + fn prune_identities(block_number: T::BlockNumber) -> Weight { + let mut total_weight: Weight = 0; + + use frame_support::storage::generator::StorageMap as _; + if let Some(identities) = IdentitiesRemovableOn::<T>::from_query_to_optional_value( + IdentitiesRemovableOn::<T>::take(block_number), + ) { + for (idty_did, idty_status) in identities { + if let Ok(idty_val) = <Identities<T>>::try_get(idty_did) { + if idty_val.removable_on == Some(block_number) + && idty_val.status == idty_status + { + <Identities<T>>::remove(idty_did); + Self::dec_identities_counter(); + total_weight += + T::OnIdtyRemoved::on_idty_removed(idty_did, idty_val.owner_key); + } + } + } + } + + total_weight + } + } +} diff --git a/pallets/identity/src/mock.rs b/pallets/identity/src/mock.rs new file mode 100644 index 000000000..03ca27fd4 --- /dev/null +++ b/pallets/identity/src/mock.rs @@ -0,0 +1,145 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +use super::*; +use crate::{self as pallet_identity}; +use frame_support::{ + codec::{Decode, Encode}, + parameter_types, + traits::{OnFinalize, OnInitialize}, + RuntimeDebug, +}; +use frame_system as system; +use sp_core::H256; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, +}; + +type AccountId = u64; +type Block = frame_system::mocking::MockBlock<Test>; +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; + +#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] +#[derive(Encode, Decode, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, RuntimeDebug)] +pub struct IdtyDid(pub u64); +impl pallet_identity::traits::IdtyDid for IdtyDid {} + +#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] +#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, RuntimeDebug)] +pub enum IdtyRight { + Right1, + Right2, +} +impl Default for IdtyRight { + fn default() -> Self { + IdtyRight::Right1 + } +} +impl pallet_identity::traits::IdtyRight for IdtyRight { + fn allow_owner_key(self) -> bool { + self == Self::Right1 + } +} + +// Configure a mock runtime to test the pallet. +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, + Identity: pallet_identity::{Pallet, Call, Storage, Config<T>, Event<T>}, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 42; +} + +impl system::Config for Test { + type BaseCallFilter = (); + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type Origin = Origin; + type Call = Call; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup<Self::AccountId>; + type Header = Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; + type OnSetCode = (); +} + +parameter_types! { + pub const ConfirmPeriod: u64 = 2; + pub const MaxInactivityPeriod: u64 = 4; + pub const ValidationPeriod: u64 = 2; +} + +impl pallet_identity::Config for Test { + type ConfirmPeriod = ConfirmPeriod; + type Event = Event; + type AddRightOrigin = system::EnsureRoot<AccountId>; + type DelRightOrigin = system::EnsureRoot<AccountId>; + type EnsureIdtyCallAllowed = (); + type IdtyData = (); + type IdtyDid = IdtyDid; + type IdtyValidationOrigin = system::EnsureRoot<AccountId>; + type IdtyRight = IdtyRight; + type OnIdtyConfirmed = (); + type OnIdtyRemoved = (); + type OnIdtyValidated = (); + type OnRightKeyChange = (); + type MaxInactivityPeriod = MaxInactivityPeriod; + type ValidationPeriod = ValidationPeriod; +} + +// Build genesis storage according to the mock runtime. +pub fn new_test_ext(gen_conf: pallet_identity::GenesisConfig<Test>) -> sp_io::TestExternalities { + GenesisConfig { + system: SystemConfig::default(), + identity: gen_conf, + } + .build_storage() + .unwrap() + .into() +} + +pub fn run_to_block(n: u64) { + while System::block_number() < n { + Identity::on_finalize(System::block_number()); + System::on_finalize(System::block_number()); + System::set_block_number(System::block_number() + 1); + System::on_initialize(System::block_number()); + Identity::on_initialize(System::block_number()); + } +} diff --git a/pallets/identity/src/tests.rs b/pallets/identity/src/tests.rs new file mode 100644 index 000000000..f6cdf389d --- /dev/null +++ b/pallets/identity/src/tests.rs @@ -0,0 +1,103 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +use crate::mock::IdtyDid as Did; +use crate::mock::IdtyRight as Right; +use crate::mock::*; +use crate::Error; +use frame_support::assert_err; +use frame_support::assert_ok; +use frame_system::{EventRecord, Phase}; +use std::collections::BTreeMap; + +#[test] +fn test_no_identity() { + let identities = BTreeMap::new(); + new_test_ext(IdentityConfig { identities }).execute_with(|| { + assert_eq!(Identity::identities_count(), 0); + }); +} + +#[test] +fn test_two_identities() { + let mut identities = BTreeMap::new(); + identities.insert( + Did(1), + crate::IdtyValue { + owner_key: 1, + removable_on: None, + rights: vec![(Right::Right2, Some(10))], + status: crate::IdtyStatus::Validated, + }, + ); + identities.insert( + Did(2), + crate::IdtyValue { + owner_key: 2, + removable_on: None, + rights: vec![(Right::Right1, Some(20))], + status: crate::IdtyStatus::Validated, + }, + ); + new_test_ext(IdentityConfig { identities }).execute_with(|| { + // Should have two identities + assert_eq!(Identity::identities_count(), 2); + + // We need to initialize at least one block before any call + run_to_block(1); + + // Add right Right1 for Did(1) + // Should succes and trigger the correct event + assert_ok!(Identity::add_right(Origin::root(), Did(1), Right::Right1)); + let events = System::events(); + assert_eq!(events.len(), 1); + assert_eq!( + events[0], + EventRecord { + phase: Phase::Initialization, + event: Event::Identity(crate::Event::IdtyAcquireRight(Did(1), Right::Right1)), + topics: vec![], + } + ); + // Add right Right2 for Did(1) + // Should fail because Did(1) already have this right + assert_err!( + Identity::add_right(Origin::root(), Did(1), Right::Right2), + Error::<Test>::RightAlreadyAdded + ); + + run_to_block(3); + + // Delete right Right1 for Did(2) + // Should succes and trigger the correct event + assert_ok!(Identity::del_right(Origin::root(), Did(2), Right::Right1)); + let events = System::events(); + assert_eq!(events.len(), 2); + assert_eq!( + events[1], + EventRecord { + phase: Phase::Initialization, + event: Event::Identity(crate::Event::IdtyLostRight(Did(2), Right::Right1)), + topics: vec![], + } + ); + + // The Did(2) identity has no more rights, the inactivity period must start to run + let idty2 = Identity::identity(Did(2)); + assert!(idty2.rights.is_empty()); + assert_eq!(idty2.removable_on, Some(7)); + }); +} diff --git a/pallets/identity/src/traits.rs b/pallets/identity/src/traits.rs new file mode 100644 index 000000000..6fe563efb --- /dev/null +++ b/pallets/identity/src/traits.rs @@ -0,0 +1,135 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +use crate::*; +use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::*; +use sp_runtime::traits::MaybeSerializeDeserialize; +#[cfg(not(feature = "std"))] +use sp_std::fmt::Debug; +#[cfg(feature = "std")] +use std::fmt::Debug; + +pub trait EnsureIdtyCallAllowed<T: Config> { + fn create_identity( + origin: T::Origin, + creator: &T::IdtyDid, + idty_did: &T::IdtyDid, + idty_owner_key: &T::AccountId, + ) -> bool; +} +impl<T: Config> EnsureIdtyCallAllowed<T> for () { + fn create_identity( + origin: T::Origin, + _creator: &T::IdtyDid, + _idty_did: &T::IdtyDid, + _idty_owner_key: &T::AccountId, + ) -> bool { + ensure_root(origin).is_ok() + } +} + +pub trait IdtyData: + frame_support::Parameter + + frame_support::pallet_prelude::Member + + MaybeSerializeDeserialize + + Debug + + Default +{ +} +impl IdtyData for () {} + +pub trait IdtyDid: + frame_support::Parameter + + frame_support::pallet_prelude::Member + + MaybeSerializeDeserialize + + Debug + + Default + + Copy + + Ord +{ +} + +pub trait IdtyRight: + frame_support::Parameter + + frame_support::pallet_prelude::Member + + MaybeSerializeDeserialize + + Debug + + Default + + Copy + + Ord +{ + fn allow_owner_key(self) -> bool; +} + +pub trait OnIdtyConfirmed<T: Config> { + fn on_idty_confirmed( + idty_did: T::IdtyDid, + owner_key: T::AccountId, + removable_on: T::BlockNumber, + ); +} +impl<T: Config> OnIdtyConfirmed<T> for () { + fn on_idty_confirmed( + _idty_did: T::IdtyDid, + _owner_key: T::AccountId, + _removable_on: T::BlockNumber, + ) { + } +} + +pub trait OnIdtyValidated<T: Config> { + fn on_idty_validated( + idty_did: T::IdtyDid, + owner_key: T::AccountId, + ) -> DispatchResultWithPostInfo; +} +impl<T: Config> OnIdtyValidated<T> for () { + fn on_idty_validated( + _idty_did: T::IdtyDid, + _owner_key: T::AccountId, + ) -> DispatchResultWithPostInfo { + Ok(().into()) + } +} + +pub trait OnIdtyRemoved<T: Config> { + fn on_idty_removed(idty_did: T::IdtyDid, owner_key: T::AccountId) -> Weight; +} +impl<T: Config> OnIdtyRemoved<T> for () { + fn on_idty_removed(_idty_did: T::IdtyDid, _owner_key: T::AccountId) -> Weight { + 0 + } +} + +pub trait OnRightKeyChange<T: Config> { + fn on_right_key_change( + idty_did: T::IdtyDid, + right: T::IdtyRight, + old_key: Option<T::AccountId>, + new_key: Option<T::AccountId>, + ); +} + +impl<T: Config> OnRightKeyChange<T> for () { + fn on_right_key_change( + _idty_did: T::IdtyDid, + _right: T::IdtyRight, + _old_key: Option<T::AccountId>, + _new_key: Option<T::AccountId>, + ) { + } +} diff --git a/pallets/ud-accounts-storage/Cargo.toml b/pallets/ud-accounts-storage/Cargo.toml new file mode 100644 index 000000000..f6ca77c91 --- /dev/null +++ b/pallets/ud-accounts-storage/Cargo.toml @@ -0,0 +1,78 @@ +[package] +authors = ['librelois <c@elo.tf>'] +description = 'FRAME pallet universal dividend accounts storage.' +edition = '2018' +homepage = 'https://substrate.dev' +license = 'AGPL-3.0' +name = 'pallet-ud-accounts-storage' +readme = 'README.md' +repository = 'https://github.com/substrate-developer-hub/substrate-lc-core/' +version = '3.0.0' + +[features] +default = ['std'] +runtime-benchmarks = ['frame-benchmarking'] +std = [ + 'codec/std', + 'frame-support/std', + 'frame-system/std', + 'frame-benchmarking/std', + "sp-std/std", +] +try-runtime = ['frame-support/try-runtime'] + +[dependencies.codec] +default-features = false +features = ['derive'] +package = 'parity-scale-codec' +version = '2.1.0' + +[dependencies.frame-benchmarking] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +optional = true +tag = 'monthly-2021-07' + +[dependencies.frame-support] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dependencies.frame-system] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dependencies.sp-std] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +### DOC ### + +[package.metadata.docs.rs] +targets = ['x86_64-unknown-linux-gnu'] +[dev-dependencies.serde] +version = '1.0.119' + +### DEV ### + +[dev-dependencies.pallet-balances] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dev-dependencies.sp-core] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dev-dependencies.sp-io] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dev-dependencies.sp-runtime] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' diff --git a/pallets/ud-accounts-storage/src/lib.rs b/pallets/ud-accounts-storage/src/lib.rs new file mode 100644 index 000000000..d9795d349 --- /dev/null +++ b/pallets/ud-accounts-storage/src/lib.rs @@ -0,0 +1,179 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +#![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::unused_unit)] + +pub use pallet::*; + +/*#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking;*/ + +use sp_std::prelude::*; + +#[frame_support::pallet] +pub mod pallet { + use sp_std::collections::btree_set::BTreeSet; + + use super::*; + use frame_support::pallet_prelude::*; + + // CONFIG // + + #[pallet::config] + pub trait Config: frame_system::Config {} + + // STORAGE // + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet<T>(_); + + // 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)] + pub enum Releases { + V1_0_0, + } + impl Default for Releases { + fn default() -> Self { + Releases::V1_0_0 + } + } + + /// Storage version of the pallet. + #[pallet::storage] + pub(super) type StorageVersion<T: Config> = StorageValue<_, Releases, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn ud_accounts)] + pub type UdAccounts<T: Config> = StorageMap<_, Blake2_128Concat, T::AccountId, (), ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn ud_accounts_count)] + pub(super) type UdAccountsCounter<T: Config> = StorageValue<_, u64, ValueQuery>; + + // GENESIS // + + #[pallet::genesis_config] + pub struct GenesisConfig<T: Config> { + pub ud_accounts: BTreeSet<T::AccountId>, + } + + #[cfg(feature = "std")] + impl<T: Config> Default for GenesisConfig<T> { + fn default() -> Self { + Self { + ud_accounts: Default::default(), + } + } + } + + #[pallet::genesis_build] + impl<T: Config> GenesisBuild<T> for GenesisConfig<T> { + fn build(&self) { + <StorageVersion<T>>::put(Releases::V1_0_0); + <UdAccountsCounter<T>>::put(self.ud_accounts.len() as u64); + for account in &self.ud_accounts { + <UdAccounts<T>>::insert(account, ()); + } + } + } + + // PUBLIC FUNCTIONS // + + impl<T: Config> Pallet<T> { + pub fn account_list() -> Vec<T::AccountId> { + <UdAccounts<T>>::iter().map(|(k, _v)| k).collect() + } + pub fn replace_account( + old_account_opt: Option<T::AccountId>, + new_account_opt: Option<T::AccountId>, + ) -> Weight { + if let Some(old_account) = old_account_opt { + if let Some(new_account) = new_account_opt { + Self::replace_account_inner(old_account, new_account) + } else { + Self::del_account(old_account) + } + } else if let Some(new_account) = new_account_opt { + Self::add_account(new_account) + } else { + 0 + } + } + fn replace_account_inner(old_account: T::AccountId, new_account: T::AccountId) -> Weight { + if <UdAccounts<T>>::contains_key(&old_account) { + if !<UdAccounts<T>>::contains_key(&new_account) { + <UdAccounts<T>>::remove(&old_account); + <UdAccounts<T>>::insert(&new_account, ()); + } else { + frame_support::runtime_print!( + "ERROR: replace_account(): new_account {:?} already added", + new_account + ); + } + } else { + frame_support::runtime_print!( + "ERROR: replace_account(): old_account {:?} already deleted", + old_account + ); + } + 0 + } + fn add_account(account: T::AccountId) -> Weight { + if !<UdAccounts<T>>::contains_key(&account) { + <UdAccounts<T>>::insert(&account, ()); + if let Ok(counter) = <UdAccountsCounter<T>>::try_get() { + <UdAccountsCounter<T>>::put(counter.saturating_add(1)); + } else { + <UdAccountsCounter<T>>::put(1); + } + } else { + frame_support::runtime_print!( + "ERROR: add_account(): account {:?} already added", + account + ); + } + 0 + } + fn del_account(account: T::AccountId) -> Weight { + if <UdAccounts<T>>::contains_key(&account) { + <UdAccounts<T>>::remove(&account); + if let Ok(counter) = <UdAccountsCounter<T>>::try_get() { + <UdAccountsCounter<T>>::put(counter.saturating_sub(1)); + } else { + frame_support::runtime_print!( + "FATAL ERROR: del_account(): UdAccountsCounter is None!" + ); + } + } else { + frame_support::runtime_print!( + "ERROR: del_account(): account {:?} already deleted", + account + ); + } + 0 + } + } +} diff --git a/pallets/universal-dividend/Cargo.toml b/pallets/universal-dividend/Cargo.toml new file mode 100644 index 000000000..72ffdb2b8 --- /dev/null +++ b/pallets/universal-dividend/Cargo.toml @@ -0,0 +1,83 @@ +[package] +authors = ['librelois <c@elo.tf>'] +description = 'FRAME pallet universal dividend.' +edition = '2018' +homepage = 'https://substrate.dev' +license = 'AGPL-3.0' +name = 'pallet-universal-dividend' +repository = 'https://github.com/substrate-developer-hub/substrate-lc-core/' +version = '3.0.0' + +[features] +default = ['std'] +runtime-benchmarks = ['frame-benchmarking'] +std = [ + 'codec/std', + 'frame-support/std', + 'frame-system/std', + 'frame-benchmarking/std', + "sp-arithmetic/std", + "sp-std/std", +] +try-runtime = ['frame-support/try-runtime'] + +[dependencies.codec] +default-features = false +features = ['derive'] +package = 'parity-scale-codec' +version = '2.1.0' + +[dependencies.frame-benchmarking] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +optional = true +tag = 'monthly-2021-07' + +[dependencies.frame-support] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dependencies.frame-system] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dependencies.sp-arithmetic] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dependencies.sp-std] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +### DOC ### + +[package.metadata.docs.rs] +targets = ['x86_64-unknown-linux-gnu'] +[dev-dependencies.serde] +version = '1.0.119' + +### DEV ### + +[dev-dependencies.pallet-balances] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dev-dependencies.sp-core] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dev-dependencies.sp-io] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dev-dependencies.sp-runtime] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' diff --git a/pallets/universal-dividend/src/benchmarking.rs b/pallets/universal-dividend/src/benchmarking.rs new file mode 100644 index 000000000..47d070dea --- /dev/null +++ b/pallets/universal-dividend/src/benchmarking.rs @@ -0,0 +1,52 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +//! Benchmarking setup for pallet-universal-dividend + +use super::*; + +#[allow(unused)] +use crate::Pallet as UniversalDividend; +use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller}; +use frame_system::RawOrigin; + +// Create state for use in `on_initialize`. +fn create_state<T: Config>(n: u32) -> Result<(), &'static str> { + <LastReevalStorage<T>>::put(LastReeval { + members_count: T::MembersCount::get(), + monetary_mass: T::Currency::total_issuance(), + ud_amount: new_ud_amount, + }); + Ok(()) +} + +benchmarks! { + create_ud { + run_to_block(2); + }: UniversalDividend::on_initialize() + verify { + assert_eq!(System::events().len(), 7); + } +} + +impl_benchmark_test_suite!( + UniversalDividend, + crate::mock::new_test_ext(UniversalDividendConfig { + first_ud: 1_000, + initial_monetary_mass: 0, + }), + crate::mock::Test, +); diff --git a/pallets/universal-dividend/src/lib.rs b/pallets/universal-dividend/src/lib.rs new file mode 100644 index 000000000..e6bf34952 --- /dev/null +++ b/pallets/universal-dividend/src/lib.rs @@ -0,0 +1,249 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +#![cfg_attr(not(feature = "std"), no_std)] + +pub use pallet::*; + +#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; + +use frame_support::traits::Currency; +use sp_arithmetic::{per_things::Permill, traits::Zero}; +use sp_std::prelude::*; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + + pub type BalanceOf<T> = + <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance; + + #[pallet::config] + pub trait Config: frame_system::Config { + /// Universal dividend creation period + const UD_CREATION_PERIOD: Self::BlockNumber; + /// Universal dividend reevaluation period (in number of creation period) + const UD_REEVAL_PERIOD: BalanceOf<Self>; + /// Universal dividend reevaluation period in number of blocks + /// Must be equal to UD_CREATION_PERIOD * UD_REEVAl_PERIOD + const UD_REEVAL_PERIOD_IN_BLOCKS: Self::BlockNumber; + + // The currency + type Currency: Currency<Self::AccountId>; + /// Because this pallet emits events, it depends on the runtime's definition of an event. + type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>; + /// Somethings that must provide the number of accounts allowed to create the universal dividend + type MembersCount: Get<BalanceOf<Self>>; + /// Somethings that must provide the list of accounts ids allowed to create the universal dividend + type MembersIds: Get<Vec<<Self as frame_system::Config>::AccountId>>; + #[pallet::constant] + /// Square of the money growth rate per ud reevaluation period + type SquareMoneyGrowthRate: Get<Permill>; + } + + // STORAGE // + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet<T>(_); + + // 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)] + pub enum Releases { + V1_0_0, + } + impl Default for Releases { + fn default() -> Self { + Releases::V1_0_0 + } + } + + /// Storage version of the pallet. + #[pallet::storage] + pub(super) type StorageVersion<T: Config> = StorageValue<_, Releases, ValueQuery>; + + #[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)] + pub struct LastReeval<T: Config> { + members_count: BalanceOf<T>, + monetary_mass: BalanceOf<T>, + ud_amount: BalanceOf<T>, + } + impl<T: Config> Default for LastReeval<T> { + fn default() -> Self { + Self { + monetary_mass: Default::default(), + members_count: Default::default(), + ud_amount: Default::default(), + } + } + } + + /// Last reevaluation + #[pallet::storage] + #[pallet::getter(fn last_reeval)] + pub type LastReevalStorage<T: Config> = StorageValue<_, LastReeval<T>, ValueQuery>; + + /// Total quantity of money created by universal dividend (does not take into account the possible destruction of money) + #[pallet::storage] + #[pallet::getter(fn total_money_created)] + pub type MonetaryMassStorage<T: Config> = StorageValue<_, BalanceOf<T>, ValueQuery>; + + // GENESIS + + #[pallet::genesis_config] + pub struct GenesisConfig<T: Config> { + pub first_ud: BalanceOf<T>, + pub initial_monetary_mass: BalanceOf<T>, + } + + #[cfg(feature = "std")] + impl<T: Config> Default for GenesisConfig<T> { + fn default() -> Self { + Self { + first_ud: Default::default(), + initial_monetary_mass: Default::default(), + } + } + } + + #[pallet::genesis_build] + impl<T: Config> GenesisBuild<T> for GenesisConfig<T> { + fn build(&self) { + assert!(!self.first_ud.is_zero()); + assert!(self.initial_monetary_mass >= T::Currency::total_issuance()); + + <StorageVersion<T>>::put(Releases::V1_0_0); + <LastReevalStorage<T>>::put(LastReeval { + monetary_mass: T::Currency::total_issuance(), + members_count: T::MembersCount::get(), + ud_amount: self.first_ud, + }); + <MonetaryMassStorage<T>>::put(self.initial_monetary_mass); + } + } + + // HOOKS // + + #[pallet::hooks] + impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> { + fn on_initialize(n: T::BlockNumber) -> Weight { + if (n % T::UD_CREATION_PERIOD).is_zero() { + let current_members_count = T::MembersCount::get(); + if (n % T::UD_REEVAL_PERIOD_IN_BLOCKS).is_zero() { + Self::reeval_ud(current_members_count) + Self::create_ud(current_members_count) + } else { + Self::create_ud(current_members_count) + } + } else { + 0 + } + } + } + + // EVENTS // + + // Pallets use events to inform users when important changes are made. + // https://substrate.dev/docs/en/knowledgebase/runtime/events + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + #[pallet::metadata(T::AccountId = "AccountId")] + pub enum Event<T: Config> { + /// A new universal dividend is created + /// [ud_amout, members_count] + NewUdCreated(BalanceOf<T>, BalanceOf<T>), + /// The universal dividend has been re-evaluated + /// [new_ud_amount, monetary_mass, members_count] + UdReevalued(BalanceOf<T>, BalanceOf<T>, BalanceOf<T>), + } + + // INTERNAL FUNCTIONS // + impl<T: Config> Pallet<T> { + fn create_ud(current_members_count: BalanceOf<T>) -> Weight { + let total_weight: Weight = 0; + + let LastReeval { ud_amount, .. } = + <LastReevalStorage<T>>::try_get().expect("corrupted storage"); + let mut monetary_mass = <MonetaryMassStorage<T>>::try_get().expect("corrupted storage"); + + for account_id in T::MembersIds::get() { + T::Currency::deposit_creating(&account_id, ud_amount); + monetary_mass += ud_amount; + } + + <MonetaryMassStorage<T>>::put(monetary_mass); + Self::deposit_event(Event::NewUdCreated(ud_amount, current_members_count)); + + total_weight + } + fn reeval_ud(current_members_count: BalanceOf<T>) -> Weight { + let total_weight: Weight = 0; + + let LastReeval { + members_count, + mut monetary_mass, + ud_amount, + } = <LastReevalStorage<T>>::try_get().expect("corrupted storage"); + + if monetary_mass.is_zero() { + monetary_mass = ud_amount * members_count; + } + + let new_ud_amount = Self::reeval_ud_formula( + ud_amount, + T::SquareMoneyGrowthRate::get(), + monetary_mass, + members_count, + T::UD_REEVAL_PERIOD, + ); + + Self::deposit_event(Event::UdReevalued( + new_ud_amount, + monetary_mass, + members_count, + )); + + let monetary_mass = <MonetaryMassStorage<T>>::try_get().expect("corrupted storage"); + <LastReevalStorage<T>>::put(LastReeval { + members_count: current_members_count, + monetary_mass, + ud_amount: new_ud_amount, + }); + + total_weight + } + fn reeval_ud_formula( + ud_t: BalanceOf<T>, + c_square: Permill, + monetary_mass: BalanceOf<T>, + members_count: BalanceOf<T>, + count_uds_beetween_two_reevals: BalanceOf<T>, // =(dt/udFrequency) + ) -> BalanceOf<T> { + // UD(t+1) = UD(t) + c² (M(t) / N(t)) / (dt/udFrequency) + ud_t + c_square * monetary_mass / (members_count * count_uds_beetween_two_reevals) + } + } +} diff --git a/pallets/universal-dividend/src/mock.rs b/pallets/universal-dividend/src/mock.rs new file mode 100644 index 000000000..0ae4a9605 --- /dev/null +++ b/pallets/universal-dividend/src/mock.rs @@ -0,0 +1,142 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +use super::*; +use crate::{self as pallet_universal_dividend}; +use frame_support::{ + parameter_types, + traits::{Get, OnFinalize, OnInitialize}, +}; +use frame_system as system; +use sp_core::H256; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, +}; + +type Balance = u64; +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; +type Block = frame_system::mocking::MockBlock<Test>; + +// Configure a mock runtime to test the pallet. +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, + Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, + UniversalDividend: pallet_universal_dividend::{Pallet, Call, Storage, Config<T>, Event<T>}, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 42; +} + +impl system::Config for Test { + type BaseCallFilter = (); + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type Origin = Origin; + type Call = Call; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup<Self::AccountId>; + type Header = Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData<Balance>; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; + type OnSetCode = (); +} + +parameter_types! { + pub const ExistentialDeposit: Balance = 1; + pub const MaxLocks: u32 = 50; +} + +impl pallet_balances::Config for Test { + type Balance = Balance; + type DustRemoval = (); + type Event = Event; + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = pallet_balances::weights::SubstrateWeight<Test>; + type MaxLocks = MaxLocks; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; +} + +parameter_types! { + pub const MembersCount: u64 = 3; + pub const SquareMoneyGrowthRate: Permill = Permill::from_percent(10); +} + +pub struct FakeWot; +impl Get<Vec<u64>> for FakeWot { + fn get() -> Vec<u64> { + vec![1, 2, 3] + } +} + +impl pallet_universal_dividend::Config for Test { + const UD_CREATION_PERIOD: Self::BlockNumber = 2; + const UD_REEVAL_PERIOD: Balance = 4; + const UD_REEVAL_PERIOD_IN_BLOCKS: Self::BlockNumber = 8; // 2 * 4 + + type Currency = pallet_balances::Pallet<Test>; + type Event = Event; + type MembersCount = MembersCount; + type MembersIds = FakeWot; + type SquareMoneyGrowthRate = SquareMoneyGrowthRate; +} + +// Build genesis storage according to the mock runtime. +pub fn new_test_ext( + gen_conf: pallet_universal_dividend::GenesisConfig<Test>, +) -> sp_io::TestExternalities { + GenesisConfig { + system: SystemConfig::default(), + balances: BalancesConfig::default(), + universal_dividend: gen_conf, + } + .build_storage() + .unwrap() + .into() +} + +pub fn run_to_block(n: u64) { + while System::block_number() < n { + UniversalDividend::on_finalize(System::block_number()); + System::on_finalize(System::block_number()); + System::set_block_number(System::block_number() + 1); + System::on_initialize(System::block_number()); + UniversalDividend::on_initialize(System::block_number()); + } +} diff --git a/pallets/universal-dividend/src/tests.rs b/pallets/universal-dividend/src/tests.rs new file mode 100644 index 000000000..45b77703e --- /dev/null +++ b/pallets/universal-dividend/src/tests.rs @@ -0,0 +1,107 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +use crate::mock::*; +use frame_system::{EventRecord, Phase}; + +#[test] +fn test_ud_creation() { + new_test_ext(UniversalDividendConfig { + first_ud: 1_000, + initial_monetary_mass: 0, + }) + .execute_with(|| { + // In the beginning there was no money + assert_eq!(Balances::free_balance(1), 0); + assert_eq!(Balances::free_balance(2), 0); + assert_eq!(Balances::free_balance(3), 0); + assert_eq!(Balances::free_balance(4), 0); + assert_eq!(UniversalDividend::total_money_created(), 0); + + // The first UD must be created in block #2 + run_to_block(2); + assert_eq!(Balances::free_balance(1), 1_000); + assert_eq!(Balances::free_balance(2), 1_000); + assert_eq!(Balances::free_balance(3), 1_000); + assert_eq!(Balances::free_balance(4), 0); + assert_eq!(UniversalDividend::total_money_created(), 3_000); + + // Block #2 must generate 7 events, 2 events per new account fed, plus 1 event for the creation of the UD. + let events = System::events(); + assert_eq!(events.len(), 7); + assert_eq!( + events[6], + EventRecord { + phase: Phase::Initialization, + event: Event::UniversalDividend(crate::Event::NewUdCreated(1000, 3)), + topics: vec![], + } + ); + + // The second UD must be created in block #4 + run_to_block(4); + assert_eq!(Balances::free_balance(1), 2_000); + assert_eq!(Balances::free_balance(2), 2_000); + assert_eq!(Balances::free_balance(3), 2_000); + assert_eq!(Balances::free_balance(4), 0); + assert_eq!(UniversalDividend::total_money_created(), 6_000); + + /*// Block #4 must generate 4 events, 1 event per account fed, plus 1 event for the creation of the UD. + let events = System::events(); + println!("{:?}", events); + assert_eq!(events.len(), 4); + assert_eq!( + events[3], + EventRecord { + phase: Phase::Initialization, + event: Event::UniversalDividend(crate::Event::NewUdCreated(1000, 3)), + topics: vec![], + } + );*/ + + // The third UD must be created in block #6 + run_to_block(6); + assert_eq!(Balances::free_balance(1), 3_000); + assert_eq!(Balances::free_balance(2), 3_000); + assert_eq!(Balances::free_balance(3), 3_000); + assert_eq!(Balances::free_balance(4), 0); + assert_eq!(UniversalDividend::total_money_created(), 9_000); + + // Block #8 should cause a re-evaluation of UD + run_to_block(8); + assert_eq!(Balances::free_balance(1), 4_025); + assert_eq!(Balances::free_balance(2), 4_025); + assert_eq!(Balances::free_balance(3), 4_025); + assert_eq!(Balances::free_balance(4), 0); + assert_eq!(UniversalDividend::total_money_created(), 12_075); + + // Block #10 #12 and #14should creates the reevalued UD + run_to_block(14); + assert_eq!(Balances::free_balance(1), 7_100); + assert_eq!(Balances::free_balance(2), 7_100); + assert_eq!(Balances::free_balance(3), 7_100); + assert_eq!(Balances::free_balance(4), 0); + assert_eq!(UniversalDividend::total_money_created(), 21_300); + + // Block #16 should cause a second re-evaluation of UD + run_to_block(16); + assert_eq!(Balances::free_balance(1), 8_200); + assert_eq!(Balances::free_balance(2), 8_200); + assert_eq!(Balances::free_balance(3), 8_200); + assert_eq!(Balances::free_balance(4), 0); + assert_eq!(UniversalDividend::total_money_created(), 24_600); + }); +} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 1f3b58dbc..fd7d69167 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -1,90 +1,244 @@ +[build-dependencies.substrate-wasm-builder] +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '4.0.0' + [package] -authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>', 'tuxmain <tuxmain@zettascript.org>'] +authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>'] edition = '2018' homepage = 'https://substrate.dev' -license = 'AGPL v3' -name = 'node-template-runtime' -repository = 'https://forge.tedomum.net/axiom-team/substrate-libre-currency' +license = 'AGPL-3.0' +name = 'lc-core-runtime' +repository = 'https://github.com/substrate-developer-hub/substrate-lc-core/' version = '3.0.0' - [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] -[build-dependencies] -substrate-wasm-builder={version = '4.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} - -[dependencies] -# external dependencies -codec = {default-features = false, features = ['derive'], package = 'parity-scale-codec', version = '2.0.0'} -hex-literal= {optional = true, version = '0.3.1'} - -# Substrate dependencies -frame-benchmarking = {default-features = false, optional = true, version = '3.1.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -frame-executive = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -frame-support = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -frame-system = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -frame-system-benchmarking = {default-features = false, optional = true, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -frame-system-rpc-runtime-api = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -pallet-aura = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -pallet-balances = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -pallet-grandpa = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -pallet-randomness-collective-flip = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -pallet-sudo = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -pallet-timestamp = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -pallet-transaction-payment = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -pallet-transaction-payment-rpc-runtime-api = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-api = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-block-builder = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-consensus-aura = {default-features = false, version = '0.9.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-core = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-inherents = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-offchain = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-runtime = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-session = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-std = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-transaction-pool = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} -sp-version = {default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', tag = 'monthly-2021-05'} - -# local dependencies -pallet-template = {default-features = false, version = '3.0.0', path = '../pallets/template'} - [features] default = ['std'] runtime-benchmarks = [ - 'frame-benchmarking', - 'frame-support/runtime-benchmarks', - 'frame-system-benchmarking', - 'frame-system/runtime-benchmarks', - 'hex-literal', - 'pallet-balances/runtime-benchmarks', - 'pallet-template/runtime-benchmarks', - 'pallet-timestamp/runtime-benchmarks', - 'sp-runtime/runtime-benchmarks', + 'frame-benchmarking', + 'frame-support/runtime-benchmarks', + 'frame-system-benchmarking', + 'frame-system/runtime-benchmarks', + 'hex-literal', + 'pallet-balances/runtime-benchmarks', + 'pallet-universal-dividend/runtime-benchmarks', + 'pallet-timestamp/runtime-benchmarks', + 'sp-runtime/runtime-benchmarks', ] std = [ - 'codec/std', - 'frame-executive/std', - 'frame-support/std', - 'frame-system-rpc-runtime-api/std', - 'frame-system/std', - 'pallet-aura/std', - 'pallet-balances/std', - 'pallet-grandpa/std', - 'pallet-randomness-collective-flip/std', - 'pallet-sudo/std', - 'pallet-template/std', - 'pallet-timestamp/std', - 'pallet-transaction-payment-rpc-runtime-api/std', - 'pallet-transaction-payment/std', - 'sp-api/std', - 'sp-block-builder/std', - 'sp-consensus-aura/std', - 'sp-core/std', - 'sp-inherents/std', - 'sp-offchain/std', - 'sp-runtime/std', - 'sp-session/std', - 'sp-std/std', - 'sp-transaction-pool/std', - 'sp-version/std', + 'codec/std', + 'frame-executive/std', + 'frame-support/std', + 'frame-system-rpc-runtime-api/std', + 'frame-system/std', + 'pallet-aura/std', + 'pallet-balances/std', + 'pallet-grandpa/std', + 'pallet-randomness-collective-flip/std', + 'pallet-sudo/std', + 'pallet-universal-dividend/std', + 'pallet-timestamp/std', + 'pallet-transaction-payment-rpc-runtime-api/std', + 'pallet-transaction-payment/std', + 'serde', + 'sp-api/std', + 'sp-arithmetic/std', + 'sp-block-builder/std', + 'sp-consensus-aura/std', + 'sp-core/std', + 'sp-inherents/std', + 'sp-offchain/std', + 'sp-runtime/std', + 'sp-session/std', + 'sp-std/std', + 'sp-transaction-pool/std', + 'sp-version/std', ] +[dependencies.codec] +default-features = false +features = ['derive'] +package = 'parity-scale-codec' +version = '2.1.0' + +[dependencies.frame-benchmarking] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +optional = true +tag = 'monthly-2021-07' +version = '3.1.0' + +[dependencies.frame-executive] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.frame-support] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.frame-system] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.frame-system-benchmarking] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +optional = true +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.frame-system-rpc-runtime-api] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.hex-literal] +optional = true +version = '0.3.1' + +[dependencies.pallet-aura] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.pallet-balances] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.pallet-grandpa] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.1.0' + +[dependencies.pallet-randomness-collective-flip] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.pallet-sudo] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.pallet-identity] +default-features = false +path = '../pallets/identity' + +[dependencies.pallet-ud-accounts-storage] +default-features = false +path = '../pallets/ud-accounts-storage' + +[dependencies.pallet-universal-dividend] +default-features = false +path = '../pallets/universal-dividend' + +[dependencies.pallet-timestamp] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.pallet-transaction-payment] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.pallet-transaction-payment-rpc-runtime-api] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.serde] +version = "1.0.101" +optional = true +features = ["derive"] + +[dependencies.smallvec] +version = "1.6.1" + +[dependencies.sp-api] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-arithmetic] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' + +[dependencies.sp-block-builder] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-consensus-aura] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '0.9.0' + +[dependencies.sp-core] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-inherents] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-offchain] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-runtime] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-session] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-std] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-transaction-pool] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' + +[dependencies.sp-version] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +tag = 'monthly-2021-07' +version = '3.0.0' diff --git a/runtime/src/authorizations.rs b/runtime/src/authorizations.rs new file mode 100644 index 000000000..28bfa0ba5 --- /dev/null +++ b/runtime/src/authorizations.rs @@ -0,0 +1,41 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +use crate::{AccountId, Identity, IdtyDid, IdtyRight, Origin, Runtime}; + +pub struct EnsureIdtyCallAllowedImpl; +impl pallet_identity::traits::EnsureIdtyCallAllowed<Runtime> for EnsureIdtyCallAllowedImpl { + fn create_identity( + origin: Origin, + creator: &IdtyDid, + _idty_did: &IdtyDid, + _idty_owner_key: &AccountId, + ) -> bool { + match origin.into() { + Ok(frame_system::RawOrigin::Root) => true, + Ok(frame_system::RawOrigin::Signed(signer)) => { + let creator_idty = Identity::identity(creator); + + if let Some(authorized_key) = creator_idty.get_right_key(IdtyRight::CreateIdty) { + signer == authorized_key + } else { + false + } + } + _ => false, + } + } +} diff --git a/runtime/src/entities.rs b/runtime/src/entities.rs new file mode 100644 index 000000000..d60d8b408 --- /dev/null +++ b/runtime/src/entities.rs @@ -0,0 +1,96 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +use frame_support::pallet_prelude::*; +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; +use sp_core::H256; + +#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] +#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, RuntimeDebug)] +pub enum IdtyRight { + CreateIdty, + LightCert, + StrongCert, + Ud, +} +impl Default for IdtyRight { + fn default() -> Self { + Self::Ud + } +} +impl pallet_identity::traits::IdtyRight for IdtyRight { + fn allow_owner_key(self) -> bool { + match self { + Self::CreateIdty | Self::LightCert | Self::Ud => true, + IdtyRight::StrongCert => false, + //_ => false, + } + } +} + +#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] +#[derive(Encode, Decode, Default, Clone, Copy, PartialEq, Eq, RuntimeDebug)] +pub struct IdtyDid { + pub hash: H256, + pub planet: Planet, + pub latitude: u32, + pub longitude: u32, +} +impl PartialOrd for IdtyDid { + fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> { + match self.hash.partial_cmp(&other.hash) { + Some(core::cmp::Ordering::Equal) => match self.planet.partial_cmp(&other.planet) { + Some(core::cmp::Ordering::Equal) => { + match self.latitude.partial_cmp(&other.latitude) { + Some(core::cmp::Ordering::Equal) => { + self.longitude.partial_cmp(&other.longitude) + } + o => o, + } + } + o => o, + }, + o => o, + } + } +} +impl Ord for IdtyDid { + fn cmp(&self, other: &Self) -> core::cmp::Ordering { + match self.hash.cmp(&other.hash) { + core::cmp::Ordering::Equal => match self.planet.cmp(&other.planet) { + core::cmp::Ordering::Equal => match self.latitude.cmp(&other.latitude) { + core::cmp::Ordering::Equal => self.longitude.cmp(&other.longitude), + o => o, + }, + o => o, + }, + o => o, + } + } +} +impl pallet_identity::traits::IdtyDid for IdtyDid {} + +#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] +#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, RuntimeDebug)] +pub enum Planet { + Earth, +} +impl Default for Planet { + fn default() -> Self { + Self::Earth + } +} diff --git a/runtime/src/handlers.rs b/runtime/src/handlers.rs new file mode 100644 index 000000000..c95d792d8 --- /dev/null +++ b/runtime/src/handlers.rs @@ -0,0 +1,42 @@ +// Copyright 2021 Axiom-Team +// +// This file is part of Substrate-Libre-Currency. +// +// Substrate-Libre-Currency is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License. +// +// Substrate-Libre-Currency is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. + +use super::{AccountId, Identity, IdtyDid, IdtyRight, Origin, Runtime, UdAccountsStorage}; +use frame_support::pallet_prelude::DispatchResultWithPostInfo; + +pub struct OnIdtyValidatedHandler; +impl pallet_identity::traits::OnIdtyValidated<Runtime> for OnIdtyValidatedHandler { + fn on_idty_validated(idty_did: IdtyDid, _owner_key: AccountId) -> DispatchResultWithPostInfo { + Identity::add_right(Origin::root(), idty_did, IdtyRight::Ud) + } +} + +pub struct OnRightKeyChangeHandler; +impl pallet_identity::traits::OnRightKeyChange<Runtime> for OnRightKeyChangeHandler { + fn on_right_key_change( + _idty_did: IdtyDid, + right: IdtyRight, + old_key_opt: Option<AccountId>, + new_key_opt: Option<AccountId>, + ) { + match right { + IdtyRight::Ud => UdAccountsStorage::replace_account(old_key_opt, new_key_opt), + IdtyRight::CreateIdty => 0, + IdtyRight::LightCert => 0, + IdtyRight::StrongCert => 0, + }; + } +} diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 285ff487e..84cf96177 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -22,9 +22,27 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +mod authorizations; +mod entities; +mod handlers; + +pub use crate::entities::{IdtyDid, IdtyRight, Planet}; +pub use pallet_balances::Call as BalancesCall; +pub use pallet_identity::IdtyValue; +pub use pallet_timestamp::Call as TimestampCall; +use pallet_transaction_payment::CurrencyAdapter; +pub use pallet_universal_dividend; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; +pub use sp_runtime::{Perbill, Permill}; + +use crate::handlers::OnRightKeyChangeHandler; +use frame_support::traits::Get; +use frame_system::EnsureRoot; use pallet_grandpa::fg_primitives; use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; use sp_api::impl_runtime_apis; +use sp_arithmetic::traits::{BaseArithmetic, Unsigned}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::traits::{ @@ -46,19 +64,10 @@ pub use frame_support::{ traits::{KeyOwnerProofSystem, Randomness}, weights::{ constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, - IdentityFee, Weight, + Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, StorageValue, }; -pub use pallet_balances::Call as BalancesCall; -pub use pallet_timestamp::Call as TimestampCall; -use pallet_transaction_payment::CurrencyAdapter; -#[cfg(any(feature = "std", test))] -pub use sp_runtime::BuildStorage; -pub use sp_runtime::{Perbill, Permill}; - -/// Import the template pallet. -pub use pallet_template; /// An index to a block. pub type BlockNumber = u32; @@ -70,12 +79,8 @@ pub type Signature = MultiSignature; /// to the public key of our transaction signing scheme. pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId; -/// The type for looking up accounts. We don't expect more than 4 billion of them, but you -/// never know... -pub type AccountIndex = u32; - /// Balance of an account. -pub type Balance = u128; +pub type Balance = u64; /// Index of a transaction in the chain. pub type Index = u32; @@ -83,9 +88,6 @@ pub type Index = u32; /// A hash of some data used by the chain. pub type Hash = sp_core::H256; -/// Digest item type. -pub type DigestItem = generic::DigestItem<Hash>; - /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats /// of data like extrinsics, allowing for them to continue syncing the network through upgrades @@ -112,9 +114,10 @@ pub mod opaque { // To learn more about runtime versioning and what each of the following value means: // https://substrate.dev/docs/en/knowledgebase/runtime/upgrades#runtime-versioning +#[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("node-template"), - impl_name: create_runtime_str!("node-template"), + spec_name: create_runtime_str!("lc-core"), + impl_name: create_runtime_str!("lc-core"), authoring_version: 1, // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, @@ -143,6 +146,8 @@ pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); pub const HOURS: BlockNumber = MINUTES * 60; pub const DAYS: BlockNumber = HOURS * 24; +pub const MONTHS: BlockNumber = DAYS * 30; +pub const YEARS: BlockNumber = MONTHS * 12; /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] @@ -219,6 +224,8 @@ impl frame_system::Config for Runtime { type OnSetCode = (); } +impl pallet_randomness_collective_flip::Config for Runtime {} + impl pallet_aura::Config for Runtime { type AuthorityId = AuraId; } @@ -255,12 +262,14 @@ impl pallet_timestamp::Config for Runtime { } parameter_types! { - pub const ExistentialDeposit: u128 = 500; + pub const ExistentialDeposit: Balance = 500; pub const MaxLocks: u32 = 50; } impl pallet_balances::Config for Runtime { type MaxLocks = MaxLocks; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. @@ -272,13 +281,31 @@ impl pallet_balances::Config for Runtime { } parameter_types! { - pub const TransactionByteFee: Balance = 1; + pub const TransactionByteFee: Balance = 0; +} + +pub struct WeightToFeeImpl<T>(sp_std::marker::PhantomData<T>); + +impl<T> WeightToFeePolynomial for WeightToFeeImpl<T> +where + T: BaseArithmetic + From<u32> + Copy + Unsigned, +{ + type Balance = T; + + fn polynomial() -> WeightToFeeCoefficients<Self::Balance> { + smallvec::smallvec!(WeightToFeeCoefficient { + coeff_integer: 0u32.into(), + coeff_frac: Perbill::from_parts(1), + negative: false, + degree: 1, + }) + } } impl pallet_transaction_payment::Config for Runtime { type OnChargeTransaction = CurrencyAdapter<Balances, ()>; type TransactionByteFee = TransactionByteFee; - type WeightToFee = IdentityFee<Balance>; + type WeightToFee = WeightToFeeImpl<Balance>; type FeeMultiplierUpdate = (); } @@ -287,11 +314,68 @@ impl pallet_sudo::Config for Runtime { type Call = Call; } -/// Configure the pallet-template in pallets/template. -impl pallet_template::Config for Runtime { +// PALLET IDENTITY + +parameter_types! { + pub const ConfirmPeriod: BlockNumber = 12 * HOURS; + pub const MaxInactivityPeriod: BlockNumber = 1 * YEARS; + pub const ValidationPeriod: BlockNumber = 2 * MONTHS; +} + +/// Configure the pallet identity +impl pallet_identity::Config for Runtime { + type ConfirmPeriod = ConfirmPeriod; + type Event = Event; + type AddRightOrigin = EnsureRoot<Self::AccountId>; + type DelRightOrigin = EnsureRoot<Self::AccountId>; + type EnsureIdtyCallAllowed = crate::authorizations::EnsureIdtyCallAllowedImpl; + type IdtyData = (); + type IdtyDid = IdtyDid; + type IdtyValidationOrigin = EnsureRoot<Self::AccountId>; + type IdtyRight = IdtyRight; + type OnIdtyConfirmed = (); + type OnIdtyRemoved = (); + type OnIdtyValidated = crate::handlers::OnIdtyValidatedHandler; + type OnRightKeyChange = OnRightKeyChangeHandler; + type MaxInactivityPeriod = MaxInactivityPeriod; + type ValidationPeriod = ValidationPeriod; +} + +// PALLET UNIVERSAL DIVIDEND + +parameter_types! { + pub const SquareMoneyGrowthRate: Permill = Permill::one(); +} + +pub struct UdAccountsProvider; +impl Get<u64> for UdAccountsProvider { + fn get() -> u64 { + UdAccountsStorage::ud_accounts_count() + } +} +impl Get<Vec<AccountId>> for UdAccountsProvider { + fn get() -> Vec<AccountId> { + UdAccountsStorage::account_list() + } +} + +/// Configure the pallet universal-dividend in pallets/universal-dividend. +impl pallet_universal_dividend::Config for Runtime { + const UD_CREATION_PERIOD: Self::BlockNumber = 10; + const UD_REEVAL_PERIOD: Balance = 10; + const UD_REEVAL_PERIOD_IN_BLOCKS: Self::BlockNumber = + Self::UD_CREATION_PERIOD * Self::UD_REEVAL_PERIOD as Self::BlockNumber; + + type Currency = pallet_balances::Pallet<Runtime>; type Event = Event; + type MembersCount = UdAccountsProvider; + type MembersIds = UdAccountsProvider; + type SquareMoneyGrowthRate = SquareMoneyGrowthRate; } +/// Configure the pallet ud-accounts-storage +impl pallet_ud_accounts_storage::Config for Runtime {} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -300,15 +384,16 @@ construct_runtime!( UncheckedExtrinsic = UncheckedExtrinsic { System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage}, + RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Aura: pallet_aura::{Pallet, Config<T>}, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, Sudo: pallet_sudo::{Pallet, Call, Config<T>, Storage, Event<T>}, - // Include the custom logic from the pallet-template in the runtime. - TemplateModule: pallet_template::{Pallet, Call, Storage, Event<T>}, + UdAccountsStorage: pallet_ud_accounts_storage::{Pallet, Config<T>, Storage}, + UniversalDividend: pallet_universal_dividend::{Pallet, Config<T>, Storage, Event<T>}, + Identity: pallet_identity::{Pallet, Call, Config<T>, Storage, Event<T>}, } ); @@ -318,10 +403,6 @@ pub type Address = sp_runtime::MultiAddress<AccountId, ()>; pub type Header = generic::Header<BlockNumber, BlakeTwo256>; /// Block type as expected by this runtime. pub type Block = generic::Block<Header, UncheckedExtrinsic>; -/// A Block signed with a Justification -pub type SignedBlock = generic::SignedBlock<Block>; -/// BlockId type as expected by this runtime. -pub type BlockId = generic::BlockId<Block>; /// The SignedExtension to the basic transaction logic. pub type SignedExtra = ( frame_system::CheckSpecVersion<Runtime>, @@ -334,8 +415,6 @@ pub type SignedExtra = ( ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>; -/// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -385,10 +464,6 @@ impl_runtime_apis! { ) -> sp_inherents::CheckInherentsResult { data.check_extrinsics(&block) } - - fn random_seed() -> <Block as BlockT>::Hash { - RandomnessCollectiveFlip::random_seed().0 - } } impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime { @@ -504,7 +579,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>); add_benchmark!(params, batches, pallet_balances, Balances); add_benchmark!(params, batches, pallet_timestamp, Timestamp); - add_benchmark!(params, batches, pallet_template, TemplateModule); + add_benchmark!(params, batches, pallet_universal_dividend, UniversalDividend); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 000000000..e29d5e616 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1,5 @@ +[toolchain] +channel = "nightly-2021-02-24" +components = [ "rustfmt", "clippy" ] +targets = [ "wasm32-unknown-unknown" ] +profile = "minimal" \ No newline at end of file diff --git a/scripts/docker_run.sh b/scripts/docker_run.sh index 0bac44b4c..53a907178 100644 --- a/scripts/docker_run.sh +++ b/scripts/docker_run.sh @@ -6,5 +6,7 @@ echo "*** Start Substrate node template ***" cd $(dirname ${BASH_SOURCE[0]})/.. +mkdir -p ./.local + docker-compose down --remove-orphans docker-compose run --rm --service-ports dev $@ diff --git a/types-bundle/types_definition.json b/types-bundle/types_definition.json new file mode 100644 index 000000000..7744b149d --- /dev/null +++ b/types-bundle/types_definition.json @@ -0,0 +1,35 @@ +{ + "Balance": "u64", + "Planet": { + "_enum": [ + "Earth" + ] + }, + "IdtyDid": { + "hash": "[u8; 32]", + "planet": "Planet", + "latitude": "u32", + "longitude": "u32" + }, + "IdtyRight": { + "_enum": [ + "CreateIdty", + "LightCert", + "StrongCert", + "Ud" + ] + }, + "IdtyStatus": { + "_enum": [ + "Created", + "ConfirmedByOwner", + "Validated" + ] + }, + "IdtyValue": { + "owner_key": "AccountId", + "removable_on": "Option<u32>", + "rights": "Vec<(IdtyRight, Option<AccountId>)>", + "status": "IdtyStatus" + } +} -- GitLab