diff --git a/.circleci/config.yml b/.circleci/config.yml index e157486028..dce83a92d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,48 +2,44 @@ version: 2 jobs: lint: docker: - - image: polymathnet/rust:debian-nightly-2020-09-28 + - image: polymathnet/rust:debian-nightly-2021-01-25 + resource_class: medium environment: VERBOSE: "1" steps: - checkout - - add_ssh_keys: - fingerprints: - - "a1:99:47:ca:fa:32:4c:9d:4b:b8:50:99:c7:64:e3:80" - run: name: Check formatting command: ./scripts/rustfmt.sh build: docker: - - image: polymathnet/rust:debian-nightly-2020-09-28 + - image: polymathnet/rust:debian-nightly-2021-01-25 + resource_class: xlarge environment: - VERBOSE: "1" - RUSTFLAGS: -D warnings steps: - checkout - - add_ssh_keys: - fingerprints: - - "b3:bb:01:c5:90:77:ef:5c:e6:5b:f2:db:16:2f:e8:61" - - "a1:99:47:ca:fa:32:4c:9d:4b:b8:50:99:c7:64:e3:80" - run: name: Store rust version in an environment var for cache key command: rustc --version > rust.version - restore_cache: keys: - v4-release-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} - - v4-release-cache-{{ checksum "./rust.version" }} - run: name: Build release - command: cargo build --release || cargo build -j 1 --release - no_output_timeout: 4h + command: cargo build --release + no_output_timeout: 1h - save_cache: key: v4-release-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} paths: + - "/usr/local/cargo" - "~/.cargo" - "./target" benchmark-build: docker: - - image: polymathnet/rust:debian-nightly-2020-09-28 + - image: polymathnet/rust:debian-nightly-2021-01-25 + resource_class: xlarge environment: - VERBOSE: "1" - RUSTFLAGS: -D warnings @@ -54,28 +50,69 @@ jobs: command: rustc --version > rust.version - restore_cache: keys: - - v1-bb-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} + - v2-bench-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} - run: name: Build binary with runtime-benchmarks - command: cargo build --release --features=runtime-benchmarks || cargo build --release -j 1 --features=runtime-benchmarks - no_output_timeout: 30m + command: cargo build --release --features=runtime-benchmarks,running-ci + no_output_timeout: 1h + - persist_to_workspace: + root: ./target/release + paths: + - polymesh - save_cache: - key: v1-bb-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} + key: v2-bench-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} paths: + - "/usr/local/cargo" + - "~/.cargo" + - "./target" + benchmark: + docker: + - image: debian:stable + resource_class: medium + environment: + - VERBOSE: "1" + steps: + - attach_workspace: + at: . + - run: + name: Run benchmarks + command: ./polymesh benchmark -p=* -e=* -r 1 -s 1 --execution native --db-cache 512 --heap-pages=2048 + no_output_timeout: 1h + migration-tests: + docker: + - image: polymathnet/rust:debian-nightly-2021-01-25 + resource_class: large + environment: + - VERBOSE: "1" + - RUSTFLAGS: -D warnings + - BUILD_DUMMY_WASM_BINARY: "1" + steps: + - checkout + - run: + name: Store rust version in an environment var for cache key + command: rustc --version > rust.version + - restore_cache: + keys: + - v1-migration-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} + - run: + name: Run migration tests + command: cargo test -p migration-tests --lib -- --nocapture + no_output_timeout: 1h + - save_cache: + key: v1-migration-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} + paths: + - "/usr/local/cargo" - "~/.cargo" - "./target" test: docker: - - image: polymathnet/rust:debian-nightly-2020-09-28 + - image: polymathnet/rust:debian-nightly-2021-01-25 + resource_class: large environment: - VERBOSE: "1" - RUSTFLAGS: -D warnings steps: - checkout - - add_ssh_keys: - fingerprints: - - "b3:bb:01:c5:90:77:ef:5c:e6:5b:f2:db:16:2f:e8:61" - - "a1:99:47:ca:fa:32:4c:9d:4b:b8:50:99:c7:64:e3:80" - run: name: Store rust version in a file for cache key command: rustc --version > rust.version @@ -94,34 +131,50 @@ jobs: --package node-rpc-runtime-api --package pallet-transaction-payment --package polymesh-runtime-tests - --features default_identity || - cargo test -j 1 - --package polymesh-runtime-tests - --package pallet-staking - --package pallet-group - --package pallet-sudo - --package polymesh-primitives - --package node-rpc-runtime-api - --package pallet-transaction-payment - --package polymesh-runtime-tests --features default_identity - no_output_timeout: 30m + no_output_timeout: 1h - save_cache: key: v11-test-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} paths: + - "/usr/local/cargo" + - "~/.cargo" + - "./target" + coverage: + docker: + - image: polymathnet/rust:debian-nightly-2021-01-25 + resource_class: large + environment: + - VERBOSE: "1" + - RUSTFLAGS: -D warnings + steps: + - checkout + - run: + name: Store rust version in a file for cache key + command: rustc --version > rust.version + - restore_cache: + keys: + - v4-coverage-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} + - run: + name: Install dependencies + command: rustup component add llvm-tools-preview && cargo install rustfilt cargo-binutils + - run: + name: Coverage + command: bash ./scripts/coverage.sh + no_output_timeout: 1h + - save_cache: + key: v4-coverage-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} + paths: + - "/usr/local/cargo" - "~/.cargo" - "./target" cli: docker: - - image: polymathnet/rust:debian-nightly-2020-09-28 + - image: polymathnet/rust:debian-nightly-2021-01-25 + resource_class: xlarge environment: VERBOSE: "1" steps: - checkout - - add_ssh_keys: - fingerprints: - - "b3:bb:01:c5:90:77:ef:5c:e6:5b:f2:db:16:2f:e8:61" - - "a1:99:47:ca:fa:32:4c:9d:4b:b8:50:99:c7:64:e3:80" - run: name: Store rust version in a file for cache key command: rustc --version > rust.version @@ -130,7 +183,7 @@ jobs: - v6-cli-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} - run: name: Build release - command: cargo build --release || cargo build -j 1 --release + command: cargo build --release no_output_timeout: 4h - run: name: cli node instance @@ -140,7 +193,7 @@ jobs: name: cli scripts install command: npm install working_directory: ./scripts/cli - no_output_timeout: 30m + no_output_timeout: 1h - run: name: cli scripts test command: npm test @@ -149,40 +202,42 @@ jobs: - save_cache: key: v6-cli-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} paths: + - "/usr/local/cargo" - "~/.cargo" - "./target" - "./scripts/cli/node_modules" clippy: docker: - - image: polymathnet/rust:debian-nightly-2020-09-28 + - image: polymathnet/rust:debian-nightly-2021-01-25 + resource_class: large environment: VERBOSE: "1" steps: - checkout - - add_ssh_keys: - fingerprints: - - "b3:bb:01:c5:90:77:ef:5c:e6:5b:f2:db:16:2f:e8:61" - - "a1:99:47:ca:fa:32:4c:9d:4b:b8:50:99:c7:64:e3:80" - run: name: Store rust version in a file for cache key command: rustc --version > rust.version - restore_cache: keys: - v4-clippy-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} - - v4-clippy-cache-{{ checksum "./rust.version" }} - run: name: run clippy - command: cargo clippy -j 1 - no_output_timeout: 60m + command: cargo clippy + no_output_timeout: 1h - save_cache: key: v4-clippy-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} paths: + - "/usr/local/cargo" - "~/.cargo" - "./target" workflows: version: 2 commit: jobs: - - lint - - test - benchmark-build + - lint + - coverage + - migration-tests + - benchmark: + requires: + - benchmark-build diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4d41840fd4..2ede354531 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -15,12 +15,11 @@ jobs: - name: Install rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2020-09-28 target: wasm32-unknown-unknown override: true default: true - name: Build docs - run: cargo doc --no-deps --workspace --release --verbose --exclude node-bench --exclude node-testing + run: BUILD_DUMMY_WASM_BINARY=1 cargo doc --no-deps --workspace --release --exclude node-bench --exclude node-testing - name: Add index file run: echo "" > ./target/doc/index.html - name: Publish to Cloudflare workers diff --git a/.gitignore b/.gitignore index 2d13be7598..3d1bbaace6 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,11 @@ tmp/ # vim swap files **/*.swp + +# profiling data for code coverage +**/*.profraw +*.profdata +coverage.txt + +**/test_cache +**/CACHE diff --git a/Cargo.lock b/Cargo.lock index a18424d82c..6d42c8075f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,11 +12,11 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.13.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" +checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" dependencies = [ - "gimli 0.22.0", + "gimli 0.23.0", ] [[package]] @@ -55,7 +55,7 @@ dependencies = [ "aes", "block-cipher", "ghash", - "subtle 2.3.0", + "subtle 2.4.0", ] [[package]] @@ -65,7 +65,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63dd91889c49327ad7ef3b500fd1109dbd3c509a03db0d4a9ce413b79f575cb6" dependencies = [ "block-cipher", - "byteorder 1.3.4", + "byteorder 1.4.2", "opaque-debug 0.3.0", ] @@ -94,11 +94,17 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +[[package]] +name = "ahash" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" + [[package]] name = "aho-corasick" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ "memchr", ] @@ -134,9 +140,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.33" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fd36ffbb1fb7c834eac128ea8d0e310c5aeb635548f9d58861e1308d46e71c" +checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" [[package]] name = "approx" @@ -149,9 +155,9 @@ dependencies = [ [[package]] name = "arc-swap" -version = "0.4.7" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" +checksum = "d4d7d63395147b81a9e570bcc6243aaf71c017bd666d4909cfef0085bdda8d73" [[package]] name = "arrayref" @@ -170,9 +176,9 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "asn1_der" @@ -193,6 +199,16 @@ dependencies = [ "syn", ] +[[package]] +name = "async-attributes" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "async-channel" version = "1.5.1" @@ -206,36 +222,39 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d373d78ded7d0b3fa8039375718cde0aace493f2e34fb60f51cbf567562ca801" +checksum = "eb877970c7b440ead138f6321a3b5395d6061183af779340b65e20c0fede9146" dependencies = [ "async-task", "concurrent-queue", "fastrand", "futures-lite", - "once_cell 1.4.1", + "once_cell 1.5.2", "vec-arena", ] [[package]] name = "async-global-executor" -version = "1.4.2" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "124ac8c265e407641c3362b8f4d39cdb4e243885b71eef087be27199790f5a3a" +checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" dependencies = [ + "async-channel", "async-executor", "async-io", + "async-mutex", + "blocking", "futures-lite", "num_cpus", - "once_cell 1.4.1", + "once_cell 1.5.2", ] [[package]] name = "async-io" -version = "1.1.10" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54bc4c1c7292475efb2253227dbcfad8fe1ca4c02bc62c510cc2f3da5c4704e" +checksum = "9315f8f07556761c3e48fec2e6b276004acf426e6dc068b2c2251854d65ee0fd" dependencies = [ "concurrent-queue", "fastrand", @@ -243,7 +262,7 @@ dependencies = [ "libc", "log", "nb-connect", - "once_cell 1.4.1", + "once_cell 1.5.2", "parking", "polling", "vec-arena", @@ -251,6 +270,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "async-lock" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1996609732bde4a9988bc42125f55f2af5f3c36370e27c778d5191a4a1b63bfb" +dependencies = [ + "event-listener", +] + [[package]] name = "async-mutex" version = "1.4.0" @@ -260,17 +288,35 @@ dependencies = [ "event-listener", ] +[[package]] +name = "async-process" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef37b86e2fa961bae5a4d212708ea0154f904ce31d1a4a7f47e1bbc33a0c040b" +dependencies = [ + "async-io", + "blocking", + "cfg-if 1.0.0", + "event-listener", + "futures-lite", + "once_cell 1.5.2", + "signal-hook", + "winapi 0.3.9", +] + [[package]] name = "async-std" -version = "1.6.5" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9fa76751505e8df1c7a77762f60486f60c71bbd9b8557f4da6ad47d083732ed" +checksum = "d9f06685bad74e0570f5213741bea82158279a4103d988e57bfada11ad230341" dependencies = [ + "async-attributes", + "async-channel", "async-global-executor", "async-io", - "async-mutex", - "blocking", - "crossbeam-utils", + "async-lock", + "async-process", + "crossbeam-utils 0.8.1", "futures-channel", "futures-core", "futures-io", @@ -280,8 +326,8 @@ dependencies = [ "log", "memchr", "num_cpus", - "once_cell 1.4.1", - "pin-project-lite", + "once_cell 1.5.2", + "pin-project-lite 0.2.4", "pin-utils", "slab", "wasm-bindgen-futures", @@ -299,7 +345,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df097e3f506bec0e1a24f06bb3c962c228f36671de841ff579cb99f371772634" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "rustls", "webpki", "webpki-roots 0.19.0", @@ -307,9 +353,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.41" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b246867b8b3b6ae56035f1eb1ed557c1d8eae97f0d53696138a50fa0e3a3b8c0" +checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" dependencies = [ "proc-macro2", "quote", @@ -353,15 +399,15 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.53" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707b586e0e2f247cbde68cdd2c3ce69ea7b7be43e1c5b426e37c9319c4b9838e" +checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc" dependencies = [ "addr2line", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object 0.21.1", + "object 0.23.0", "rustc-demangle", ] @@ -383,13 +429,19 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + [[package]] name = "bincode" version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "serde", ] @@ -404,7 +456,7 @@ dependencies = [ "cfg-if 0.1.10", "clang-sys", "clap", - "env_logger", + "env_logger 0.7.1", "lazy_static", "lazycell", "log", @@ -456,15 +508,13 @@ dependencies = [ [[package]] name = "blake2" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84ce5b6108f8e154604bd4eb76a2f726066c3464d5a552a4229262a18c9bb471" +checksum = "10a5720225ef5daecf08657f23791354e1685a8c91a4c60c7f3d3b2892f978f4" dependencies = [ - "byte-tools", - "byteorder 1.3.4", "crypto-mac 0.8.0", "digest 0.9.0", - "opaque-debug 0.2.3", + "opaque-debug 0.3.0", ] [[package]] @@ -479,23 +529,23 @@ dependencies = [ [[package]] name = "blake2b_simd" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" +checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" dependencies = [ "arrayref", - "arrayvec 0.5.1", + "arrayvec 0.5.2", "constant_time_eq", ] [[package]] name = "blake2s_simd" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab9e07352b829279624ceb7c64adb4f585dacdb81d35cafae81139ccd617cf44" +checksum = "9e461a7034e85b211a4acb57ee2e6730b32912b06c08cc242243c39fc21ae6a2" dependencies = [ "arrayref", - "arrayvec 0.5.1", + "arrayvec 0.5.2", "constant_time_eq", ] @@ -507,7 +557,7 @@ checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ "block-padding 0.1.5", "byte-tools", - "byteorder 1.3.4", + "byteorder 1.4.2", "generic-array 0.12.3", ] @@ -556,7 +606,7 @@ dependencies = [ "atomic-waker", "fastrand", "futures-lite", - "once_cell 1.4.1", + "once_cell 1.5.2", ] [[package]] @@ -565,11 +615,17 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + [[package]] name = "bstr" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf" +checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ "lazy_static", "memchr", @@ -577,22 +633,13 @@ dependencies = [ "serde", ] -[[package]] -name = "build-helper" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdce191bf3fa4995ce948c8c83b4640a1745457a149e73c6db75b4ffe36aad5f" -dependencies = [ - "semver 0.6.0", -] - [[package]] name = "bulletproofs" version = "2.0.1" source = "git+https://github.com/PolymathNetwork/bulletproofs.git?branch=v2-packed-simd#c466eab8987717eb92a8235e7dabc303e0e54ddb" dependencies = [ - "byteorder 1.3.4", - "curve25519-dalek 2.1.0 (git+https://github.com/PolymathNetwork/curve25519-dalek.git?branch=v2-packed-simd)", + "byteorder 1.4.2", + "curve25519-dalek 2.1.0", "digest 0.8.1", "merlin", "rand 0.7.3", @@ -600,16 +647,16 @@ dependencies = [ "serde", "serde_derive", "sha3 0.8.2", - "subtle 2.3.0", + "subtle 2.4.0", "thiserror", "zeroize", ] [[package]] name = "bumpalo" -version = "3.4.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" +checksum = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" [[package]] name = "byte-slice-cast" @@ -631,9 +678,9 @@ checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" [[package]] name = "bytes" @@ -641,7 +688,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "either", "iovec", ] @@ -652,6 +699,12 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + [[package]] name = "c_linked_list" version = "1.1.1" @@ -664,18 +717,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" -[[package]] -name = "cargo_metadata" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8de60b887edf6d74370fc8eb177040da4847d971d6234c7b13a6da324ef0caf" -dependencies = [ - "semver 0.9.0", - "serde", - "serde_derive", - "serde_json", -] - [[package]] name = "cast" version = "0.2.3" @@ -687,9 +728,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.61" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" +checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" dependencies = [ "jobserver", ] @@ -786,20 +827,11 @@ dependencies = [ "bitflags", ] -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - [[package]] name = "cmake" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e56268c17a6248366d66d4a47a3381369d068cce8409bb1716ed77ea32163bb" +checksum = "eb6210b637171dfba4cda12e579ac6dc73f5165ad56133e5d72ef3131f320855" dependencies = [ "cc", ] @@ -816,12 +848,12 @@ dependencies = [ [[package]] name = "confidential_identity" version = "1.0.0" -source = "git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.0#e4af2c6fae4caaa2167cef126971c377c334b4e0" +source = "git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.1#9c41a116204dcffd681ac6dbe7a3073784c40f3e" dependencies = [ "blake2", - "byteorder 1.3.4", + "byteorder 1.4.2", "criterion", - "curve25519-dalek 2.1.0 (git+https://github.com/PolymathNetwork/curve25519-dalek.git?branch=v2-packed-simd)", + "curve25519-dalek 2.1.0", "failure", "lazy_static", "merlin", @@ -831,16 +863,39 @@ dependencies = [ "serde", "serde_json", "sha3 0.8.2", - "sp-io", - "sp-std", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "zeroize", +] + +[[package]] +name = "confidential_identity" +version = "1.0.0" +source = "git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.2#fd1e598e7a80e646e7ff59510ab572d6f282504c" +dependencies = [ + "blake2", + "byteorder 1.4.2", + "criterion", + "curve25519-dalek 2.1.0", + "failure", + "lazy_static", + "merlin", + "rand 0.7.3", + "rand_core 0.5.1", + "schnorrkel 0.9.1 (git+https://github.com/PolymathNetwork/schnorrkel.git?branch=fix-simd-issue)", + "serde", + "serde_json", + "sha3 0.8.2", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "zeroize", ] [[package]] name = "const-random" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02dc82c12dc2ee6e1ded861cf7d582b46f66f796d1b6c93fa28b911ead95da02" +checksum = "f590d95d011aa80b063ffe3253422ed5aa462af4e9867d43ce8337562bac77c4" dependencies = [ "const-random-macro", "proc-macro-hack", @@ -848,14 +903,22 @@ dependencies = [ [[package]] name = "const-random-macro" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc757bbb9544aa296c2ae00c679e81f886b37e28e59097defe0cf524306f6685" +checksum = "615f6e27d000a2bffbc7f2f6a8669179378fa27ee4d0a509e985dfc0a7defb40" dependencies = [ - "getrandom 0.2.0", + "getrandom 0.2.2", + "lazy_static", "proc-macro-hack", + "tiny-keccak", ] +[[package]] +name = "const_fn" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -884,6 +947,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" +[[package]] +name = "cpuid-bool" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" + [[package]] name = "cranelift-bforest" version = "0.66.0" @@ -899,7 +968,7 @@ version = "0.66.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d9badfe36176cb653506091693bc2bb1970c9bddfcd6ec7fac404f7eaec6f38" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", @@ -908,7 +977,7 @@ dependencies = [ "log", "regalloc", "serde", - "smallvec 1.4.2", + "smallvec 1.6.1", "target-lexicon", "thiserror", ] @@ -946,7 +1015,7 @@ checksum = "2ef419efb4f94ecc02e5d9fbcc910d2bb7f0040e2de570e63a454f883bc891d6" dependencies = [ "cranelift-codegen", "log", - "smallvec 1.4.2", + "smallvec 1.6.1", "target-lexicon", ] @@ -978,25 +1047,25 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", ] [[package]] name = "criterion" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70daa7ceec6cf143990669a04c7df13391d55fb27bd4079d252fca774ba244d8" +checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ "atty", "cast", "clap", "criterion-plot", "csv", - "itertools 0.9.0", + "itertools 0.10.0", "lazy_static", "num-traits", "oorandom", @@ -1023,12 +1092,12 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.4.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "crossbeam-utils", - "maybe-uninit", + "cfg-if 1.0.0", + "crossbeam-utils 0.8.1", ] [[package]] @@ -1037,11 +1106,22 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", + "crossbeam-epoch 0.8.2", + "crossbeam-utils 0.7.2", "maybe-uninit", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-epoch 0.9.1", + "crossbeam-utils 0.8.1", +] + [[package]] name = "crossbeam-epoch" version = "0.8.2" @@ -1050,10 +1130,24 @@ checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" dependencies = [ "autocfg 1.0.1", "cfg-if 0.1.10", - "crossbeam-utils", + "crossbeam-utils 0.7.2", "lazy_static", "maybe-uninit", - "memoffset", + "memoffset 0.5.6", + "scopeguard 1.1.0", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" +dependencies = [ + "cfg-if 1.0.0", + "const_fn", + "crossbeam-utils 0.8.1", + "lazy_static", + "memoffset 0.6.1", "scopeguard 1.1.0", ] @@ -1064,7 +1158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" dependencies = [ "cfg-if 0.1.10", - "crossbeam-utils", + "crossbeam-utils 0.7.2", "maybe-uninit", ] @@ -1079,12 +1173,33 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" +dependencies = [ + "autocfg 1.0.1", + "cfg-if 1.0.0", + "lazy_static", +] + [[package]] name = "crunchy" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-cli" +version = "1.0.0" +dependencies = [ + "confidential_identity 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.2)", + "hex", + "parity-scale-codec", + "polymesh-primitives 2.0.0", +] + [[package]] name = "crypto-mac" version = "0.7.0" @@ -1102,18 +1217,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ "generic-array 0.14.4", - "subtle 2.3.0", + "subtle 2.4.0", +] + +[[package]] +name = "cryptography_core" +version = "1.0.0" +source = "git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.1#9c41a116204dcffd681ac6dbe7a3073784c40f3e" +dependencies = [ + "bulletproofs", + "byteorder 1.4.2", + "criterion", + "curve25519-dalek 2.1.0", + "failure", + "merlin", + "parity-scale-codec", + "rand 0.7.3", + "rand_core 0.5.1", + "serde", + "sha3 0.8.2", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "zeroize", ] [[package]] name = "cryptography_core" version = "1.0.0" -source = "git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.0#e4af2c6fae4caaa2167cef126971c377c334b4e0" +source = "git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.2#fd1e598e7a80e646e7ff59510ab572d6f282504c" dependencies = [ "bulletproofs", - "byteorder 1.3.4", + "byteorder 1.4.2", "criterion", - "curve25519-dalek 2.1.0 (git+https://github.com/PolymathNetwork/curve25519-dalek.git?branch=v2-packed-simd)", + "curve25519-dalek 2.1.0", "failure", "merlin", "parity-scale-codec", @@ -1121,15 +1256,42 @@ dependencies = [ "rand_core 0.5.1", "serde", "sha3 0.8.2", - "sp-std", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "zeroize", ] +[[package]] +name = "cssparser" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "matches", + "phf", + "proc-macro2", + "quote", + "smallvec 1.6.1", + "syn", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "csv" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" +checksum = "f9d58633299b24b515ac72a3f869f8b91306a3cec616a602843a383acd6f9e97" dependencies = [ "bstr", "csv-core", @@ -1156,6 +1318,16 @@ dependencies = [ "sct", ] +[[package]] +name = "ctor" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8f45d9ad417bcef4817d614a501ab55cdd96a6fdb24f49aab89a54acfd66b19" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "cuckoofilter" version = "0.3.2" @@ -1169,48 +1341,48 @@ dependencies = [ [[package]] name = "curve25519-dalek" version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" +source = "git+https://github.com/PolymathNetwork/curve25519-dalek.git?branch=v2-packed-simd#3ad591b06ae0b9ad97f81711296bea8087a345e9" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "digest 0.8.1", + "packed_simd_2", "rand_core 0.5.1", - "subtle 2.3.0", + "serde", + "subtle 2.4.0", "zeroize", ] [[package]] name = "curve25519-dalek" -version = "2.1.0" -source = "git+https://github.com/PolymathNetwork/curve25519-dalek.git?branch=v2-packed-simd#3ad591b06ae0b9ad97f81711296bea8087a345e9" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434e1720189a637d44fe464f4df1e6eb900b4835255b14354497c78af37d9bb8" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "digest 0.8.1", - "packed_simd_2", "rand_core 0.5.1", - "serde", - "subtle 2.3.0", + "subtle 2.4.0", "zeroize", ] [[package]] name = "curve25519-dalek" -version = "3.0.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307" +checksum = "f627126b946c25a4638eec0ea634fc52506dea98db118aae985118ce7c3d723f" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "digest 0.9.0", "rand_core 0.5.1", - "subtle 2.3.0", + "subtle 2.4.0", "zeroize", ] [[package]] name = "data-encoding" -version = "2.3.0" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d0e2d24e5ee3b23a01de38eefdcd978907890701f08ffffd4cb457ca4ee8d6" +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" [[package]] name = "derive_more" @@ -1268,10 +1440,25 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "quick-error", ] +[[package]] +name = "dtoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e" + +[[package]] +name = "dtoa-short" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde03329ae10e79ede66c9ce4dc930aa8599043b0743008548680f25b91502d6" +dependencies = [ + "dtoa", +] + [[package]] name = "dyn-clonable" version = "0.9.0" @@ -1295,9 +1482,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c53dc3a653e0f64081026e4bf048d48fec9fce90c66e8326ca7292df0ff2d82" +checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf" [[package]] name = "ed25519" @@ -1314,14 +1501,20 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ - "curve25519-dalek 3.0.0", + "curve25519-dalek 3.0.2", "ed25519", "rand 0.7.3", "serde", - "sha2 0.9.1", + "sha2 0.9.3", "zeroize", ] +[[package]] +name = "ego-tree" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a68a4904193147e0a8dec3314640e6db742afd5f6e634f428a6af230d9b3591" + [[package]] name = "either" version = "1.6.1" @@ -1335,7 +1528,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ "atty", - "humantime", + "humantime 1.3.0", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "env_logger" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e" +dependencies = [ + "atty", + "humantime 2.1.0", "log", "regex", "termcolor", @@ -1349,18 +1555,18 @@ checksum = "6576a1755ddffd988788025e75bce9e74b018f7cc226198fe931d077911c6d7e" [[package]] name = "erased-serde" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ca8b296792113e1500fd935ae487be6e00ce318952a6880555554824d6ebf38" +checksum = "0465971a8cc1fa2455c8465aaa377131e1f1cf4983280f474a13e68793aa770c" dependencies = [ "serde", ] [[package]] name = "errno" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eab5ee3df98a279d9b316b1af6ac95422127b1290317e6d18c1743c99418b01" +checksum = "fa68f2fb9cae9d37c9b2b3584aba698a2e97f72d7aef7b9f7aa71d8b54ce46fe" dependencies = [ "errno-dragonfly", "libc", @@ -1389,7 +1595,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", ] [[package]] @@ -1450,7 +1656,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fdbe0d94371f9ce939b555dd342d0686cc4c0cadbcd4b61d70af5ff97eb4126" dependencies = [ - "env_logger", + "env_logger 0.7.1", "log", ] @@ -1461,7 +1667,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8feb87a63249689640ac9c011742c33139204e3c134293d3054022276869133b" dependencies = [ "either", - "futures 0.3.6", + "futures 0.3.12", "futures-timer 2.0.2", "log", "num-traits", @@ -1475,7 +1681,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "rand 0.7.3", "rustc-hex", "static_assertions", @@ -1489,11 +1695,11 @@ checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" [[package]] name = "flate2" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da80be589a72651dcda34d8b35bcdc9b7254ad06325611074d9cc0fbb19f60ee" +checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "crc32fast", "libc", "libz-sys", @@ -1508,106 +1714,205 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "fork-tree" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "form_urlencoded" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +dependencies = [ + "matches", + "percent-encoding 2.1.0", +] + +[[package]] +name = "frame-benchmarking" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "linregress", "parity-scale-codec", + "paste", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-storage 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "frame-benchmarking" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-support", - "frame-system", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "linregress", "parity-scale-codec", "paste", - "sp-api", - "sp-io", - "sp-runtime", - "sp-runtime-interface", - "sp-std", - "sp-storage", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-storage 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "frame-benchmarking-cli" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "sc-cli", - "sc-client-db", - "sc-executor", - "sc-service", - "sp-core", - "sp-externalities", - "sp-runtime", - "sp-state-machine", + "sc-client-db 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-executor 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-service 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "structopt", ] [[package]] name = "frame-executive" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "serde", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-tracing 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "frame-executive" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "serde", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-tracing 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "frame-metadata" +version = "12.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ - "frame-support", - "frame-system", "parity-scale-codec", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-tracing", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "frame-metadata" -version = "12.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "12.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", "serde", - "sp-core", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "frame-support" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "bitmask", + "frame-metadata 12.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support-procedural 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "impl-trait-for-tuples", + "log", + "once_cell 1.5.2", + "parity-scale-codec", + "paste", + "serde", + "smallvec 1.6.1", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-tracing 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "frame-support" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "bitmask", - "frame-metadata", - "frame-support-procedural", + "frame-metadata 12.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support-procedural 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "impl-trait-for-tuples", "log", - "once_cell 1.4.1", + "once_cell 1.5.2", "parity-scale-codec", "paste", "serde", - "smallvec 1.4.2", - "sp-arithmetic", - "sp-core", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-tracing", + "smallvec 1.6.1", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-tracing 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "frame-support-procedural" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-support-procedural-tools 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-support-procedural-tools", + "frame-support-procedural-tools 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "proc-macro2", "quote", "syn", @@ -1615,10 +1920,22 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-support-procedural-tools-derive 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-support-procedural-tools-derive", + "frame-support-procedural-tools-derive 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "proc-macro-crate", "proc-macro2", "quote", @@ -1627,8 +1944,18 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools-derive" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "proc-macro2", "quote", @@ -1637,62 +1964,77 @@ dependencies = [ [[package]] name = "frame-system" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "impl-trait-for-tuples", + "parity-scale-codec", + "serde", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "frame-system" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-support", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "impl-trait-for-tuples", "parity-scale-codec", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "frame-system-benchmarking" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "frame-system-rpc-runtime-api" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ "parity-scale-codec", - "sp-api", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "fs-swap" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921d332c89b3b61a826de38c61ee5b6e02c56806cade1b0e5d81bd71f57a71bb" +name = "frame-system-rpc-runtime-api" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "lazy_static", - "libc", - "libloading", - "winapi 0.3.9", + "parity-scale-codec", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] -name = "fs2" -version = "0.4.3" +name = "fs-swap" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +checksum = "5839fda247e24ca4919c87c71dd5ca658f1f39e4f06829f80e3f15c3bafcfc2c" dependencies = [ + "lazy_static", "libc", + "libloading", "winapi 0.3.9", ] @@ -1724,6 +2066,16 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +[[package]] +name = "futf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" +dependencies = [ + "mac", + "new_debug_unreachable", +] + [[package]] name = "futures" version = "0.1.30" @@ -1732,9 +2084,9 @@ checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" [[package]] name = "futures" -version = "0.3.6" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8e3078b7b2a8a671cb7a3d17b4760e4181ea243227776ba83fd043b4ca034e" +checksum = "da9052a1a50244d8d5aa9bf55cbc2fb6f357c86cc52e46c62ed390a7180cf150" dependencies = [ "futures-channel", "futures-core", @@ -1747,9 +2099,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.6" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a4d35f7401e948629c9c3d6638fb9bf94e0b2121e96c3b428cc4e631f3eb74" +checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" dependencies = [ "futures-core", "futures-sink", @@ -1766,9 +2118,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.6" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d674eaa0056896d5ada519900dbf97ead2e46a7b6621e8160d79e2f2e1e2784b" +checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" [[package]] name = "futures-core-preview" @@ -1793,7 +2145,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdcef58a173af8148b182684c9f2d5250875adbcaff7b5794073894f9d8634a9" dependencies = [ "futures 0.1.30", - "futures 0.3.6", + "futures 0.3.12", "lazy_static", "log", "parking_lot 0.9.0", @@ -1804,9 +2156,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.6" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc709ca1da6f66143b8c9bec8e6260181869893714e9b5a490b169b0414144ab" +checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" dependencies = [ "futures-core", "futures-task", @@ -1816,30 +2168,30 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.6" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc94b64bb39543b4e432f1790b6bf18e3ee3b74653c5449f63310e9a74b123c" +checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500" [[package]] name = "futures-lite" -version = "1.11.1" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381a7ad57b1bad34693f63f6f377e1abded7a9c85c9d3eb6771e11c60aaadab9" +checksum = "b4481d0cd0de1d204a4fa55e7d45f07b1d958abcb06714b3446438e2eff695fb" dependencies = [ "fastrand", "futures-core", "futures-io", "memchr", "parking", - "pin-project-lite", + "pin-project-lite 0.2.4", "waker-fn", ] [[package]] name = "futures-macro" -version = "0.3.6" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f57ed14da4603b2554682e9f2ff3c65d7567b53188db96cb71538217fc64581b" +checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -1849,17 +2201,17 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.6" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8764258ed64ebc5d9ed185cf86a95db5cac810269c5d20ececb32e0088abbd" +checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" [[package]] name = "futures-task" -version = "0.3.6" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd26820a9f3637f1302da8bceba3ff33adbe53464b54ca24d4e2d4f1db30f94" +checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" dependencies = [ - "once_cell 1.4.1", + "once_cell 1.5.2", ] [[package]] @@ -1876,9 +2228,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.6" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a894a0acddba51a2d49a6f4263b1e64b8c579ece8af50fa86503d52cd1eea34" +checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" dependencies = [ "futures 0.1.30", "futures-channel", @@ -1888,7 +2240,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project 0.4.27", + "pin-project-lite 0.2.4", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1914,11 +2266,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" dependencies = [ "bytes 0.5.6", - "futures 0.3.6", + "futures 0.3.12", "memchr", "pin-project 0.4.27", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder 1.4.2", +] + [[package]] name = "gcc" version = "0.3.55" @@ -1966,34 +2327,44 @@ dependencies = [ "libc", ] +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + [[package]] name = "getrandom" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", "wasi 0.9.0+wasi-snapshot-preview1", ] [[package]] name = "getrandom" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "wasi 0.9.0+wasi-snapshot-preview1", + "wasi 0.10.0+wasi-snapshot-preview1", ] [[package]] name = "ghash" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6e27f0689a6e15944bdce7e45425efb87eaa8ab0c6e87f11d0987a9133e2531" +checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" dependencies = [ + "opaque-debug 0.3.0", "polyval", ] @@ -2010,9 +2381,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" +checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" [[package]] name = "glob" @@ -2028,9 +2399,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "globset" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ad1da430bd7281dde2576f44c84cc3f0f7b475e7202cd503042dff01a8c8120" +checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a" dependencies = [ "aho-corasick", "bstr", @@ -2058,7 +2429,7 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "bytes 0.4.12", "fnv", "futures 0.1.30", @@ -2072,28 +2443,29 @@ dependencies = [ [[package]] name = "h2" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" +checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" dependencies = [ "bytes 0.5.6", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.1", + "http 0.2.3", "indexmap", "slab", - "tokio 0.2.22", + "tokio 0.2.25", "tokio-util", "tracing", + "tracing-futures", ] [[package]] name = "half" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hash-db" @@ -2116,7 +2488,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "scopeguard 0.3.3", ] @@ -2145,21 +2517,24 @@ name = "hashbrown" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +dependencies = [ + "ahash 0.4.7", +] [[package]] name = "heck" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" dependencies = [ "unicode-segmentation", ] [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] @@ -2222,6 +2597,20 @@ dependencies = [ "hmac", ] +[[package]] +name = "html5ever" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aafcf38a1a36118242d29b92e1b08ef84e67e4a5ed06e0a80be20e6a32bfed6b" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "http" version = "0.1.21" @@ -2235,11 +2624,11 @@ dependencies = [ [[package]] name = "http" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" dependencies = [ - "bytes 0.5.6", + "bytes 1.0.1", "fnv", "itoa", ] @@ -2263,14 +2652,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" dependencies = [ "bytes 0.5.6", - "http 0.2.1", + "http 0.2.3", ] [[package]] name = "httparse" -version = "1.3.4" +version = "1.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" [[package]] name = "httpdate" @@ -2287,6 +2676,12 @@ dependencies = [ "quick-error", ] +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "0.12.35" @@ -2319,23 +2714,23 @@ dependencies = [ [[package]] name = "hyper" -version = "0.13.8" +version = "0.13.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835" +checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" dependencies = [ "bytes 0.5.6", "futures-channel", "futures-core", "futures-util", - "h2 0.2.6", - "http 0.2.1", + "h2 0.2.7", + "http 0.2.3", "http-body 0.3.1", "httparse", "httpdate", "itoa", - "pin-project 0.4.27", + "pin-project 1.0.5", "socket2", - "tokio 0.2.22", + "tokio 0.2.25", "tower-service", "tracing", "want 0.3.0", @@ -2350,11 +2745,11 @@ dependencies = [ "bytes 0.5.6", "ct-logs", "futures-util", - "hyper 0.13.8", + "hyper 0.13.10", "log", "rustls", "rustls-native-certs", - "tokio 0.2.22", + "tokio 0.2.25", "tokio-rustls", "webpki", ] @@ -2372,9 +2767,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094" dependencies = [ "matches", "unicode-bidi", @@ -2412,9 +2807,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" +checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" dependencies = [ "autocfg 1.0.1", "hashbrown 0.9.1", @@ -2442,11 +2837,11 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", ] [[package]] @@ -2464,7 +2859,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "futures-timer 2.0.2", ] @@ -2507,11 +2902,20 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" +dependencies = [ + "either", +] + [[package]] name = "itoa" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "jobserver" @@ -2524,9 +2928,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.45" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" +checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" dependencies = [ "wasm-bindgen", ] @@ -2539,6 +2943,7 @@ checksum = "489b9c612e60c766f751ab40fcb43cbb55a1e10bb44a9b4307ed510ca598cbd7" dependencies = [ "failure", "futures 0.1.30", + "hyper 0.12.35", "jsonrpc-core", "jsonrpc-pubsub", "log", @@ -2685,7 +3090,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0315ef2f688e33844400b31f11c263f2b3dc21d8b9355c6891c5f185fae43f9a" dependencies = [ "parity-util-mem", - "smallvec 1.4.2", + "smallvec 1.6.1", ] [[package]] @@ -2714,7 +3119,7 @@ dependencies = [ "parking_lot 0.10.2", "regex", "rocksdb", - "smallvec 1.4.2", + "smallvec 1.6.1", ] [[package]] @@ -2740,9 +3145,9 @@ checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" [[package]] name = "libc" -version = "0.2.79" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" +checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" [[package]] name = "libloading" @@ -2774,7 +3179,7 @@ checksum = "571f5a4604c1a40d75651da141dfde29ad15329f537a779528803297d2220274" dependencies = [ "atomic", "bytes 0.5.6", - "futures 0.3.6", + "futures 0.3.12", "lazy_static", "libp2p-core", "libp2p-core-derive", @@ -2801,7 +3206,7 @@ dependencies = [ "parity-multiaddr", "parking_lot 0.10.2", "pin-project 0.4.27", - "smallvec 1.4.2", + "smallvec 1.6.1", "wasm-timer", ] @@ -2812,11 +3217,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52f13ba8c7df0768af2eb391696d562c7de88cc3a35122531aaa6a7d77754d25" dependencies = [ "asn1_der", - "bs58", + "bs58 0.3.1", "ed25519-dalek", "either", "fnv", - "futures 0.3.6", + "futures 0.3.12", "futures-timer 3.0.2", "lazy_static", "libsecp256k1", @@ -2832,7 +3237,7 @@ dependencies = [ "ring", "rw-stream-sink", "sha2 0.8.2", - "smallvec 1.4.2", + "smallvec 1.6.1", "thiserror", "unsigned-varint 0.4.0", "void", @@ -2856,7 +3261,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74029ae187f35f4b8ddf26b9779a68b340045d708528a103917cdca49a296db5" dependencies = [ "flate2", - "futures 0.3.6", + "futures 0.3.12", "libp2p-core", ] @@ -2866,7 +3271,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7cf319822e08dd65c8e060d2354e9f952895bbc433f5706c75ed010c152aee5e" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "libp2p-core", "log", ] @@ -2879,13 +3284,13 @@ checksum = "d8a9acb43a3e4a4e413e0c4abe0fa49308df7c6335c88534757b647199cb8a51" dependencies = [ "cuckoofilter", "fnv", - "futures 0.3.6", + "futures 0.3.12", "libp2p-core", "libp2p-swarm", "prost", "prost-build", "rand 0.7.3", - "smallvec 1.4.2", + "smallvec 1.6.1", ] [[package]] @@ -2895,10 +3300,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab20fcb60edebe3173bbb708c6ac3444afdf1e3152dc2866b10c4f5497f17467" dependencies = [ "base64 0.11.0", - "byteorder 1.3.4", + "byteorder 1.4.2", "bytes 0.5.6", "fnv", - "futures 0.3.6", + "futures 0.3.12", "futures_codec", "hex_fmt", "libp2p-core", @@ -2909,7 +3314,7 @@ dependencies = [ "prost-build", "rand 0.7.3", "sha2 0.8.2", - "smallvec 1.4.2", + "smallvec 1.6.1", "unsigned-varint 0.4.0", "wasm-timer", ] @@ -2920,13 +3325,13 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56396ee63aa9164eacf40c2c5d2bda8c4133c2f57e1b0425d51d3a4e362583b1" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "libp2p-core", "libp2p-swarm", "log", "prost", "prost-build", - "smallvec 1.4.2", + "smallvec 1.6.1", "wasm-timer", ] @@ -2936,11 +3341,11 @@ version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc7fa9047f8b8f544278a35c2d9d45d3b2c1785f2d86d4e1629d6edf97be3955" dependencies = [ - "arrayvec 0.5.1", + "arrayvec 0.5.2", "bytes 0.5.6", "either", "fnv", - "futures 0.3.6", + "futures 0.3.12", "futures_codec", "libp2p-core", "libp2p-swarm", @@ -2950,7 +3355,7 @@ dependencies = [ "prost-build", "rand 0.7.3", "sha2 0.8.2", - "smallvec 1.4.2", + "smallvec 1.6.1", "uint", "unsigned-varint 0.4.0", "void", @@ -2967,14 +3372,14 @@ dependencies = [ "data-encoding", "dns-parser", "either", - "futures 0.3.6", + "futures 0.3.12", "lazy_static", "libp2p-core", "libp2p-swarm", "log", "net2", "rand 0.7.3", - "smallvec 1.4.2", + "smallvec 1.6.1", "void", "wasm-timer", ] @@ -2987,7 +3392,7 @@ checksum = "8a73a799cc8410b36e40b8f4c4b6babbcb9efd3727111bf517876e4acfa612d3" dependencies = [ "bytes 0.5.6", "fnv", - "futures 0.3.6", + "futures 0.3.12", "futures_codec", "libp2p-core", "log", @@ -3002,8 +3407,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ef6c490042f549fb1025f2892dfe6083d97a77558f450c1feebe748ca9eb15a" dependencies = [ "bytes 0.5.6", - "curve25519-dalek 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.6", + "curve25519-dalek 2.1.2", + "futures 0.3.12", "lazy_static", "libp2p-core", "log", @@ -3023,7 +3428,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad063c21dfcea4518ac9e8bd4119d33a5b26c41e674f602f41f05617a368a5c8" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "libp2p-core", "libp2p-swarm", "log", @@ -3039,7 +3444,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "903a12e99c72dbebefea258de887982adeacc7025baa1ceb10b7fa9928f54791" dependencies = [ "bytes 0.5.6", - "futures 0.3.6", + "futures 0.3.12", "futures_codec", "libp2p-core", "log", @@ -3056,7 +3461,7 @@ version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96b3c2d5d26a9500e959a0e19743897239a6c4be78dadf99b70414301a70c006" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "log", "pin-project 0.4.27", "rand 0.7.3", @@ -3072,14 +3477,14 @@ checksum = "9c0c9e8a4cd69d97e9646c54313d007512f411aba8c5226cfcda16df6a6e84a3" dependencies = [ "async-trait", "bytes 0.5.6", - "futures 0.3.6", + "futures 0.3.12", "libp2p-core", "libp2p-swarm", "log", - "lru 0.6.0", + "lru 0.6.4", "minicbor", "rand 0.7.3", - "smallvec 1.4.2", + "smallvec 1.6.1", "unsigned-varint 0.5.1", "wasm-timer", ] @@ -3091,11 +3496,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7193e444210132237b81b755ec7fe53f1c4bd2f53cf719729b94c0c72eb6eaa1" dependencies = [ "either", - "futures 0.3.6", + "futures 0.3.12", "libp2p-core", "log", "rand 0.7.3", - "smallvec 1.4.2", + "smallvec 1.6.1", "void", "wasm-timer", ] @@ -3107,7 +3512,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44f42ec130d7a37a7e47bf4398026b7ad9185c08ed26972e2720f8b94112796f" dependencies = [ "async-std", - "futures 0.3.6", + "futures 0.3.12", "futures-timer 3.0.2", "get_if_addrs", "ipnet", @@ -3123,7 +3528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dea7acb0a034f70d7db94c300eba3f65c0f6298820105624088a9609c9974d77" dependencies = [ "async-std", - "futures 0.3.6", + "futures 0.3.12", "libp2p-core", "log", ] @@ -3134,7 +3539,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34c1faac6f92c21fbe155417957863ea822fba9e9fd5eb24c0912336a100e63f" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "js-sys", "libp2p-core", "parity-send-wrapper", @@ -3150,14 +3555,14 @@ checksum = "d650534ebd99f48f6fa292ed5db10d30df2444943afde4407ceeddab8e513fca" dependencies = [ "async-tls", "either", - "futures 0.3.6", + "futures 0.3.12", "libp2p-core", "log", "quicksink", "rustls", "rw-stream-sink", "soketto", - "url 2.1.1", + "url 2.2.0", "webpki", "webpki-roots 0.18.0", ] @@ -3168,9 +3573,9 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "781d9b9f043dcdabc40640807125368596b849fd4d96cdca2dcf052fdf6f33fd" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "libp2p-core", - "parking_lot 0.11.0", + "parking_lot 0.11.1", "thiserror", "yamux", ] @@ -3199,7 +3604,7 @@ dependencies = [ "hmac-drbg", "rand 0.7.3", "sha2 0.8.2", - "subtle 2.3.0", + "subtle 2.4.0", "typenum", ] @@ -3216,9 +3621,9 @@ dependencies = [ [[package]] name = "linked-hash-map" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "linked_hash_set" @@ -3260,20 +3665,21 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" +checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" dependencies = [ "scopeguard 1.1.0", ] [[package]] name = "log" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", + "value-bag", ] [[package]] @@ -3287,11 +3693,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.6.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111b945ac72ec09eb7bc62a0fbdc3cc6e80555a7245f52a69d3921a75b53b153" +checksum = "fe2382d8ed3918ea4ba70d98d5b74e47a168e0331965f3f17cdbc748bdebc5a3" dependencies = [ - "hashbrown 0.8.2", + "hashbrown 0.9.1", ] [[package]] @@ -3300,6 +3706,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb241df5c4caeb888755363fc95f8a896618dc0d435e9e775f7930cb099beab" +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + [[package]] name = "mach" version = "0.3.2" @@ -3309,6 +3721,23 @@ dependencies = [ "libc", ] +[[package]] +name = "markup5ever" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae38d669396ca9b707bfc3db254bc382ddb94f57cc5c235f34623a669a01dab" +dependencies = [ + "log", + "phf", + "phf_codegen", + "serde", + "serde_derive", + "serde_json", + "string_cache", + "string_cache_codegen", + "tendril", +] + [[package]] name = "matchers" version = "0.0.1" @@ -3326,9 +3755,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "matrixmultiply" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4f7ec66360130972f34830bfad9ef05c6610a43938a467bcc9ab9369ab3478f" +checksum = "916806ba0031cd542105d916a97c8572e1fa6dd79c9c51e7eb43a09ec2dd84c1" dependencies = [ "rawpointer", ] @@ -3341,9 +3770,9 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" -version = "2.3.3" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memmap" @@ -3365,8 +3794,17 @@ dependencies = [ ] [[package]] -name = "memory-db" -version = "0.24.1" +name = "memoffset" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +dependencies = [ + "autocfg 1.0.1", +] + +[[package]] +name = "memory-db" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36f36ddb0b2cdc25d38babba472108798e3477f02be5165f038c5e393e50c57a" dependencies = [ @@ -3383,16 +3821,36 @@ checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" [[package]] name = "merlin" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6feca46f4fa3443a01769d768727f10c10a20fdb65e52dc16a81f0c8269bb78" +checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "keccak", "rand_core 0.5.1", "zeroize", ] +[[package]] +name = "migration-tests" +version = "0.1.0" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "futures 0.3.12", + "lazy_static", + "pallet-asset 0.1.0", + "pallet-asset 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-runtime-testnet 0.1.0", + "polymesh-runtime-testnet 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "remote-externalities 0.1.0", + "remote-externalities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=065ea0c243c7e6f6d665d769cf79647d2ecfca00)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + [[package]] name = "minicbor" version = "0.5.1" @@ -3425,9 +3883,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.22" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" dependencies = [ "cfg-if 0.1.10", "fuchsia-zircon", @@ -3436,7 +3894,7 @@ dependencies = [ "kernel32-sys", "libc", "log", - "miow 0.2.1", + "miow 0.2.2", "net2", "slab", "winapi 0.2.8", @@ -3462,7 +3920,7 @@ checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ "log", "mio", - "miow 0.3.5", + "miow 0.3.6", "winapi 0.3.9", ] @@ -3479,9 +3937,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" dependencies = [ "kernel32-sys", "net2", @@ -3491,9 +3949,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" +checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" dependencies = [ "socket2", "winapi 0.3.9", @@ -3514,8 +3972,8 @@ dependencies = [ "blake2b_simd", "blake2s_simd", "digest 0.9.0", - "sha-1 0.9.1", - "sha2 0.9.1", + "sha-1 0.9.3", + "sha2 0.9.3", "sha3 0.9.1", "unsigned-varint 0.5.1", ] @@ -3528,15 +3986,15 @@ checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333" [[package]] name = "multistream-select" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0075eaaf3102b344f122e1a2e1cedf0f3d388c5fb27a0e31eb09c1151fbbd1" +checksum = "93faf2e41f9ee62fb01680ed48f3cc26652352327aa2e59869070358f6b7dd75" dependencies = [ "bytes 0.5.6", - "futures 0.3.6", + "futures 0.3.12", "log", - "pin-project 1.0.1", - "smallvec 1.4.2", + "pin-project 1.0.5", + "smallvec 1.6.1", "unsigned-varint 0.5.1", ] @@ -3578,15 +4036,21 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.35" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" dependencies = [ "cfg-if 0.1.10", "libc", "winapi 0.3.9", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + [[package]] name = "nix" version = "0.17.0" @@ -3606,7 +4070,7 @@ version = "0.8.0" dependencies = [ "derive_more", "fs_extra", - "futures 0.3.6", + "futures 0.3.12", "hash-db", "hex", "kvdb", @@ -3616,25 +4080,25 @@ dependencies = [ "node-testing", "parity-db", "parity-util-mem", - "polymesh-primitives", - "polymesh-runtime-testnet", + "polymesh-primitives 2.0.0", + "polymesh-runtime-testnet 0.1.0", "rand 0.7.3", "sc-basic-authorship", "sc-cli", - "sc-client-api", - "sc-transaction-pool", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde", "serde_json", - "sp-consensus", - "sp-core", - "sp-finality-tracker", - "sp-inherents", - "sp-runtime", - "sp-state-machine", - "sp-timestamp", - "sp-tracing", - "sp-transaction-pool", - "sp-trie", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-finality-tracker 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-tracing 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "structopt", "tempfile", ] @@ -3644,32 +4108,32 @@ name = "node-executor" version = "2.0.0" dependencies = [ "criterion", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "node-testing", "pallet-balances 0.1.0", - "pallet-confidential", - "pallet-contracts", - "pallet-grandpa", - "pallet-im-online", - "pallet-indices", - "pallet-session", - "pallet-timestamp", - "pallet-transaction-payment", - "pallet-treasury 2.0.0", - "parity-scale-codec", - "polymesh-primitives", - "polymesh-runtime-testnet", - "sc-executor", - "sp-application-crypto", - "sp-core", - "sp-externalities", - "sp-io", - "sp-runtime", - "sp-state-machine", - "sp-trie", - "substrate-test-client", + "pallet-confidential 0.1.0", + "pallet-contracts 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-grandpa 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-im-online 2.0.0", + "pallet-indices 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-transaction-payment 2.0.0", + "pallet-treasury 2.0.1", + "parity-scale-codec", + "polymesh-primitives 2.0.0", + "polymesh-runtime-testnet 0.1.0", + "sc-executor 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-test-client 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "trie-root", "wabt", ] @@ -3678,46 +4142,66 @@ dependencies = [ name = "node-rpc" version = "0.1.0" dependencies = [ - "frame-support", - "frame-system", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", - "node-rpc-runtime-api", - "pallet-compliance-manager", - "pallet-identity", - "pallet-pips", - "pallet-portfolio", - "pallet-transaction-payment", - "parity-scale-codec", - "polymesh-primitives", + "node-rpc-runtime-api 0.1.0", + "pallet-compliance-manager 0.1.0", + "pallet-identity 0.1.0", + "pallet-pips 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-transaction-payment 2.0.0", + "parity-scale-codec", + "polymesh-primitives 2.0.0", "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-rpc 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "node-rpc-runtime-api" version = "0.1.0" dependencies = [ - "frame-support", - "frame-system", - "pallet-compliance-manager", - "pallet-identity", - "pallet-pips", - "pallet-portfolio", - "pallet-transaction-payment", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-compliance-manager 0.1.0", + "pallet-identity 0.1.0", + "pallet-pips 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-transaction-payment 2.0.0", "parity-scale-codec", - "polymesh-primitives", + "polymesh-primitives 2.0.0", "serde", "serde_json", - "sp-api", - "sp-runtime", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "node-rpc-runtime-api" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-compliance-manager 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-pips 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-portfolio 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-transaction-payment 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "parity-scale-codec", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] @@ -3725,44 +4209,44 @@ name = "node-testing" version = "2.0.0" dependencies = [ "criterion", - "frame-support", - "frame-system", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "fs_extra", - "futures 0.3.6", + "futures 0.3.12", "log", "node-executor", "pallet-balances 0.1.0", - "pallet-contracts", - "pallet-grandpa", - "pallet-indices", - "pallet-permissions", - "pallet-session", - "pallet-staking", - "pallet-timestamp", - "pallet-transaction-payment", - "pallet-treasury 2.0.0", - "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", - "polymesh-runtime-testnet", - "sc-block-builder", + "pallet-contracts 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-grandpa 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-indices 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-permissions 0.1.0", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-staking 2.0.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-transaction-payment 2.0.0", + "pallet-treasury 2.0.1", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "polymesh-runtime-testnet 0.1.0", + "sc-block-builder 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "sc-cli", - "sc-client-api", - "sc-client-db", - "sc-executor", - "sc-service", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-finality-tracker", - "sp-inherents", - "sp-io", - "sp-keyring", - "sp-runtime", - "sp-timestamp", - "substrate-test-client", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-client-db 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-executor 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-service 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-finality-tracker 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-keyring 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-test-client 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "tempfile", "wabt", ] @@ -3812,9 +4296,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ "autocfg 1.0.1", "num-traits", @@ -3834,9 +4318,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ "autocfg 1.0.1", "libm 0.2.1", @@ -3871,9 +4355,9 @@ dependencies = [ [[package]] name = "object" -version = "0.21.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693" +checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" [[package]] name = "once_cell" @@ -3886,18 +4370,18 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" dependencies = [ - "parking_lot 0.11.0", + "parking_lot 0.11.1", ] [[package]] name = "oorandom" -version = "11.1.2" +version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a170cebd8021a008ea92e4db85a72f80b35df514ec664b296fdcbb654eac0b2c" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "opaque-debug" @@ -3940,175 +4424,350 @@ dependencies = [ name = "pallet-asset" version = "0.1.0" dependencies = [ - "arrayvec 0.5.1", - "frame-benchmarking", - "frame-support", - "frame-system", + "arrayvec 0.5.2", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "hex-literal 0.2.1", "libsecp256k1", "pallet-balances 0.1.0", - "pallet-contracts", - "pallet-identity", - "pallet-permissions", - "pallet-portfolio", - "pallet-session", - "pallet-statistics", - "pallet-timestamp", - "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-contracts", - "polymesh-primitives", - "polymesh-primitives-derive", + "pallet-contracts 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-identity 0.1.0", + "pallet-permissions 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-statistics 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-contracts 0.1.0", + "polymesh-primitives 2.0.0", + "polymesh-primitives-derive 0.1.0", + "rustc-hex", + "serde", + "serde_derive", + "serde_json", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-asset" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "arrayvec 0.5.2", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "hex-literal 0.2.1", + "libsecp256k1", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-contracts 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-portfolio 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-statistics 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-contracts 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "rustc-hex", "serde", "serde_derive", "serde_json", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-authority-discovery" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "serde", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-authority-discovery 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-authority-discovery" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-support", - "frame-system", - "pallet-session", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "serde", - "sp-application-crypto", - "sp-authority-discovery", - "sp-runtime", - "sp-std", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-authority-discovery 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-authorship" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-authorship 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-authorship" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-support", - "frame-system", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "impl-trait-for-tuples", "parity-scale-codec", - "sp-authorship", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-authorship 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-babe" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-authorship 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "serde", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus-vrf 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-staking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-babe" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-authorship", - "pallet-session", - "pallet-timestamp", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-authorship 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "serde", - "sp-application-crypto", - "sp-consensus-babe", - "sp-consensus-vrf", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-timestamp", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-vrf 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-staking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-balances" version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-permissions", - "pallet-timestamp", - "pallet-transaction-payment", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-permissions 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-transaction-payment 2.0.0", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", - "polymesh-primitives-derive", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", "serde", "serde_derive", - "sp-api", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", - "substrate-test-runtime-client", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-test-runtime-client 2.0.0 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-balances" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-transaction-payment 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-test-runtime-client 2.0.0 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-balances" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "serde", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-balances" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "serde", - "sp-runtime", - "sp-std", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-bridge" version = "1.0.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "pallet-balances 0.1.0", - "pallet-identity", - "pallet-multisig", - "pallet-scheduler", + "pallet-identity 0.1.0", + "pallet-multisig 0.1.0", + "pallet-scheduler 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "serde", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-bridge" +version = "1.0.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-multisig 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-scheduler 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-committee" +version = "0.1.0" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-identity 0.1.0", + "pallet-permissions 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", - "polymesh-primitives-derive", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", "serde", - "sp-core", - "sp-runtime", - "sp-std", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-committee" version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-identity", - "pallet-permissions", - "pallet-timestamp", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "serde", "serde_derive", - "sp-api", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] @@ -4116,205 +4775,388 @@ name = "pallet-compliance-manager" version = "0.1.0" dependencies = [ "either", - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-asset", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-asset 0.1.0", "pallet-balances 0.1.0", - "pallet-identity", - "pallet-permissions", - "pallet-timestamp", + "pallet-identity 0.1.0", + "pallet-permissions 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", - "polymesh-primitives-derive", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-compliance-manager" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "either", + "frame-benchmarking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "serde", "serde_derive", - "sp-api", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-confidential" version = "0.1.0" dependencies = [ - "cryptography_core", - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-asset", - "pallet-identity", - "pallet-timestamp", - "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", - "polymesh-primitives-derive", + "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.2)", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-asset 0.1.0", + "pallet-identity 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "polymesh-primitives-derive 0.1.0", + "rand 0.7.3", + "rand_core 0.5.1", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-confidential" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-asset 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "rand 0.7.3", "rand_core 0.5.1", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-runtime-interface", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-contracts" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "bitflags", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-contracts-primitives 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "parity-wasm", + "pwasm-utils", + "serde", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-sandbox 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasmi-validation", +] + +[[package]] +name = "pallet-contracts" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "bitflags", - "frame-support", - "frame-system", - "pallet-contracts-primitives", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-contracts-primitives 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "parity-wasm 0.41.0", + "parity-wasm", "pwasm-utils", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-sandbox", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-sandbox 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasmi-validation", ] [[package]] name = "pallet-contracts-primitives" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-contracts-primitives" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", - "sp-runtime", - "sp-std", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-contracts-rpc" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", - "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", + "pallet-contracts-primitives 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-contracts-rpc-runtime-api 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-rpc 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "pallet-contracts-primitives 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-contracts-rpc-runtime-api" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "pallet-contracts-primitives", + "pallet-contracts-primitives 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "sp-api", - "sp-runtime", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-corporate-actions" version = "0.1.0" dependencies = [ - "confidential_identity", - "frame-benchmarking", - "frame-support", - "frame-system", + "confidential_identity 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.2)", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "libsecp256k1", - "pallet-asset", + "pallet-asset 0.1.0", "pallet-balances 0.1.0", - "pallet-compliance-manager", - "pallet-identity", - "pallet-portfolio", - "pallet-session", - "pallet-timestamp", - "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", - "polymesh-primitives-derive", + "pallet-compliance-manager 0.1.0", + "pallet-identity 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "polymesh-primitives-derive 0.1.0", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-corporate-actions" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "libsecp256k1", + "pallet-asset 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-portfolio 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "serde", "serde_derive", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-finality-tracker" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ - "frame-support", - "frame-system", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "impl-trait-for-tuples", "parity-scale-codec", "serde", - "sp-finality-tracker", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-finality-tracker 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-finality-tracker" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "impl-trait-for-tuples", + "parity-scale-codec", + "serde", + "sp-finality-tracker 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-grandpa" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-authorship 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-finality-tracker 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "serde", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-finality-grandpa 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-staking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-grandpa" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-authorship 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-finality-tracker 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "serde", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-finality-grandpa 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-staking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-group" +version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-authorship", - "pallet-finality-tracker", - "pallet-session", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-identity 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", "serde", - "sp-application-crypto", - "sp-core", - "sp-finality-grandpa", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-group" version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-identity", - "pallet-timestamp", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "serde", "serde_derive", - "sp-api", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] @@ -4324,15 +5166,15 @@ dependencies = [ "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", - "pallet-group-rpc-runtime-api", + "pallet-group-rpc-runtime-api 2.0.0", "parity-scale-codec", - "polymesh-primitives", + "polymesh-primitives 2.0.0", "serde", - "sp-api", - "sp-blockchain", - "sp-runtime", - "sp-std", - "substrate-test-runtime-client", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-test-runtime-client 2.0.0 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] @@ -4340,330 +5182,653 @@ name = "pallet-group-rpc-runtime-api" version = "2.0.0" dependencies = [ "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", "serde", "serde_json", - "sp-api", - "sp-runtime", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-group-rpc-runtime-api" +version = "2.0.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-identity" version = "0.1.0" dependencies = [ - "confidential_identity", + "confidential_identity 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.2)", "either", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "pallet-balances 0.1.0", - "pallet-permissions", - "pallet-timestamp", + "pallet-permissions 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", "schnorrkel 0.9.1 (git+https://github.com/PolymathNetwork/schnorrkel.git?branch=fix-simd-issue)", "serde", "serde_derive", - "sp-api", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-identity" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "confidential_identity 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.1)", + "either", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-im-online" version = "2.0.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-authorship", - "pallet-session", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-authorship 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "serde", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-staking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] -name = "pallet-indices" +name = "pallet-im-online" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" dependencies = [ - "frame-support", - "frame-system", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-authorship 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "parity-scale-codec", "serde", - "sp-core", - "sp-io", - "sp-keyring", - "sp-runtime", - "sp-std", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-staking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "pallet-multisig" -version = "0.1.0" +name = "pallet-indices" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-identity", - "pallet-permissions", - "pallet-timestamp", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", "serde", - "sp-core", - "sp-runtime", - "sp-std", - "sp-version", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-keyring 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "pallet-offences" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +name = "pallet-indices" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-support", - "frame-system", - "pallet-balances 2.0.0", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "serde", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-keyring 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] -name = "pallet-permissions" +name = "pallet-multisig" version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-identity 0.1.0", + "pallet-permissions 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", "serde", - "sp-runtime", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] -name = "pallet-pips" +name = "pallet-multisig" version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-balances 0.1.0", - "pallet-committee", - "pallet-group", - "pallet-identity", - "pallet-timestamp", - "pallet-treasury 0.1.0", + "frame-benchmarking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", - "polymesh-primitives-derive", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "serde", - "serde_derive", - "sp-api", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "pallet-portfolio" -version = "0.1.0" +name = "pallet-offences" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-balances 0.1.0", - "pallet-identity", - "pallet-permissions", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-balances 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", "serde", - "sp-arithmetic", - "sp-std", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-staking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "pallet-protocol-fee" -version = "0.1.0" +name = "pallet-offences" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-identity", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-balances 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-staking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] -name = "pallet-protocol-fee-rpc" +name = "pallet-permissions" version = "0.1.0" dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "pallet-protocol-fee-rpc-runtime-api", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "polymesh-common-utilities", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", "serde", - "sp-api", - "sp-blockchain", - "sp-runtime", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] -name = "pallet-protocol-fee-rpc-runtime-api" +name = "pallet-permissions" version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" dependencies = [ - "frame-support", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "parity-scale-codec", - "polymesh-common-utilities", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "serde", - "serde_json", - "sp-api", - "sp-runtime", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "pallet-randomness-collective-flip" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +name = "pallet-pips" +version = "0.1.0" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-balances 0.1.0", + "pallet-committee 0.1.0", + "pallet-group 0.1.0", + "pallet-identity 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-treasury 0.1.0", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "polymesh-primitives-derive 0.1.0", + "polymesh-runtime-common 1.0.0", + "rand 0.8.3", + "rand_chacha 0.3.0", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-pips" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-group 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-treasury 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-runtime-common 1.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-portfolio" +version = "0.1.0" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-balances 0.1.0", + "pallet-identity 0.1.0", + "pallet-permissions 0.1.0", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "serde", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-portfolio" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-protocol-fee" +version = "0.1.0" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-identity 0.1.0", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "serde", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-protocol-fee" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-protocol-fee-rpc" +version = "0.1.0" +dependencies = [ + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", + "pallet-protocol-fee-rpc-runtime-api 0.1.0", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "serde", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-protocol-fee-rpc-runtime-api" +version = "0.1.0" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "serde", + "serde_json", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-protocol-fee-rpc-runtime-api" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-randomness-collective-flip" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "safe-mix", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-randomness-collective-flip" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-support", - "frame-system", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "safe-mix", - "sp-runtime", - "sp-std", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-scheduler" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "serde", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-scheduler" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "serde", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-session" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "impl-trait-for-tuples", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "serde", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-staking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-trie 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-session" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-support", - "frame-system", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "impl-trait-for-tuples", - "pallet-timestamp", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-trie", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-staking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-settlement" version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "hex", "hex-literal 0.2.1", - "pallet-asset", + "pallet-asset 0.1.0", "pallet-balances 0.1.0", - "pallet-compliance-manager", - "pallet-contracts", - "pallet-identity", - "pallet-portfolio", - "pallet-statistics", - "pallet-timestamp", - "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-contracts", - "polymesh-primitives", - "polymesh-primitives-derive", + "pallet-compliance-manager 0.1.0", + "pallet-contracts 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-identity 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-statistics 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-contracts 0.1.0", + "polymesh-primitives 2.0.0", + "polymesh-primitives-derive 0.1.0", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-serializer 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-settlement" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "hex", + "hex-literal 0.2.1", + "pallet-asset 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-compliance-manager 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-contracts 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-portfolio 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-statistics 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-contracts 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "serde", "serde_derive", - "sp-api", - "sp-core", - "sp-io", - "sp-runtime", - "sp-serializer", - "sp-std", - "sp-version", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-serializer 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-staking" version = "2.0.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-authorship", - "pallet-babe", - "pallet-identity", - "pallet-session", - "pallet-staking-reward-curve", - "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-authorship 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-babe 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-identity 0.1.0", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-staking-reward-curve 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", "rand_chacha 0.2.2", "serde", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-npos-elections", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-npos-elections 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-staking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "static_assertions", ] [[package]] -name = "pallet-staking-reward-curve" +name = "pallet-staking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-authorship 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-babe 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-npos-elections 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-staking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "static_assertions", +] + +[[package]] +name = "pallet-staking-reward-curve" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pallet-staking-reward-curve" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4678,181 +5843,339 @@ dependencies = [ "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", - "pallet-staking-rpc-runtime-api", + "pallet-staking-rpc-runtime-api 2.0.0", "parity-scale-codec", "serde", - "sp-api", - "sp-blockchain", - "sp-runtime", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-staking-rpc-runtime-api" version = "2.0.0" dependencies = [ - "frame-support", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde_json", - "sp-api", - "sp-runtime", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-staking-rpc-runtime-api" +version = "2.0.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-statistics" version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "lazy_static", - "pallet-session", - "pallet-timestamp", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-test-runtime-client 2.0.0 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-statistics" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "serde", "serde_derive", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "substrate-test-runtime-client", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-test-runtime-client 2.0.0 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-sto" version = "0.1.0" dependencies = [ - "frame-support", - "frame-system", - "pallet-asset", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-asset 0.1.0", "pallet-balances 0.1.0", - "pallet-identity", - "pallet-permissions", - "pallet-portfolio", - "pallet-settlement", - "pallet-timestamp", - "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", - "polymesh-primitives-derive", + "pallet-compliance-manager 0.1.0", + "pallet-identity 0.1.0", + "pallet-permissions 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-settlement 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "polymesh-primitives-derive 0.1.0", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-serializer 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-sto" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-asset 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-compliance-manager 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-portfolio 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-settlement 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "serde", "serde_derive", - "sp-api", - "sp-core", - "sp-io", - "sp-runtime", - "sp-serializer", - "sp-std", - "sp-version", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-serializer 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-sudo" version = "2.0.0" dependencies = [ - "frame-support", - "frame-system", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] -name = "pallet-timestamp" +name = "pallet-sudo" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "serde", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-timestamp" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "frame-benchmarking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "impl-trait-for-tuples", + "parity-scale-codec", + "serde", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-timestamp" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "impl-trait-for-tuples", "parity-scale-codec", "serde", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-std", - "sp-timestamp", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-transaction-payment" version = "2.0.0" dependencies = [ - "frame-support", - "frame-system", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", "serde", "serde_json", - "sp-api", - "sp-io", - "sp-runtime", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-transaction-payment" +version = "2.0.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "pallet-treasury" version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "pallet-balances 0.1.0", - "pallet-identity", - "pallet-permissions", + "pallet-identity 0.1.0", + "pallet-permissions 0.1.0", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", "serde", "serde_derive", - "sp-api", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-treasury" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "pallet-treasury" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-support", - "frame-system", - "pallet-balances 2.0.0", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-balances 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "serde", - "sp-runtime", - "sp-std", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "pallet-utility" version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "hex", "hex-literal 0.2.1", "pallet-balances 0.1.0", - "pallet-permissions", + "pallet-permissions 0.1.0", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "serde", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "pallet-utility" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "hex", + "hex-literal 0.2.1", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] @@ -4871,29 +6194,29 @@ dependencies = [ [[package]] name = "parity-multiaddr" -version = "0.9.3" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7ad66970bbab360c97179b60906e2dc4aef1f7fca8ab4e5c5db8c97b16814a" +checksum = "fbecae7b7cfaafea47ceb5253ecdd14155ca8410e3487ed86031a6c2d5c15873" dependencies = [ "arrayref", - "bs58", - "byteorder 1.3.4", + "bs58 0.4.0", + "byteorder 1.4.2", "data-encoding", "multihash", "percent-encoding 2.1.0", "serde", "static_assertions", "unsigned-varint 0.5.1", - "url 2.1.1", + "url 2.2.0", ] [[package]] name = "parity-scale-codec" -version = "1.3.5" +version = "1.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c740e5fbcb6847058b40ac7e5574766c6388f585e184d769910fe0d3a2ca861" +checksum = "79602888a81ace83e3d1d4b2873286c1f5f906c84db667594e8db8da3506c383" dependencies = [ - "arrayvec 0.5.1", + "arrayvec 0.5.2", "bitvec", "byte-slice-cast", "parity-scale-codec-derive", @@ -4929,7 +6252,7 @@ dependencies = [ "libc", "log", "mio-named-pipes", - "miow 0.3.5", + "miow 0.3.6", "rand 0.7.3", "tokio 0.1.22", "tokio-named-pipes", @@ -4949,7 +6272,7 @@ dependencies = [ "parity-util-mem-derive", "parking_lot 0.10.2", "primitive-types", - "smallvec 1.4.2", + "smallvec 1.6.1", "winapi 0.3.9", ] @@ -4964,15 +6287,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "parity-wasm" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" -dependencies = [ - "byteorder 1.3.4", -] - [[package]] name = "parity-wasm" version = "0.41.0" @@ -4985,7 +6299,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e02a625dd75084c2a7024f07c575b61b782f729d18702dabb3cdbf31911dc61" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "bytes 0.4.12", "httparse", "log", @@ -4994,7 +6308,7 @@ dependencies = [ "rand 0.7.3", "sha-1 0.8.2", "slab", - "url 2.1.1", + "url 2.2.0", ] [[package]] @@ -5036,13 +6350,13 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", - "lock_api 0.4.1", - "parking_lot_core 0.8.0", + "lock_api 0.4.2", + "parking_lot_core 0.8.2", ] [[package]] @@ -5054,7 +6368,7 @@ dependencies = [ "libc", "rand 0.6.5", "rustc_version", - "smallvec 0.6.13", + "smallvec 0.6.14", "winapi 0.3.9", ] @@ -5065,11 +6379,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" dependencies = [ "cfg-if 0.1.10", - "cloudabi 0.0.3", + "cloudabi", "libc", - "redox_syscall", + "redox_syscall 0.1.57", "rustc_version", - "smallvec 0.6.13", + "smallvec 0.6.14", "winapi 0.3.9", ] @@ -5080,25 +6394,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ "cfg-if 0.1.10", - "cloudabi 0.0.3", + "cloudabi", "libc", - "redox_syscall", - "smallvec 1.4.2", + "redox_syscall 0.1.57", + "smallvec 1.6.1", "winapi 0.3.9", ] [[package]] name = "parking_lot_core" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" dependencies = [ - "cfg-if 0.1.10", - "cloudabi 0.1.0", + "cfg-if 1.0.0", "instant", "libc", - "redox_syscall", - "smallvec 1.4.2", + "redox_syscall 0.1.57", + "smallvec 1.6.1", "winapi 0.3.9", ] @@ -5127,7 +6440,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "crypto-mac 0.7.0", "rayon", ] @@ -5156,6 +6469,15 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "permissions" +version = "0.1.0" +dependencies = [ + "lazy_static", + "regex", + "scraper", +] + [[package]] name = "petgraph" version = "0.5.1" @@ -5167,50 +6489,110 @@ dependencies = [ ] [[package]] -name = "pin-project" -version = "0.4.27" +name = "phf" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" dependencies = [ - "pin-project-internal 0.4.27", + "phf_macros", + "phf_shared", + "proc-macro-hack", ] [[package]] -name = "pin-project" -version = "1.0.1" +name = "phf_codegen" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee41d838744f60d959d7074e3afb6b35c7456d0f61cad38a24e35e6553f73841" +checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" dependencies = [ - "pin-project-internal 1.0.1", + "phf_generator", + "phf_shared", ] [[package]] -name = "pin-project-internal" -version = "0.4.27" +name = "phf_generator" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" +checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" dependencies = [ - "proc-macro2", - "quote", - "syn", + "phf_shared", + "rand 0.7.3", ] [[package]] -name = "pin-project-internal" -version = "1.0.1" +name = "phf_macros" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a4ffa594b66bff340084d4081df649a7dc049ac8d7fc458d8e628bfbbb2f86" +checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro-hack", "proc-macro2", "quote", "syn", ] [[package]] -name = "pin-project-lite" -version = "0.1.10" +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" +dependencies = [ + "pin-project-internal 0.4.27", +] + +[[package]] +name = "pin-project" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" +dependencies = [ + "pin-project-internal 1.0.5", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" + +[[package]] +name = "pin-project-lite" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e555d9e657502182ac97b539fb3dae8b79cda19e3e4f8ffb5e8de4f18df93c95" +checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" [[package]] name = "pin-utils" @@ -5226,16 +6608,32 @@ checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "plotters" -version = "0.2.15" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d1685fbe7beba33de0330629da9d955ac75bd54f33d7b79f9a895590124f6bb" +checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "js-sys", "num-traits", + "plotters-backend", + "plotters-svg", "wasm-bindgen", "web-sys", ] +[[package]] +name = "plotters-backend" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" + +[[package]] +name = "plotters-svg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" +dependencies = [ + "plotters-backend", +] + [[package]] name = "polling" version = "2.0.2" @@ -5251,134 +6649,209 @@ dependencies = [ [[package]] name = "poly1305" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ce46de8e53ee414ca4d02bfefac75d8c12fba948b76622a40b4be34dfce980" +checksum = "4b7456bc1ad2d4cf82b3a016be4c2ac48daf11bf990c1603ebd447fe6f30fca8" dependencies = [ + "cpuid-bool 0.2.0", "universal-hash", ] [[package]] name = "polymesh" -version = "2.4.0" +version = "2.5.0" dependencies = [ "chrono", "ed25519-dalek", - "frame-benchmarking", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "frame-benchmarking-cli", - "frame-support", - "frame-system-rpc-runtime-api", - "futures 0.3.6", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system-rpc-runtime-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "futures 0.3.12", "jsonrpc-core", "log", "node-rpc", - "node-rpc-runtime-api", - "pallet-asset", + "node-rpc-runtime-api 0.1.0", + "pallet-asset 0.1.0", "pallet-balances 0.1.0", - "pallet-committee", - "pallet-confidential", - "pallet-contracts", - "pallet-contracts-rpc-runtime-api", - "pallet-corporate-actions", - "pallet-group", + "pallet-committee 0.1.0", + "pallet-confidential 0.1.0", + "pallet-contracts 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-contracts-rpc-runtime-api 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-corporate-actions 0.1.0", + "pallet-group 0.1.0", "pallet-group-rpc", - "pallet-group-rpc-runtime-api", - "pallet-im-online", - "pallet-protocol-fee", + "pallet-group-rpc-runtime-api 2.0.0", + "pallet-im-online 2.0.0", + "pallet-protocol-fee 0.1.0", "pallet-protocol-fee-rpc", - "pallet-protocol-fee-rpc-runtime-api", - "pallet-staking", - "pallet-staking-rpc-runtime-api", + "pallet-protocol-fee-rpc-runtime-api 0.1.0", + "pallet-staking 2.0.0", + "pallet-staking-rpc-runtime-api 2.0.0", "parity-scale-codec", - "polymesh-common-utilities", + "polymesh-common-utilities 0.1.0", "polymesh-node-rpc", - "polymesh-primitives", - "polymesh-runtime-common", + "polymesh-primitives 2.0.0", + "polymesh-runtime-common 1.0.0", "polymesh-runtime-develop", - "polymesh-runtime-testnet", + "polymesh-runtime-testnet 0.1.0", "sc-authority-discovery", "sc-basic-authorship", - "sc-chain-spec", + "sc-chain-spec 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "sc-cli", - "sc-client-api", - "sc-client-db", - "sc-consensus", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-client-db 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "sc-consensus-babe", - "sc-executor", + "sc-executor 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "sc-finality-grandpa", - "sc-light", - "sc-network", - "sc-rpc", - "sc-service", - "sc-telemetry", - "sc-transaction-pool", + "sc-light 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-network 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-rpc 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-service 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-telemetry 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde", "serde_json", - "sp-api", - "sp-authority-discovery", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-core", - "sp-finality-grandpa", - "sp-inherents", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-transaction-pool", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-authority-discovery 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-finality-grandpa 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-offchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "structopt", - "substrate-prometheus-endpoint", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "vergen", ] +[[package]] +name = "polymesh-build-tool" +version = "0.1.0" +dependencies = [ + "substrate-wasm-builder-runner 1.0.6 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "polymesh-build-tool" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "substrate-wasm-builder-runner 1.0.6 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + [[package]] name = "polymesh-common-utilities" version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "lazy_static", - "pallet-session", - "pallet-timestamp", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", - "polymesh-primitives", - "polymesh-primitives-derive", + "polymesh-primitives 2.0.0", + "polymesh-primitives-derive 0.1.0", "schnorrkel 0.9.1 (git+https://github.com/PolymathNetwork/schnorrkel.git?branch=fix-simd-issue)", "serde", "serde_derive", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "substrate-test-runtime-client", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-test-runtime-client 2.0.0 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "polymesh-common-utilities" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "serde_derive", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-test-runtime-client 2.0.0 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "polymesh-contracts" version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-contracts", - "pallet-identity", - "pallet-protocol-fee", - "parity-scale-codec", - "parity-wasm 0.41.0", - "polymesh-common-utilities", - "polymesh-primitives", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-contracts 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-identity 0.1.0", + "pallet-protocol-fee 0.1.0", + "parity-scale-codec", + "parity-wasm", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "serde", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wat", ] +[[package]] +name = "polymesh-contracts" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-contracts 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-protocol-fee 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "parity-scale-codec", + "parity-wasm", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "polymesh-extensions" +version = "0.1.0" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-permissions 0.1.0", + "pallet-transaction-payment 2.0.0", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + [[package]] name = "polymesh-node-rpc" version = "0.1.0" @@ -5390,22 +6863,22 @@ dependencies = [ "pallet-protocol-fee-rpc", "pallet-staking-rpc", "parity-scale-codec", - "polymesh-primitives", - "sc-client-api", + "polymesh-primitives 2.0.0", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "sc-consensus-babe", "sc-consensus-babe-rpc", "sc-consensus-epochs", "sc-finality-grandpa", "sc-finality-grandpa-rpc", - "sc-keystore", - "sc-rpc", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-runtime", - "sp-transaction-pool", + "sc-keystore 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-rpc 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "substrate-frame-rpc-system", ] @@ -5415,28 +6888,62 @@ version = "2.0.0" dependencies = [ "blake2", "chrono", - "confidential_identity", - "frame-support", - "frame-system", + "confidential_identity 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.2)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "hex", "parity-scale-codec", - "polymesh-primitives-derive", + "polymesh-primitives-derive 0.1.0", "schnorrkel 0.9.1 (git+https://github.com/PolymathNetwork/schnorrkel.git?branch=fix-simd-issue)", "serde", "serde_json", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-runtime", - "sp-runtime-interface", - "sp-std", - "sp-version", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "polymesh-primitives" +version = "2.0.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "blake2", + "chrono", + "confidential_identity 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "schnorrkel 0.9.1 (git+https://github.com/PolymathNetwork/schnorrkel.git?branch=fix-simd-issue)", + "serde", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "polymesh-primitives-derive" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] name = "polymesh-primitives-derive" version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" dependencies = [ + "proc-macro2", "quote", "syn", ] @@ -5445,185 +6952,295 @@ dependencies = [ name = "polymesh-runtime-common" version = "1.0.0" dependencies = [ - "frame-support", - "frame-system", - "pallet-asset", - "pallet-authorship", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-asset 0.1.0", + "pallet-authorship 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "pallet-balances 0.1.0", - "pallet-compliance-manager", - "pallet-contracts", - "pallet-group-rpc-runtime-api", - "pallet-identity", - "pallet-multisig", - "pallet-portfolio", - "pallet-timestamp", - "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-primitives", - "polymesh-primitives-derive", + "pallet-compliance-manager 0.1.0", + "pallet-contracts 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-group-rpc-runtime-api 2.0.0", + "pallet-identity 0.1.0", + "pallet-multisig 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0", + "polymesh-primitives 2.0.0", + "rand 0.7.3", + "serde", + "smallvec 1.6.1", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "polymesh-runtime-common" +version = "1.0.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-asset 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-authorship 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-compliance-manager 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-contracts 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-group-rpc-runtime-api 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-multisig 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-portfolio 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives-derive 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", "rand 0.7.3", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "smallvec 1.6.1", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] name = "polymesh-runtime-develop" version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-executive", - "frame-support", - "frame-system", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-executive 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "frame-system-benchmarking", - "frame-system-rpc-runtime-api", + "frame-system-rpc-runtime-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "hex-literal 0.3.1", - "node-rpc-runtime-api", - "pallet-asset", - "pallet-authority-discovery", - "pallet-authorship", - "pallet-babe", + "node-rpc-runtime-api 0.1.0", + "pallet-asset 0.1.0", + "pallet-authority-discovery 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-authorship 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-babe 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "pallet-balances 0.1.0", - "pallet-bridge", - "pallet-committee", - "pallet-compliance-manager", - "pallet-confidential", - "pallet-contracts", - "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", - "pallet-corporate-actions", - "pallet-finality-tracker", - "pallet-grandpa", - "pallet-group", - "pallet-group-rpc-runtime-api", - "pallet-identity", - "pallet-im-online", - "pallet-indices", - "pallet-multisig", - "pallet-offences", - "pallet-permissions", - "pallet-pips", - "pallet-portfolio", - "pallet-protocol-fee", - "pallet-protocol-fee-rpc-runtime-api", - "pallet-randomness-collective-flip", - "pallet-scheduler", - "pallet-session", - "pallet-settlement", - "pallet-staking", - "pallet-staking-reward-curve", - "pallet-staking-rpc-runtime-api", - "pallet-statistics", - "pallet-sto", - "pallet-sudo", - "pallet-timestamp", - "pallet-transaction-payment", + "pallet-bridge 1.0.0", + "pallet-committee 0.1.0", + "pallet-compliance-manager 0.1.0", + "pallet-confidential 0.1.0", + "pallet-contracts 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-contracts-primitives 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-contracts-rpc-runtime-api 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-corporate-actions 0.1.0", + "pallet-finality-tracker 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-grandpa 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-group 0.1.0", + "pallet-group-rpc-runtime-api 2.0.0", + "pallet-identity 0.1.0", + "pallet-im-online 2.0.0", + "pallet-indices 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-multisig 0.1.0", + "pallet-offences 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-permissions 0.1.0", + "pallet-pips 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-protocol-fee 0.1.0", + "pallet-protocol-fee-rpc-runtime-api 0.1.0", + "pallet-randomness-collective-flip 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-scheduler 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-settlement 0.1.0", + "pallet-staking 2.0.0", + "pallet-staking-reward-curve 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-staking-rpc-runtime-api 2.0.0", + "pallet-statistics 0.1.0", + "pallet-sto 0.1.0", + "pallet-sudo 2.0.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-transaction-payment 2.0.0", "pallet-treasury 0.1.0", - "pallet-utility", - "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-contracts", - "polymesh-primitives", - "polymesh-runtime-common", - "polymesh-weights", - "serde", - "smallvec 1.4.2", - "sp-api", - "sp-arithmetic", - "sp-authority-discovery", - "sp-block-builder", - "sp-consensus-babe", - "sp-core", - "sp-inherents", - "sp-io", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-transaction-pool", - "sp-version", - "substrate-wasm-builder-runner", + "pallet-utility 0.1.0", + "parity-scale-codec", + "polymesh-build-tool 0.1.0", + "polymesh-common-utilities 0.1.0", + "polymesh-contracts 0.1.0", + "polymesh-extensions", + "polymesh-primitives 2.0.0", + "polymesh-runtime-common 1.0.0", + "polymesh-weights 0.1.0", + "serde", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-authority-discovery 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-offchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-staking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "polymesh-runtime-testnet" version = "0.1.0" dependencies = [ - "frame-executive", - "frame-support", - "frame-system", - "frame-system-rpc-runtime-api", + "frame-executive 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system-rpc-runtime-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "lazy_static", - "node-rpc-runtime-api", - "pallet-asset", - "pallet-authority-discovery", - "pallet-authorship", - "pallet-babe", + "node-rpc-runtime-api 0.1.0", + "pallet-asset 0.1.0", + "pallet-authority-discovery 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-authorship 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-babe 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "pallet-balances 0.1.0", - "pallet-bridge", - "pallet-committee", - "pallet-compliance-manager", - "pallet-confidential", - "pallet-contracts", - "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", - "pallet-corporate-actions", - "pallet-finality-tracker", - "pallet-grandpa", - "pallet-group", - "pallet-group-rpc-runtime-api", - "pallet-identity", - "pallet-im-online", - "pallet-indices", - "pallet-multisig", - "pallet-offences", - "pallet-permissions", - "pallet-pips", - "pallet-portfolio", - "pallet-protocol-fee", - "pallet-protocol-fee-rpc-runtime-api", - "pallet-randomness-collective-flip", - "pallet-scheduler", - "pallet-session", - "pallet-settlement", - "pallet-staking", - "pallet-staking-reward-curve", - "pallet-staking-rpc-runtime-api", - "pallet-statistics", - "pallet-sto", - "pallet-sudo", - "pallet-timestamp", - "pallet-transaction-payment", + "pallet-bridge 1.0.0", + "pallet-committee 0.1.0", + "pallet-compliance-manager 0.1.0", + "pallet-confidential 0.1.0", + "pallet-contracts 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-contracts-primitives 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-contracts-rpc-runtime-api 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-corporate-actions 0.1.0", + "pallet-finality-tracker 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-grandpa 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-group 0.1.0", + "pallet-group-rpc-runtime-api 2.0.0", + "pallet-identity 0.1.0", + "pallet-im-online 2.0.0", + "pallet-indices 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-multisig 0.1.0", + "pallet-offences 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-permissions 0.1.0", + "pallet-pips 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-protocol-fee 0.1.0", + "pallet-protocol-fee-rpc-runtime-api 0.1.0", + "pallet-randomness-collective-flip 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-scheduler 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-settlement 0.1.0", + "pallet-staking 2.0.0", + "pallet-staking-reward-curve 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-staking-rpc-runtime-api 2.0.0", + "pallet-statistics 0.1.0", + "pallet-sto 0.1.0", + "pallet-sudo 2.0.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-transaction-payment 2.0.0", "pallet-treasury 0.1.0", - "pallet-utility", - "parity-scale-codec", - "polymesh-common-utilities", - "polymesh-contracts", - "polymesh-primitives", - "polymesh-runtime-common", - "polymesh-weights", + "pallet-utility 0.1.0", + "parity-scale-codec", + "polymesh-build-tool 0.1.0", + "polymesh-common-utilities 0.1.0", + "polymesh-contracts 0.1.0", + "polymesh-extensions", + "polymesh-primitives 2.0.0", + "polymesh-runtime-common 1.0.0", + "polymesh-weights 0.1.0", "serde", "serde_derive", - "smallvec 1.4.2", - "sp-api", - "sp-arithmetic", - "sp-authority-discovery", - "sp-block-builder", - "sp-consensus-babe", - "sp-core", - "sp-inherents", - "sp-io", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-transaction-pool", - "sp-version", - "substrate-wasm-builder-runner", + "smallvec 1.6.1", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-authority-discovery 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-offchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-staking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "polymesh-runtime-testnet" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-executive 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system-rpc-runtime-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "lazy_static", + "node-rpc-runtime-api 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-asset 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-authority-discovery 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-authorship 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-babe 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-bridge 1.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-committee 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-compliance-manager 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-confidential 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-contracts 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-contracts-primitives 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-contracts-rpc-runtime-api 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-corporate-actions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-finality-tracker 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-grandpa 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-group 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-group-rpc-runtime-api 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-im-online 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-indices 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-multisig 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-offences 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-permissions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-pips 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-portfolio 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-protocol-fee 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-protocol-fee-rpc-runtime-api 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-randomness-collective-flip 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-scheduler 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-settlement 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-staking 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-staking-reward-curve 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-staking-rpc-runtime-api 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-statistics 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-sto 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-sudo 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-transaction-payment 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-treasury 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-utility 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "parity-scale-codec", + "polymesh-build-tool 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-common-utilities 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-contracts 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-primitives 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-runtime-common 1.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-weights 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "serde", + "smallvec 1.6.1", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-authority-discovery 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-block-builder 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-offchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-staking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] @@ -5631,66 +7248,67 @@ name = "polymesh-runtime-tests" version = "1.0.0" dependencies = [ "chrono", - "confidential_identity", - "env_logger", - "frame-benchmarking", - "frame-support", - "frame-system", + "confidential_identity 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=v2.2.2)", + "env_logger 0.7.1", + "frame-benchmarking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "hex-literal 0.3.1", "ink_primitives", "lazy_static", "libsecp256k1", - "pallet-asset", - "pallet-authorship", - "pallet-babe", + "pallet-asset 0.1.0", + "pallet-authorship 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-babe 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "pallet-balances 0.1.0", - "pallet-bridge", - "pallet-committee", - "pallet-compliance-manager", - "pallet-confidential", - "pallet-contracts", - "pallet-corporate-actions", - "pallet-group", - "pallet-group-rpc-runtime-api", - "pallet-identity", - "pallet-multisig", - "pallet-permissions", - "pallet-pips", - "pallet-portfolio", - "pallet-protocol-fee", - "pallet-randomness-collective-flip", - "pallet-scheduler", - "pallet-session", - "pallet-settlement", - "pallet-staking", - "pallet-staking-reward-curve", - "pallet-statistics", - "pallet-sto", - "pallet-timestamp", - "pallet-transaction-payment", + "pallet-bridge 1.0.0", + "pallet-committee 0.1.0", + "pallet-compliance-manager 0.1.0", + "pallet-confidential 0.1.0", + "pallet-contracts 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-corporate-actions 0.1.0", + "pallet-group 0.1.0", + "pallet-group-rpc-runtime-api 2.0.0", + "pallet-identity 0.1.0", + "pallet-multisig 0.1.0", + "pallet-permissions 0.1.0", + "pallet-pips 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-protocol-fee 0.1.0", + "pallet-randomness-collective-flip 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-scheduler 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-settlement 0.1.0", + "pallet-staking 2.0.0", + "pallet-staking-reward-curve 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-statistics 0.1.0", + "pallet-sto 0.1.0", + "pallet-sudo 2.0.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-transaction-payment 2.0.0", "pallet-treasury 0.1.0", - "pallet-utility", + "pallet-utility 0.1.0", "parity-scale-codec", "parking_lot 0.10.2", - "polymesh-common-utilities", - "polymesh-contracts", - "polymesh-primitives", - "polymesh-primitives-derive", - "polymesh-runtime-common", + "polymesh-common-utilities 0.1.0", + "polymesh-contracts 0.1.0", + "polymesh-extensions", + "polymesh-primitives 2.0.0", + "polymesh-runtime-common 1.0.0", "polymesh-runtime-develop", - "polymesh-weights", + "polymesh-weights 0.1.0", "rand 0.7.3", "serde", "serde_json", - "smallvec 1.4.2", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-npos-elections", - "sp-runtime", - "sp-staking", - "sp-std", - "substrate-test-runtime-client", + "smallvec 1.6.1", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-npos-elections 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-staking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-test-runtime-client 2.0.0 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "substrate-test-utils", "wat", ] @@ -5699,49 +7317,99 @@ dependencies = [ name = "polymesh-weights" version = "0.1.0" dependencies = [ - "frame-support", - "frame-system", - "pallet-asset", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-asset 0.1.0", + "pallet-babe 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "pallet-balances 0.1.0", - "pallet-compliance-manager", - "pallet-confidential", - "pallet-corporate-actions", - "pallet-group", - "pallet-identity", - "pallet-im-online", - "pallet-multisig", - "pallet-pips", - "pallet-portfolio", - "pallet-protocol-fee", - "pallet-settlement", - "pallet-statistics", - "pallet-timestamp", + "pallet-committee 0.1.0", + "pallet-compliance-manager 0.1.0", + "pallet-confidential 0.1.0", + "pallet-corporate-actions 0.1.0", + "pallet-grandpa 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-group 0.1.0", + "pallet-identity 0.1.0", + "pallet-im-online 2.0.0", + "pallet-indices 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-multisig 0.1.0", + "pallet-pips 0.1.0", + "pallet-portfolio 0.1.0", + "pallet-protocol-fee 0.1.0", + "pallet-scheduler 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-settlement 0.1.0", + "pallet-staking 2.0.0", + "pallet-statistics 0.1.0", + "pallet-sto 0.1.0", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "pallet-treasury 0.1.0", - "pallet-utility", - "polymesh-contracts", + "pallet-utility 0.1.0", + "polymesh-contracts 0.1.0", + "polymesh-runtime-common 1.0.0", +] + +[[package]] +name = "polymesh-weights" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172#14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" +dependencies = [ + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-asset 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-babe 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-balances 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-committee 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-compliance-manager 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-confidential 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-corporate-actions 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-grandpa 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-group 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-identity 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-im-online 2.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-indices 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-multisig 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-pips 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-portfolio 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-protocol-fee 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-scheduler 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-settlement 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-statistics 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-sto 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-treasury 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "pallet-utility 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-contracts 0.1.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", + "polymesh-runtime-common 1.0.0 (git+https://github.com/PolymathNetwork/Polymesh?rev=14951c75b778d5ee75c8ecdc02b70b6eb6d7b172)", ] [[package]] name = "polyval" -version = "0.4.1" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5884790f1ce3553ad55fec37b5aaac5882e0e845a2612df744d6c85c9bf046c" +checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" dependencies = [ - "cfg-if 0.1.10", + "cpuid-bool 0.2.0", + "opaque-debug 0.3.0", "universal-hash", ] [[package]] name = "ppv-lite86" -version = "0.2.9" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "primitive-types" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55c21c64d0eaa4d7ed885d959ef2d62d9e488c27c0e02d9aa5ce6c877b7d5f8" +checksum = "7dd39dcacf71411ba488570da7bbc89b717225e46478b30ba99b92db6b149809" dependencies = [ "fixed-hash", "impl-codec", @@ -5784,15 +7452,15 @@ dependencies = [ [[package]] name = "proc-macro-hack" -version = "0.5.18" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro-nested" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" @@ -5812,7 +7480,7 @@ dependencies = [ "cfg-if 0.1.10", "fnv", "lazy_static", - "parking_lot 0.11.0", + "parking_lot 0.11.1", "regex", "thiserror", ] @@ -5874,9 +7542,9 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f53bc2558e8376358ebdc28301546471d67336584f6438ed4b7c7457a055fd7" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "log", - "parity-wasm 0.41.0", + "parity-wasm", ] [[package]] @@ -5893,14 +7561,14 @@ checksum = "77de3c815e5a160b1539c6592796801df2043ae35e123b46d73380cfa57af858" dependencies = [ "futures-core", "futures-sink", - "pin-project-lite", + "pin-project-lite 0.1.11", ] [[package]] name = "quote" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" dependencies = [ "proc-macro2", ] @@ -5940,7 +7608,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi 0.0.3", + "cloudabi", "fuchsia-cprng", "libc", "rand_core 0.3.1", @@ -5972,7 +7640,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.15", + "getrandom 0.1.16", "libc", "rand_chacha 0.2.2", "rand_core 0.5.1", @@ -5980,6 +7648,18 @@ dependencies = [ "rand_pcg 0.2.1", ] +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.1", + "rand_hc 0.3.0", +] + [[package]] name = "rand_chacha" version = "0.1.1" @@ -6000,6 +7680,16 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.1", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -6021,7 +7711,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.15", + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" +dependencies = [ + "getrandom 0.2.2", ] [[package]] @@ -6042,6 +7741,15 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core 0.6.1", +] + [[package]] name = "rand_isaac" version = "0.1.1" @@ -6068,7 +7776,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" dependencies = [ - "cloudabi 0.0.3", + "cloudabi", "fuchsia-cprng", "libc", "rand_core 0.4.2", @@ -6106,9 +7814,9 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "7.0.3" +version = "7.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a349ca83373cfa5d6dbb66fd76e58b2cca08da71a5f6400de0a0a6a9bceeaf" +checksum = "beb71f708fe39b2c5e98076204c3cc094ee5a4c12c4cdb119a2b72dc34164f41" dependencies = [ "bitflags", "cc", @@ -6123,25 +7831,25 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf6960dc9a5b4ee8d3e4c5787b4a112a8818e0290a42ff664ad60692fdf2032" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ "autocfg 1.0.1", - "crossbeam-deque", + "crossbeam-deque 0.8.0", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", + "crossbeam-deque 0.8.0", + "crossbeam-utils 0.8.1", "lazy_static", "num_cpus", ] @@ -6161,31 +7869,40 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +[[package]] +name = "redox_syscall" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" dependencies = [ - "getrandom 0.1.15", - "redox_syscall", + "getrandom 0.1.16", + "redox_syscall 0.1.57", "rust-argon2", ] [[package]] name = "ref-cast" -version = "1.0.2" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745c1787167ddae5569661d5ffb8b25ae5fedbf46717eaa92d652221cec72623" +checksum = "300f2a835d808734ee295d45007adacb9ebb29dd3ae2424acfa17930cae541da" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.2" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" +checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" dependencies = [ "proc-macro2", "quote", @@ -6200,14 +7917,14 @@ checksum = "b9ba8aaf5fe7cf307c6dbdaeed85478961d29e25e3bee5169e11b92fa9f027a8" dependencies = [ "log", "rustc-hash", - "smallvec 1.4.2", + "smallvec 1.6.1", ] [[package]] name = "regex" -version = "1.4.1" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" dependencies = [ "aho-corasick", "memchr", @@ -6221,15 +7938,15 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.20" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "region" @@ -6243,6 +7960,42 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "remote-externalities" +version = "0.1.0" +dependencies = [ + "async-std", + "bincode", + "env_logger 0.8.2", + "futures 0.1.30", + "hex-literal 0.3.1", + "jsonrpc-core-client", + "log", + "sc-rpc 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-rpc-api 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "tokio 0.1.22", +] + +[[package]] +name = "remote-externalities" +version = "0.1.0" +source = "git+https://github.com/PolymathNetwork/Polymesh?rev=065ea0c243c7e6f6d665d769cf79647d2ecfca00#065ea0c243c7e6f6d665d769cf79647d2ecfca00" +dependencies = [ + "bincode", + "env_logger 0.8.2", + "futures 0.1.30", + "hex-literal 0.3.1", + "jsonrpc-core-client", + "log", + "sc-rpc 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-rpc-api 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "tokio 0.1.22", +] + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -6254,19 +8007,19 @@ dependencies = [ [[package]] name = "retain_mut" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e005d658ad26eacc2b6c506dfde519f4e277e328d0eb3379ca61647d70a8f531" +checksum = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" [[package]] name = "ring" -version = "0.16.15" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "952cd6b98c85bbc30efa1ba5783b8abf12fec8b3287ffa52605b9432313e34e4" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" dependencies = [ "cc", "libc", - "once_cell 1.4.1", + "once_cell 1.5.2", "spin", "untrusted", "web-sys", @@ -6295,21 +8048,21 @@ dependencies = [ [[package]] name = "rust-argon2" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dab61250775933275e84053ac235621dfb739556d5c54a2f2e9313b7cf43a19" +checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" dependencies = [ - "base64 0.12.3", + "base64 0.13.0", "blake2b_simd", "constant_time_eq", - "crossbeam-utils", + "crossbeam-utils 0.8.1", ] [[package]] name = "rustc-demangle" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2610b7f643d18c87dff3b489950269617e6601a51f1f05aa5daefee36f64f0b" +checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" [[package]] name = "rustc-hash" @@ -6329,7 +8082,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0", + "semver", ] [[package]] @@ -6363,7 +8116,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "pin-project 0.4.27", "static_assertions", ] @@ -6403,13 +8156,13 @@ dependencies = [ [[package]] name = "sc-authority-discovery" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "bytes 0.5.6", "derive_more", "either", - "futures 0.3.6", + "futures 0.3.12", "futures-timer 3.0.2", "libp2p", "log", @@ -6417,91 +8170,136 @@ dependencies = [ "prost", "prost-build", "rand 0.7.3", - "sc-client-api", - "sc-keystore", - "sc-network", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-keystore 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-network 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde_json", - "sp-api", - "sp-authority-discovery", - "sp-blockchain", - "sp-core", - "sp-runtime", - "substrate-prometheus-endpoint", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-authority-discovery 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-basic-authorship" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "futures-timer 3.0.2", "log", "parity-scale-codec", - "sc-block-builder", - "sc-client-api", + "sc-block-builder 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "sc-proposer-metrics", - "sc-telemetry", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-transaction-pool", - "substrate-prometheus-endpoint", + "sc-telemetry 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "tokio-executor 0.2.0-alpha.6", ] [[package]] name = "sc-block-builder" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-block-builder 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sc-block-builder" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", - "sc-client-api", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-chain-spec" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", - "sc-chain-spec-derive", - "sc-network", - "sc-telemetry", + "sc-chain-spec-derive 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-network 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-telemetry 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "serde", "serde_json", - "sp-chain-spec", - "sp-core", - "sp-runtime", + "sp-chain-spec 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "sc-chain-spec-derive" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +name = "sc-chain-spec" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", + "impl-trait-for-tuples", + "parity-scale-codec", + "sc-chain-spec-derive 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-network 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-telemetry 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "serde", + "serde_json", + "sp-chain-spec 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "sc-chain-spec-derive" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sc-chain-spec-derive" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "sc-cli" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "ansi_term 0.12.1", "atty", @@ -6509,7 +8307,7 @@ dependencies = [ "chrono", "derive_more", "fdlimit", - "futures 0.3.6", + "futures 0.3.12", "hex", "lazy_static", "libp2p", @@ -6521,27 +8319,27 @@ dependencies = [ "rand 0.7.3", "regex", "rpassword", - "sc-client-api", - "sc-informant", - "sc-keystore", - "sc-network", - "sc-service", - "sc-telemetry", - "sc-tracing", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-informant 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-keystore 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-network 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-service 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-telemetry 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-tracing 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde", "serde_json", - "sp-blockchain", - "sp-core", - "sp-keyring", - "sp-panic-handler", - "sp-runtime", - "sp-state-machine", - "sp-utils", - "sp-version", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-keyring 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-panic-handler 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "structopt", - "substrate-prometheus-endpoint", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "time", - "tokio 0.2.22", + "tokio 0.2.25", "tracing", "tracing-log", "tracing-subscriber", @@ -6549,12 +8347,48 @@ dependencies = [ [[package]] name = "sc-client-api" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "fnv", + "futures 0.3.12", + "hash-db", + "hex-literal 0.3.1", + "kvdb", + "lazy_static", + "log", + "parity-scale-codec", + "parking_lot 0.10.2", + "sc-executor 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-telemetry 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-database 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-externalities 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-keyring 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-storage 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-trie 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-utils 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sc-client-api" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", "fnv", - "futures 0.3.6", + "futures 0.3.12", "hash-db", "hex-literal 0.3.1", "kvdb", @@ -6562,31 +8396,59 @@ dependencies = [ "log", "parity-scale-codec", "parking_lot 0.10.2", - "sc-executor", - "sc-telemetry", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-database", - "sp-externalities", - "sp-inherents", - "sp-keyring", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-storage", - "sp-transaction-pool", - "sp-trie", - "sp-utils", - "sp-version", - "substrate-prometheus-endpoint", + "sc-executor 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-telemetry 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-database 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-keyring 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-storage 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-client-db" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "blake2-rfc", + "hash-db", + "kvdb", + "kvdb-memorydb", + "linked-hash-map", + "log", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.10.2", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-executor 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-state-db 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-database 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-trie 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sc-client-db" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "blake2-rfc", "hash-db", @@ -6599,39 +8461,50 @@ dependencies = [ "parity-scale-codec", "parity-util-mem", "parking_lot 0.10.2", - "sc-client-api", - "sc-executor", - "sc-state-db", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-database", - "sp-runtime", - "sp-state-machine", - "sp-trie", - "substrate-prometheus-endpoint", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-executor 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-state-db 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-database 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-consensus" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sc-consensus" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "sc-client-api", - "sp-blockchain", - "sp-consensus", - "sp-runtime", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-consensus-babe" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", - "fork-tree", - "futures 0.3.6", + "fork-tree 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "futures 0.3.12", "futures-timer 3.0.2", "log", "merlin", @@ -6643,266 +8516,359 @@ dependencies = [ "pdqselect", "rand 0.7.3", "retain_mut", - "sc-client-api", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "sc-consensus-epochs", "sc-consensus-slots", "sc-consensus-uncles", - "sc-keystore", - "sc-telemetry", + "sc-keystore 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-telemetry 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "schnorrkel 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde", - "sp-api", - "sp-application-crypto", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-consensus-vrf", - "sp-core", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-timestamp", - "sp-utils", - "sp-version", - "substrate-prometheus-endpoint", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-vrf 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-consensus-babe-rpc" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", - "futures 0.3.6", + "futures 0.3.12", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "sc-consensus-babe", "sc-consensus-epochs", - "sc-keystore", - "sc-rpc-api", + "sc-keystore 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-rpc-api 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde", - "sp-api", - "sp-application-crypto", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-core", - "sp-runtime", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-consensus-epochs" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "fork-tree", + "fork-tree 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "parking_lot 0.10.2", - "sc-client-api", - "sp-blockchain", - "sp-runtime", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-consensus-slots" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "futures-timer 3.0.2", "log", "parity-scale-codec", "parking_lot 0.10.2", - "sc-client-api", - "sc-telemetry", - "sp-api", - "sp-application-crypto", - "sp-blockchain", - "sp-consensus", - "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-telemetry 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-slots 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-consensus-uncles" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "log", - "sc-client-api", - "sp-authorship", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-authorship 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-executor" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ "derive_more", "lazy_static", "libsecp256k1", "log", "parity-scale-codec", - "parity-wasm 0.41.0", + "parity-wasm", "parking_lot 0.10.2", - "sc-executor-common", - "sc-executor-wasmi", + "sc-executor-common 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-executor-wasmi 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-externalities 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-panic-handler 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-serializer 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-trie 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasmi", +] + +[[package]] +name = "sc-executor" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "derive_more", + "lazy_static", + "libsecp256k1", + "log", + "parity-scale-codec", + "parity-wasm", + "parking_lot 0.10.2", + "sc-executor-common 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-executor-wasmi 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "sc-executor-wasmtime", - "sp-api", - "sp-core", - "sp-externalities", - "sp-io", - "sp-panic-handler", - "sp-runtime-interface", - "sp-serializer", - "sp-trie", - "sp-version", - "sp-wasm-interface", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-panic-handler 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-serializer 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasmi", ] [[package]] name = "sc-executor-common" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "log", + "parity-scale-codec", + "parity-wasm", + "sp-allocator 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-serializer 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasmi", +] + +[[package]] +name = "sc-executor-common" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", "log", "parity-scale-codec", - "parity-wasm 0.41.0", - "sp-allocator", - "sp-core", - "sp-runtime-interface", - "sp-serializer", - "sp-wasm-interface", + "parity-wasm", + "sp-allocator 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-serializer 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasmi", ] [[package]] name = "sc-executor-wasmi" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "log", + "parity-scale-codec", + "sc-executor-common 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-allocator 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasmi", +] + +[[package]] +name = "sc-executor-wasmi" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "log", "parity-scale-codec", - "sc-executor-common", - "sp-allocator", - "sp-core", - "sp-runtime-interface", - "sp-wasm-interface", + "sc-executor-common 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-allocator 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasmi", ] [[package]] name = "sc-executor-wasmtime" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "log", "parity-scale-codec", - "parity-wasm 0.41.0", + "parity-wasm", "pwasm-utils", - "sc-executor-common", + "sc-executor-common 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "scoped-tls", - "sp-allocator", - "sp-core", - "sp-runtime-interface", - "sp-wasm-interface", + "sp-allocator 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasmtime", ] [[package]] name = "sc-finality-grandpa" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", "finality-grandpa", - "fork-tree", - "futures 0.3.6", + "fork-tree 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "futures 0.3.12", "futures-timer 3.0.2", "log", "parity-scale-codec", "parking_lot 0.10.2", "pin-project 0.4.27", "rand 0.7.3", - "sc-block-builder", - "sc-client-api", - "sc-consensus", - "sc-keystore", - "sc-network", + "sc-block-builder 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-keystore 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-network 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "sc-network-gossip", - "sc-telemetry", + "sc-telemetry 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde_json", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-finality-grandpa", - "sp-finality-tracker", - "sp-inherents", - "sp-runtime", - "sp-utils", - "substrate-prometheus-endpoint", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-finality-grandpa 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-finality-tracker 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-finality-grandpa-rpc" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", "finality-grandpa", - "futures 0.3.6", + "futures 0.3.12", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "jsonrpc-pubsub", "log", "parity-scale-codec", - "sc-client-api", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "sc-finality-grandpa", - "sc-rpc", + "sc-rpc 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde", "serde_json", - "sp-blockchain", - "sp-core", - "sp-runtime", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-informant" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "ansi_term 0.12.1", + "futures 0.3.12", + "log", + "parity-util-mem", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-network 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-utils 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasm-timer", +] + +[[package]] +name = "sc-informant" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "ansi_term 0.12.1", - "futures 0.3.6", + "futures 0.3.12", "log", "parity-util-mem", - "sc-client-api", - "sc-network", - "sp-blockchain", - "sp-runtime", - "sp-transaction-pool", - "sp-utils", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-network 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasm-timer", ] [[package]] name = "sc-keystore" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "hex", + "merlin", + "parking_lot 0.10.2", + "rand 0.7.3", + "serde_json", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "subtle 2.4.0", +] + +[[package]] +name = "sc-keystore" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", "hex", @@ -6910,46 +8876,119 @@ dependencies = [ "parking_lot 0.10.2", "rand 0.7.3", "serde_json", - "sp-application-crypto", - "sp-core", - "subtle 2.3.0", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "subtle 2.4.0", ] [[package]] name = "sc-light" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "hash-db", + "lazy_static", + "parity-scale-codec", + "parking_lot 0.10.2", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-executor 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-externalities 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sc-light" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "hash-db", "lazy_static", "parity-scale-codec", "parking_lot 0.10.2", - "sc-client-api", - "sc-executor", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-externalities", - "sp-runtime", - "sp-state-machine", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-executor 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-network" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "async-std", + "async-trait", + "bitflags", + "bs58 0.3.1", + "bytes 0.5.6", + "derive_more", + "either", + "erased-serde", + "fnv", + "fork-tree 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "futures 0.3.12", + "futures-timer 3.0.2", + "futures_codec", + "hex", + "ip_network", + "libp2p", + "linked-hash-map", + "linked_hash_set", + "log", + "lru 0.4.3", + "nohash-hasher", + "parity-scale-codec", + "parking_lot 0.10.2", + "pin-project 0.4.27", + "prost", + "prost-build", + "rand 0.7.3", + "sc-block-builder 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-peerset 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "serde", + "serde_json", + "slog", + "slog_derive", + "smallvec 0.6.14", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-utils 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "thiserror", + "unsigned-varint 0.4.0", + "void", + "wasm-timer", + "zeroize", +] + +[[package]] +name = "sc-network" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "async-std", "async-trait", "bitflags", - "bs58", + "bs58 0.3.1", "bytes 0.5.6", "derive_more", "either", "erased-serde", "fnv", - "fork-tree", - "futures 0.3.6", + "fork-tree 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "futures 0.3.12", "futures-timer 3.0.2", "futures_codec", "hex", @@ -6966,21 +9005,21 @@ dependencies = [ "prost", "prost-build", "rand 0.7.3", - "sc-block-builder", - "sc-client-api", - "sc-peerset", + "sc-block-builder 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-peerset 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde", "serde_json", "slog", "slog_derive", - "smallvec 0.6.13", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-runtime", - "sp-utils", - "substrate-prometheus-endpoint", + "smallvec 0.6.14", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "thiserror", "unsigned-varint 0.4.0", "void", @@ -6990,107 +9029,179 @@ dependencies = [ [[package]] name = "sc-network-gossip" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "futures-timer 3.0.2", "libp2p", "log", "lru 0.4.3", - "sc-network", - "sp-runtime", + "sc-network 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasm-timer", ] [[package]] name = "sc-offchain" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "bytes 0.5.6", + "fnv", + "futures 0.3.12", + "futures-timer 3.0.2", + "hyper 0.13.10", + "hyper-rustls", + "log", + "num_cpus", + "parity-scale-codec", + "parking_lot 0.10.2", + "rand 0.7.3", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-keystore 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-network 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-offchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-utils 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "threadpool", +] + +[[package]] +name = "sc-offchain" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "bytes 0.5.6", "fnv", - "futures 0.3.6", + "futures 0.3.12", "futures-timer 3.0.2", - "hyper 0.13.8", + "hyper 0.13.10", "hyper-rustls", "log", "num_cpus", "parity-scale-codec", "parking_lot 0.10.2", "rand 0.7.3", - "sc-client-api", - "sc-keystore", - "sc-network", - "sp-api", - "sp-core", - "sp-offchain", - "sp-runtime", - "sp-utils", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-keystore 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-network 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-offchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "threadpool", ] [[package]] name = "sc-peerset" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "futures 0.3.12", + "libp2p", + "log", + "serde_json", + "sp-utils 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasm-timer", +] + +[[package]] +name = "sc-peerset" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "libp2p", "log", "serde_json", - "sp-utils", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasm-timer", ] [[package]] name = "sc-proposer-metrics" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "log", - "substrate-prometheus-endpoint", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-rpc" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "futures 0.3.12", + "hash-db", + "jsonrpc-core", + "jsonrpc-pubsub", + "log", + "parity-scale-codec", + "parking_lot 0.10.2", + "sc-block-builder 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-executor 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-keystore 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-rpc-api 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "serde_json", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-chain-spec 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-offchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-rpc 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-utils 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sc-rpc" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", "log", "parity-scale-codec", "parking_lot 0.10.2", - "sc-block-builder", - "sc-client-api", - "sc-executor", - "sc-keystore", - "sc-rpc-api", + "sc-block-builder 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-executor 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-keystore 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-rpc-api 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde_json", - "sp-api", - "sp-blockchain", - "sp-chain-spec", - "sp-core", - "sp-offchain", - "sp-rpc", - "sp-runtime", - "sp-session", - "sp-state-machine", - "sp-transaction-pool", - "sp-utils", - "sp-version", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-chain-spec 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-offchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-rpc 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-rpc-api" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ "derive_more", - "futures 0.3.6", + "futures 0.3.12", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -7100,18 +9211,42 @@ dependencies = [ "parking_lot 0.10.2", "serde", "serde_json", - "sp-chain-spec", - "sp-core", - "sp-rpc", - "sp-runtime", - "sp-transaction-pool", - "sp-version", + "sp-chain-spec 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-rpc 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "sc-rpc-server" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +name = "sc-rpc-api" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "derive_more", + "futures 0.3.12", + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", + "jsonrpc-pubsub", + "log", + "parity-scale-codec", + "parking_lot 0.10.2", + "serde", + "serde_json", + "sp-chain-spec 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-rpc 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "sc-rpc-server" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ "futures 0.1.30", "jsonrpc-core", @@ -7122,20 +9257,100 @@ dependencies = [ "log", "serde", "serde_json", - "sp-runtime", - "substrate-prometheus-endpoint", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sc-rpc-server" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "futures 0.1.30", + "jsonrpc-core", + "jsonrpc-http-server", + "jsonrpc-ipc-server", + "jsonrpc-pubsub", + "jsonrpc-ws-server", + "log", + "serde", + "serde_json", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-service" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "directories", + "exit-future", + "futures 0.1.30", + "futures 0.3.12", + "futures-timer 3.0.2", + "hash-db", + "jsonrpc-core", + "jsonrpc-pubsub", + "lazy_static", + "log", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.10.2", + "pin-project 0.4.27", + "rand 0.7.3", + "sc-block-builder 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-chain-spec 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-client-db 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-executor 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-informant 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-keystore 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-light 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-network 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-offchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-rpc 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-rpc-server 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-telemetry 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-tracing 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-transaction-pool 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "serde", + "serde_json", + "slog", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-block-builder 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-externalities 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-tracing 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-trie 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-utils 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "tempfile", + "tracing", + "wasm-timer", +] + +[[package]] +name = "sc-service" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", "directories", "exit-future", "futures 0.1.30", - "futures 0.3.6", + "futures 0.3.12", "futures-timer 3.0.2", "hash-db", "jsonrpc-core", @@ -7147,42 +9362,42 @@ dependencies = [ "parking_lot 0.10.2", "pin-project 0.4.27", "rand 0.7.3", - "sc-block-builder", - "sc-chain-spec", - "sc-client-api", - "sc-client-db", - "sc-executor", - "sc-informant", - "sc-keystore", - "sc-light", - "sc-network", - "sc-offchain", - "sc-rpc", - "sc-rpc-server", - "sc-telemetry", - "sc-tracing", - "sc-transaction-pool", + "sc-block-builder 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-chain-spec 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-client-db 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-executor 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-informant 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-keystore 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-light 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-network 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-offchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-rpc 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-rpc-server 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-telemetry 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-tracing 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde", "serde_json", "slog", - "sp-api", - "sp-application-crypto", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-externalities", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-session", - "sp-state-machine", - "sp-tracing", - "sp-transaction-pool", - "sp-trie", - "sp-utils", - "sp-version", - "substrate-prometheus-endpoint", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-tracing 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "tempfile", "tracing", "wasm-timer", @@ -7190,24 +9405,59 @@ dependencies = [ [[package]] name = "sc-state-db" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "log", + "parity-scale-codec", + "parity-util-mem", + "parity-util-mem-derive", + "parking_lot 0.10.2", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sc-state-db" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "log", "parity-scale-codec", "parity-util-mem", "parity-util-mem-derive", "parking_lot 0.10.2", - "sc-client-api", - "sp-core", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sc-telemetry" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "futures 0.3.12", + "futures-timer 3.0.2", + "libp2p", + "log", + "parking_lot 0.10.2", + "pin-project 0.4.27", + "rand 0.7.3", + "serde", + "slog", + "slog-json", + "slog-scope", + "take_mut", + "void", + "wasm-timer", +] + +[[package]] +name = "sc-telemetry" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "futures-timer 3.0.2", "libp2p", "log", @@ -7225,18 +9475,37 @@ dependencies = [ [[package]] name = "sc-tracing" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ "erased-serde", "log", "parking_lot 0.10.2", "rustc-hash", - "sc-telemetry", + "sc-telemetry 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", "serde", "serde_json", "slog", - "sp-tracing", + "sp-tracing 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sc-tracing" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "erased-serde", + "log", + "parking_lot 0.10.2", + "rustc-hash", + "sc-telemetry 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "serde", + "serde_json", + "slog", + "sp-tracing 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "tracing", "tracing-core", "tracing-subscriber", @@ -7244,48 +9513,95 @@ dependencies = [ [[package]] name = "sc-transaction-graph" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "futures 0.3.12", + "linked-hash-map", + "log", + "parity-util-mem", + "parking_lot 0.10.2", + "retain_mut", + "serde", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-utils 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasm-timer", +] + +[[package]] +name = "sc-transaction-graph" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", - "futures 0.3.6", + "futures 0.3.12", "linked-hash-map", "log", "parity-util-mem", "parking_lot 0.10.2", "retain_mut", "serde", - "sp-blockchain", - "sp-core", - "sp-runtime", - "sp-transaction-pool", - "sp-utils", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasm-timer", ] [[package]] name = "sc-transaction-pool" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "futures 0.3.12", + "futures-diagnose", + "intervalier", + "log", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.10.2", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-transaction-graph 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-tracing 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-utils 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasm-timer", +] + +[[package]] +name = "sc-transaction-pool" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", - "futures 0.3.6", + "futures 0.3.12", "futures-diagnose", "intervalier", "log", "parity-scale-codec", "parity-util-mem", "parking_lot 0.10.2", - "sc-client-api", - "sc-transaction-graph", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-runtime", - "sp-tracing", - "sp-transaction-pool", - "sp-utils", - "substrate-prometheus-endpoint", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-transaction-graph 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-tracing 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasm-timer", ] @@ -7306,14 +9622,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" dependencies = [ "arrayref", - "arrayvec 0.5.1", - "curve25519-dalek 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "getrandom 0.1.15", + "arrayvec 0.5.2", + "curve25519-dalek 2.1.2", + "getrandom 0.1.16", "merlin", "rand 0.7.3", "rand_core 0.5.1", "sha2 0.8.2", - "subtle 2.3.0", + "subtle 2.4.0", "zeroize", ] @@ -7323,15 +9639,15 @@ version = "0.9.1" source = "git+https://github.com/PolymathNetwork/schnorrkel.git?branch=fix-simd-issue#ee2eae5ef42e23685931d3cbc9019166775d8fb4" dependencies = [ "arrayref", - "arrayvec 0.5.1", - "curve25519-dalek 2.1.0 (git+https://github.com/PolymathNetwork/curve25519-dalek.git?branch=v2-packed-simd)", - "getrandom 0.1.15", + "arrayvec 0.5.2", + "curve25519-dalek 2.1.0", + "getrandom 0.1.16", "merlin", "rand 0.7.3", "rand_core 0.5.1", "serde", "sha2 0.8.2", - "subtle 2.3.0", + "subtle 2.4.0", "zeroize", ] @@ -7353,6 +9669,22 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scraper" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e02aa790c80c2e494130dec6a522033b6a23603ffc06360e9fe6c611ea2c12" +dependencies = [ + "cssparser", + "ego-tree", + "getopts", + "html5ever", + "matches", + "selectors", + "smallvec 1.6.1", + "tendril", +] + [[package]] name = "scroll" version = "0.10.2" @@ -7364,9 +9696,9 @@ dependencies = [ [[package]] name = "scroll_derive" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dfde5d1531034db129e95c76ac857e2baecea3443579d493d02224950b0fb6d" +checksum = "aaaae8f38bb311444cfb7f1979af0bc9240d95795f75f9ceddf6a59b79ceffa0" dependencies = [ "proc-macro2", "quote", @@ -7416,12 +9748,23 @@ dependencies = [ ] [[package]] -name = "semver" -version = "0.6.0" +name = "selectors" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" +checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe" dependencies = [ - "semver-parser", + "bitflags", + "cssparser", + "derive_more", + "fxhash", + "log", + "matches", + "phf", + "phf_codegen", + "precomputed-hash", + "servo_arc", + "smallvec 1.6.1", + "thin-slice", ] [[package]] @@ -7431,7 +9774,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ "semver-parser", - "serde", ] [[package]] @@ -7442,9 +9784,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.117" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" dependencies = [ "serde_derive", ] @@ -7461,9 +9803,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.117" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" +checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" dependencies = [ "proc-macro2", "quote", @@ -7472,15 +9814,25 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.59" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" +checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "servo_arc" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98238b800e0d1576d8b6e3de32827c2d74bee68bb97748dcf5071fb53965432" +dependencies = [ + "nodrop", + "stable_deref_trait", +] + [[package]] name = "sha-1" version = "0.8.2" @@ -7495,13 +9847,13 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" +checksum = "f4b312c3731e3fe78a185e6b9b911a7aa715b8e31cce117975219aab2acf285d" dependencies = [ "block-buffer 0.9.0", - "cfg-if 0.1.10", - "cpuid-bool", + "cfg-if 1.0.0", + "cpuid-bool 0.1.2", "digest 0.9.0", "opaque-debug 0.3.0", ] @@ -7520,13 +9872,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" dependencies = [ "block-buffer 0.9.0", - "cfg-if 0.1.10", - "cpuid-bool", + "cfg-if 1.0.0", + "cpuid-bool 0.1.2", "digest 0.9.0", "opaque-debug 0.3.0", ] @@ -7558,9 +9910,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.0.9" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" +checksum = "79c719719ee05df97490f80a45acfc99e5a30ce98a1e4fb67aee422745ae14e3" dependencies = [ "lazy_static", ] @@ -7571,21 +9923,36 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +[[package]] +name = "signal-hook" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "780f5e3fe0c66f67197236097d89de1e86216f1f6fdeaf47c442f854ab46c240" +dependencies = [ + "libc", + "signal-hook-registry", +] + [[package]] name = "signal-hook-registry" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" +checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" dependencies = [ - "arc-swap", "libc", ] [[package]] name = "signature" -version = "1.2.2" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0242b8e50dd9accdd56170e94ca1ebd223b098eb9c83539a6e367d0f36ae68" + +[[package]] +name = "siphasher" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" +checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7" [[package]] name = "slab" @@ -7595,9 +9962,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "slog" -version = "2.5.2" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cc9c640a4adbfbcc11ffb95efe5aa7af7309e002adab54b185507dbf2377b99" +checksum = "8347046d4ebd943127157b94d63abb990fcf729dc4e9978927fdf4ac3c998d06" dependencies = [ "erased-serde", ] @@ -7617,9 +9984,9 @@ dependencies = [ [[package]] name = "slog-scope" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c44c89dd8b0ae4537d1ae318353eaf7840b4869c536e31c41e963d1ea523ee6" +checksum = "2f95a4b4c3274cd2869549da82b57ccc930859bdbf5bcea0424bc5f140b3c786" dependencies = [ "arc-swap", "lazy_static", @@ -7639,18 +10006,18 @@ dependencies = [ [[package]] name = "smallvec" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ "maybe-uninit", ] [[package]] name = "smallvec" -version = "1.4.2" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "snow" @@ -7665,20 +10032,19 @@ dependencies = [ "rand_core 0.5.1", "ring", "rustc_version", - "sha2 0.9.1", - "subtle 2.3.0", + "sha2 0.9.3", + "subtle 2.4.0", "x25519-dalek 1.1.0", ] [[package]] name = "socket2" -version = "0.3.15" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "redox_syscall", "winapi 0.3.9", ] @@ -7691,44 +10057,83 @@ dependencies = [ "base64 0.12.3", "bytes 0.5.6", "flate2", - "futures 0.3.6", + "futures 0.3.12", "httparse", "log", "rand 0.7.3", - "sha-1 0.9.1", + "sha-1 0.9.3", ] [[package]] name = "sp-allocator" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "log", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-allocator" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", "log", - "sp-core", - "sp-std", - "sp-wasm-interface", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-api" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "hash-db", + "parity-scale-codec", + "sp-api-proc-macro 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-api" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "hash-db", "parity-scale-codec", - "sp-api-proc-macro", - "sp-core", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-version", + "sp-api-proc-macro 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-api-proc-macro" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "blake2-rfc", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-api-proc-macro" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7739,85 +10144,171 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "serde", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-application-crypto" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", "serde", - "sp-core", - "sp-io", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-arithmetic" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "serde", - "sp-debug-derive", - "sp-std", + "sp-debug-derive 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "sp-authority-discovery" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +name = "sp-arithmetic" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ + "integer-sqrt", + "num-traits", "parity-scale-codec", - "sp-api", - "sp-application-crypto", - "sp-runtime", - "sp-std", + "serde", + "sp-debug-derive 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] -name = "sp-authorship" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +name = "sp-authority-discovery" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ "parity-scale-codec", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "sp-block-builder" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +name = "sp-authority-discovery" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "parity-scale-codec", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "sp-authorship" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-authorship" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "parity-scale-codec", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "sp-block-builder" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-block-builder" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", - "sp-api", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-blockchain" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "log", + "lru 0.4.3", + "parity-scale-codec", + "parking_lot 0.10.2", + "sp-block-builder 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-database 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-blockchain" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", "log", "lru 0.4.3", "parity-scale-codec", "parking_lot 0.10.2", - "sp-block-builder", - "sp-consensus", - "sp-database", - "sp-runtime", - "sp-state-machine", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-database 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-chain-spec" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "sp-chain-spec" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "serde", "serde_json", @@ -7825,96 +10316,220 @@ dependencies = [ [[package]] name = "sp-consensus" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "futures 0.3.12", + "futures-timer 3.0.2", + "libp2p", + "log", + "parity-scale-codec", + "parking_lot 0.10.2", + "serde", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-trie 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-utils 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasm-timer", +] + +[[package]] +name = "sp-consensus" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", - "futures 0.3.6", + "futures 0.3.12", "futures-timer 3.0.2", "libp2p", "log", "parity-scale-codec", "parking_lot 0.10.2", "serde", - "sp-api", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-trie", - "sp-utils", - "sp-version", - "substrate-prometheus-endpoint", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-utils 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-prometheus-endpoint 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasm-timer", ] [[package]] name = "sp-consensus-aura" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-consensus-aura" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", - "sp-api", - "sp-application-crypto", - "sp-inherents", - "sp-runtime", - "sp-std", - "sp-timestamp", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-consensus-babe" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "merlin", + "parity-scale-codec", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus-slots 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus-vrf 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-consensus-babe" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "merlin", "parity-scale-codec", - "sp-api", - "sp-application-crypto", - "sp-consensus", - "sp-consensus-slots", - "sp-consensus-vrf", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-std", - "sp-timestamp", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-slots 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-vrf 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-consensus-slots" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-consensus-slots" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", - "sp-runtime", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-consensus-vrf" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "schnorrkel 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-consensus-vrf" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", "schnorrkel 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-core" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "base58", + "blake2-rfc", + "byteorder 1.4.2", + "derive_more", + "dyn-clonable", + "ed25519-dalek", + "futures 0.3.12", + "hash-db", + "hash256-std-hasher", + "hex", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "num-traits", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.10.2", + "primitive-types", + "rand 0.7.3", + "regex", + "schnorrkel 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "secrecy", + "serde", + "sha2 0.8.2", + "sp-debug-derive 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-externalities 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-storage 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-bip39", + "tiny-bip39", + "tiny-keccak", + "twox-hash", + "wasmi", + "zeroize", +] + +[[package]] +name = "sp-core" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "base58", "blake2-rfc", - "byteorder 1.3.4", + "byteorder 1.4.2", "derive_more", "dyn-clonable", "ed25519-dalek", - "futures 0.3.6", + "futures 0.3.12", "hash-db", "hash256-std-hasher", "hex", @@ -7934,11 +10549,11 @@ dependencies = [ "secrecy", "serde", "sha2 0.8.2", - "sp-debug-derive", - "sp-externalities", - "sp-runtime-interface", - "sp-std", - "sp-storage", + "sp-debug-derive 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-storage 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "substrate-bip39", "tiny-bip39", "tiny-keccak", @@ -7949,8 +10564,17 @@ dependencies = [ [[package]] name = "sp-database" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "kvdb", + "parking_lot 0.10.2", +] + +[[package]] +name = "sp-database" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7958,8 +10582,18 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-debug-derive" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "proc-macro2", "quote", @@ -7968,103 +10602,209 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ "environmental", "parity-scale-codec", - "sp-std", - "sp-storage", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-storage 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-externalities" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-storage 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-finality-grandpa" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "finality-grandpa", + "log", + "parity-scale-codec", + "serde", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-finality-grandpa" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "finality-grandpa", "log", "parity-scale-codec", "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-runtime", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-finality-tracker" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-finality-tracker" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", - "sp-inherents", - "sp-std", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-inherents" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "parity-scale-codec", + "parking_lot 0.10.2", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-inherents" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", "parity-scale-codec", "parking_lot 0.10.2", - "sp-core", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-io" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "futures 0.3.12", + "hash-db", + "libsecp256k1", + "log", + "parity-scale-codec", + "parking_lot 0.10.2", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-externalities 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-tracing 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-trie 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-io" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "hash-db", "libsecp256k1", "log", "parity-scale-codec", "parking_lot 0.10.2", - "sp-core", - "sp-externalities", - "sp-runtime-interface", - "sp-state-machine", - "sp-std", - "sp-tracing", - "sp-trie", - "sp-wasm-interface", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-tracing 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "tracing", "tracing-core", ] [[package]] name = "sp-keyring" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "lazy_static", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "strum", +] + +[[package]] +name = "sp-keyring" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "lazy_static", - "sp-core", - "sp-runtime", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "strum", ] [[package]] name = "sp-npos-elections" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "serde", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-npos-elections-compact 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-npos-elections" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", "serde", - "sp-arithmetic", - "sp-npos-elections-compact", - "sp-std", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-npos-elections-compact 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-npos-elections-compact" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-npos-elections-compact" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -8074,18 +10814,37 @@ dependencies = [ [[package]] name = "sp-offchain" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-offchain" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "sp-api", - "sp-core", - "sp-runtime", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-panic-handler" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "backtrace", + "log", +] + +[[package]] +name = "sp-panic-handler" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "backtrace", "log", @@ -8093,17 +10852,48 @@ dependencies = [ [[package]] name = "sp-rpc" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "serde", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-rpc" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "serde", - "sp-core", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-runtime" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "parity-util-mem", + "paste", + "rand 0.7.3", + "serde", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-arithmetic 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-runtime" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "either", "hash256-std-hasher", @@ -8114,34 +10904,62 @@ dependencies = [ "paste", "rand 0.7.3", "serde", - "sp-application-crypto", - "sp-arithmetic", - "sp-core", - "sp-inherents", - "sp-io", - "sp-std", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-arithmetic 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-runtime-interface" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "primitive-types", + "sp-externalities 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime-interface-proc-macro 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-storage 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-tracing 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", "primitive-types", - "sp-externalities", - "sp-runtime-interface-proc-macro", - "sp-std", - "sp-storage", - "sp-tracing", - "sp-wasm-interface", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface-proc-macro 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-storage 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-tracing 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "Inflector", "proc-macro-crate", @@ -8152,21 +10970,43 @@ dependencies = [ [[package]] name = "sp-sandbox" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasmi", +] + +[[package]] +name = "sp-sandbox" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", - "sp-core", - "sp-io", - "sp-std", - "sp-wasm-interface", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-wasm-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasmi", ] [[package]] name = "sp-serializer" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "sp-serializer" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "serde", "serde_json", @@ -8174,31 +11014,75 @@ dependencies = [ [[package]] name = "sp-session" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-staking 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-session" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", - "sp-api", - "sp-core", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-staking 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-staking" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "parity-scale-codec", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-staking" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "parity-scale-codec", - "sp-runtime", - "sp-std", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-state-machine" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "hash-db", + "log", + "num-traits", + "parity-scale-codec", + "parking_lot 0.10.2", + "rand 0.7.3", + "smallvec 1.6.1", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-externalities 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-panic-handler 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-trie 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-state-machine" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "hash-db", "log", @@ -8206,56 +11090,101 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.10.2", "rand 0.7.3", - "smallvec 1.4.2", - "sp-core", - "sp-externalities", - "sp-panic-handler", - "sp-std", - "sp-trie", + "smallvec 1.6.1", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-panic-handler 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "trie-db", "trie-root", ] [[package]] -name = "sp-std" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +name = "sp-std" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" + +[[package]] +name = "sp-std" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" + +[[package]] +name = "sp-storage" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] [[package]] name = "sp-storage" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive", - "sp-std", + "sp-debug-derive 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-timestamp" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasm-timer", +] + +[[package]] +name = "sp-timestamp" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", - "sp-api", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasm-timer", ] [[package]] name = "sp-tracing" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "log", + "parity-scale-codec", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-tracing" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "log", "parity-scale-codec", - "sp-std", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "tracing", "tracing-core", "tracing-subscriber", @@ -8263,39 +11192,80 @@ dependencies = [ [[package]] name = "sp-transaction-pool" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "derive_more", + "futures 0.3.12", + "log", + "parity-scale-codec", + "serde", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-transaction-pool" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "derive_more", - "futures 0.3.6", + "futures 0.3.12", "log", "parity-scale-codec", "serde", - "sp-api", - "sp-blockchain", - "sp-runtime", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-trie" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "hash-db", + "memory-db", + "parity-scale-codec", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-trie" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "hash-db", "memory-db", "parity-scale-codec", - "sp-core", - "sp-std", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "trie-db", "trie-root", ] [[package]] name = "sp-utils" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", + "futures-core", + "futures-timer 3.0.2", + "lazy_static", + "prometheus", +] + +[[package]] +name = "sp-utils" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "futures 0.3.12", "futures-core", "futures-timer 3.0.2", "lazy_static", @@ -8304,24 +11274,47 @@ dependencies = [ [[package]] name = "sp-version" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "serde", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "sp-version" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "impl-serde", "parity-scale-codec", "serde", - "sp-runtime", - "sp-std", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "sp-wasm-interface" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "wasmi", +] + +[[package]] +name = "sp-wasm-interface" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", - "sp-std", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "wasmi", ] @@ -8371,6 +11364,31 @@ dependencies = [ "bytes 0.4.12", ] +[[package]] +name = "string_cache" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ddb1139b5353f96e429e1a5e19fbaf663bddedaa06d1dbd49f82e352601209a" +dependencies = [ + "lazy_static", + "new_debug_unreachable", + "phf_shared", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", +] + [[package]] name = "strsim" version = "0.8.0" @@ -8379,9 +11397,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126d630294ec449fae0b16f964e35bf3c74f940da9dca17ee9b905f7b3112eb8" +checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c" dependencies = [ "clap", "lazy_static", @@ -8390,9 +11408,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e51c492f9e23a220534971ff5afc14037289de430e3c83f9daf6a1b6ae91e8" +checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90" dependencies = [ "heck", "proc-macro-error", @@ -8437,144 +11455,247 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "frame-system-rpc-runtime-api", - "futures 0.3.6", + "frame-system-rpc-runtime-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "futures 0.3.12", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "log", "parity-scale-codec", - "sc-client-api", - "sc-rpc-api", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-rpc-api 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-core", - "sp-runtime", - "sp-transaction-pool", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", ] [[package]] name = "substrate-prometheus-endpoint" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "async-std", + "derive_more", + "futures-util", + "hyper 0.13.10", + "log", + "prometheus", + "tokio 0.2.25", +] + +[[package]] +name = "substrate-prometheus-endpoint" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "async-std", "derive_more", "futures-util", - "hyper 0.13.8", + "hyper 0.13.10", "log", "prometheus", - "tokio 0.2.22", + "tokio 0.2.25", ] [[package]] name = "substrate-test-client" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "futures 0.1.30", + "futures 0.3.12", + "hash-db", + "hex", + "parity-scale-codec", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-client-db 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-executor 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-light 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-service 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "serde", + "serde_json", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-keyring 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", +] + +[[package]] +name = "substrate-test-client" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "futures 0.1.30", - "futures 0.3.6", + "futures 0.3.12", "hash-db", "hex", "parity-scale-codec", - "sc-client-api", - "sc-client-db", - "sc-consensus", - "sc-executor", - "sc-light", - "sc-service", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-client-db 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-executor 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-light 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-service 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "serde", "serde_json", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-keyring", - "sp-runtime", - "sp-state-machine", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-keyring 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "substrate-test-runtime" +version = "2.0.0" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" +dependencies = [ + "cfg-if 0.1.10", + "frame-executive 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-support 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "frame-system-rpc-runtime-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "log", + "memory-db", + "pallet-babe 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "pallet-timestamp 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "parity-scale-codec", + "parity-util-mem", + "sc-service 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "serde", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-application-crypto 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-block-builder 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus-aura 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-externalities 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-finality-grandpa 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-inherents 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-io 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-keyring 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-offchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-session 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-state-machine 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-std 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-trie 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-version 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-wasm-builder-runner 1.0.6 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "trie-db", ] [[package]] name = "substrate-test-runtime" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "cfg-if 0.1.10", - "frame-executive", - "frame-support", - "frame-system", - "frame-system-rpc-runtime-api", + "frame-executive 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-support 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "frame-system-rpc-runtime-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "log", "memory-db", - "pallet-babe", - "pallet-timestamp", + "pallet-babe 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "pallet-timestamp 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "parity-scale-codec", "parity-util-mem", - "sc-service", - "serde", - "sp-api", - "sp-application-crypto", - "sp-block-builder", - "sp-consensus-aura", - "sp-consensus-babe", - "sp-core", - "sp-externalities", - "sp-finality-grandpa", - "sp-inherents", - "sp-io", - "sp-keyring", - "sp-offchain", - "sp-runtime", - "sp-runtime-interface", - "sp-session", - "sp-state-machine", - "sp-std", - "sp-transaction-pool", - "sp-trie", - "sp-version", - "substrate-wasm-builder-runner", + "sc-service 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "serde", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-application-crypto 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-block-builder 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-aura 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus-babe 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-externalities 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-finality-grandpa 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-inherents 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-io 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-keyring 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-offchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime-interface 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-session 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-state-machine 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-std 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-transaction-pool 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-trie 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-version 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-wasm-builder-runner 1.0.6 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", "trie-db", ] [[package]] name = "substrate-test-runtime-client" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "parity-scale-codec", - "sc-block-builder", - "sc-client-api", - "sc-consensus", - "sc-light", - "sc-service", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-runtime", - "substrate-test-client", - "substrate-test-runtime", + "sc-block-builder 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-client-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-light 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sc-service 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-api 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-blockchain 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-consensus 0.8.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-core 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "sp-runtime 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-test-client 2.0.1 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", + "substrate-test-runtime 2.0.0 (git+https://github.com/paritytech/substrate?tag=v2.0.1)", ] [[package]] -name = "substrate-test-utils" +name = "substrate-test-runtime-client" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" +dependencies = [ + "futures 0.3.12", + "parity-scale-codec", + "sc-block-builder 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-client-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-light 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sc-service 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-api 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-blockchain 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-consensus 0.8.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-core 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "sp-runtime 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-test-client 2.0.1 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", + "substrate-test-runtime 2.0.0 (git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1)", +] + +[[package]] +name = "substrate-test-utils" +version = "2.0.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "substrate-test-utils-derive", - "tokio 0.2.22", + "tokio 0.2.25", ] [[package]] name = "substrate-test-utils-derive" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +version = "0.8.1" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" dependencies = [ "proc-macro-crate", "quote", @@ -8582,24 +11703,14 @@ dependencies = [ ] [[package]] -name = "substrate-wasm-builder" -version = "1.0.11" -dependencies = [ - "atty", - "build-helper", - "cargo_metadata", - "fs2", - "itertools 0.8.2", - "tempfile", - "toml", - "walkdir", - "wasm-gc-api", -] +name = "substrate-wasm-builder-runner" +version = "1.0.6" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.1#2cd20966cc09b059817c3ebe12fc130cdd850d62" [[package]] name = "substrate-wasm-builder-runner" version = "1.0.6" -source = "git+https://github.com/paritytech/substrate?tag=v2.0.0#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +source = "git+https://github.com/PolymathNetwork/substrate?tag=v2.0.1-1#cf4f97d1c02e3ba1c3585d09065980c2933ef3f1" [[package]] name = "subtle" @@ -8609,15 +11720,15 @@ checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" [[package]] name = "subtle" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" +checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" -version = "1.0.45" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9c5432ff16d6152371f808fb5a871cd67368171b09bb21b43df8e4a47a3556" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" dependencies = [ "proc-macro2", "quote", @@ -8650,23 +11761,34 @@ checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" [[package]] name = "tempfile" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "rand 0.7.3", - "redox_syscall", + "rand 0.8.3", + "redox_syscall 0.2.4", "remove_dir_all", "winapi 0.3.9", ] +[[package]] +name = "tendril" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9ef557cb397a4f0a5a3a628f06515f78563f2209e64d47055d9dc6052bf5e33" +dependencies = [ + "futf", + "mac", + "utf-8", +] + [[package]] name = "termcolor" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" dependencies = [ "winapi-util", ] @@ -8680,20 +11802,26 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thin-slice" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" + [[package]] name = "thiserror" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42" +checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab" +checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" dependencies = [ "proc-macro2", "quote", @@ -8702,11 +11830,11 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.0.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" dependencies = [ - "lazy_static", + "once_cell 1.5.2", ] [[package]] @@ -8737,7 +11865,7 @@ checksum = "b0165e045cc2ae1660270ca65e1676dbaab60feb0f91b10f7d0665e9b47e31f2" dependencies = [ "failure", "hmac", - "once_cell 1.4.1", + "once_cell 1.5.2", "pbkdf2", "rand 0.7.3", "rustc-hash", @@ -8756,9 +11884,9 @@ dependencies = [ [[package]] name = "tinytemplate" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d3dc76004a03cec1c5932bca4cdc2e39aaa798e3f82363dd94f9adf6098c12f" +checksum = "a2ada8616fad06a2d0c455adc530de4ef57605a8120cc65da9653e0e9623ca74" dependencies = [ "serde", "serde_json", @@ -8766,9 +11894,18 @@ dependencies = [ [[package]] name = "tinyvec" -version = "0.3.4" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" +checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" @@ -8796,9 +11933,9 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.22" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" +checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" dependencies = [ "bytes 0.5.6", "fnv", @@ -8810,7 +11947,7 @@ dependencies = [ "mio", "mio-uds", "num_cpus", - "pin-project-lite", + "pin-project-lite 0.1.11", "signal-hook-registry", "slab", "tokio-macros", @@ -8855,7 +11992,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.7.2", "futures 0.1.30", ] @@ -8894,9 +12031,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" dependencies = [ "proc-macro2", "quote", @@ -8922,7 +12059,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.7.2", "futures 0.1.30", "lazy_static", "log", @@ -8943,7 +12080,7 @@ checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a" dependencies = [ "futures-core", "rustls", - "tokio 0.2.22", + "tokio 0.2.25", "webpki", ] @@ -8997,9 +12134,9 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" dependencies = [ - "crossbeam-deque", + "crossbeam-deque 0.7.3", "crossbeam-queue", - "crossbeam-utils", + "crossbeam-utils 0.7.2", "futures 0.1.30", "lazy_static", "log", @@ -9014,7 +12151,7 @@ version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.7.2", "futures 0.1.30", "slab", "tokio-executor 0.1.10", @@ -9063,43 +12200,43 @@ dependencies = [ "futures-core", "futures-sink", "log", - "pin-project-lite", - "tokio 0.2.22", + "pin-project-lite 0.1.11", + "tokio 0.2.25", ] [[package]] name = "toml" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" dependencies = [ "serde", ] [[package]] name = "tower-service" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27" +checksum = "f7d40a22fd029e33300d8d89a5cc8ffce18bb7c587662f54629e94c9de5487f3" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "log", - "pin-project-lite", + "pin-project-lite 0.2.4", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada" +checksum = "43f080ea7e4107844ef4766459426fa2d5c1ada2e47edba05dc7fa99d9629f47" dependencies = [ "proc-macro2", "quote", @@ -9115,6 +12252,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "tracing-futures" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" +dependencies = [ + "pin-project 0.4.27", + "tracing", +] + [[package]] name = "tracing-log" version = "0.1.1" @@ -9138,9 +12285,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ef0a5e15477aa303afbfac3a44cba9b6430fdaad52423b1e6c0dbbe28c3eedd" +checksum = "a1fa8f0c8f4c594e4fc9debc1990deab13238077271ba84dd853d54902ee3401" dependencies = [ "ansi_term 0.12.1", "chrono", @@ -9150,7 +12297,7 @@ dependencies = [ "serde", "serde_json", "sharded-slab", - "smallvec 1.4.2", + "smallvec 1.6.1", "thread_local", "tracing", "tracing-core", @@ -9160,15 +12307,15 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.22.1" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e55f7ace33d6237e14137e386f4e1672e2a5c6bbc97fef9f438581a143971f0" +checksum = "ec051edf7f0fc9499a2cb0947652cab2148b9d7f61cee7605e312e9f970dacaf" dependencies = [ "hash-db", - "hashbrown 0.8.2", + "hashbrown 0.9.1", "log", "rustc-hex", - "smallvec 1.4.2", + "smallvec 1.6.1", ] [[package]] @@ -9229,7 +12376,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" dependencies = [ - "byteorder 1.3.4", + "byteorder 1.4.2", "crunchy", "rustc-hex", "static_assertions", @@ -9255,18 +12402,18 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.13" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" +checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" [[package]] name = "unicode-width" @@ -9287,7 +12434,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" dependencies = [ "generic-array 0.14.4", - "subtle 2.3.0", + "subtle 2.4.0", ] [[package]] @@ -9331,20 +12478,36 @@ dependencies = [ [[package]] name = "url" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" dependencies = [ - "idna 0.2.0", + "form_urlencoded", + "idna 0.2.1", "matches", "percent-encoding 2.1.0", ] +[[package]] +name = "utf-8" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" + +[[package]] +name = "value-bag" +version = "1.0.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b676010e055c99033117c2343b33a40a30b91fecd6c49055ac9cd2d6c305ab1" +dependencies = [ + "ctor", +] + [[package]] name = "vcpkg" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" +checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" [[package]] name = "vec-arena" @@ -9455,19 +12618,19 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.68" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" +checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.68" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" +checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" dependencies = [ "bumpalo", "lazy_static", @@ -9480,11 +12643,11 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.18" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" +checksum = "3de431a2910c86679c34283a33f66f4e4abd7e0aec27b6669060148872aadf94" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -9492,9 +12655,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.68" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" +checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -9502,9 +12665,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.68" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" +checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" dependencies = [ "proc-macro2", "quote", @@ -9515,20 +12678,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" - -[[package]] -name = "wasm-gc-api" -version = "0.1.11" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c32691b6c7e6c14e7f8fd55361a9088b507aa49620fcd06c09b3a1082186b9" -dependencies = [ - "log", - "parity-wasm 0.32.0", - "rustc-demangle", -] +checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" [[package]] name = "wasm-timer" @@ -9536,9 +12688,9 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "js-sys", - "parking_lot 0.11.0", + "parking_lot 0.11.1", "pin-utils", "wasm-bindgen", "wasm-bindgen-futures", @@ -9556,7 +12708,7 @@ dependencies = [ "memory_units", "num-rational", "num-traits", - "parity-wasm 0.41.0", + "parity-wasm", "wasmi-validation", ] @@ -9566,7 +12718,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93" dependencies = [ - "parity-wasm 0.41.0", + "parity-wasm", ] [[package]] @@ -9595,7 +12747,7 @@ dependencies = [ "log", "region", "rustc-demangle", - "smallvec 1.4.2", + "smallvec 1.6.1", "target-lexicon", "wasmparser 0.59.0", "wasmtime-environ", @@ -9728,7 +12880,7 @@ dependencies = [ "lazy_static", "libc", "log", - "memoffset", + "memoffset 0.5.6", "more-asserts", "region", "thiserror", @@ -9738,27 +12890,27 @@ dependencies = [ [[package]] name = "wast" -version = "26.0.0" +version = "33.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54b3678343bfdf1768c16308a4b53823b70f7bb148d3d38225123d4306ec731" +checksum = "1d04fe175c7f78214971293e7d8875673804e736092206a3a4544dbc12811c1b" dependencies = [ "leb128", ] [[package]] name = "wat" -version = "1.0.27" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b2dccbce4d0e14875091846e110a2369267b18ddd0d6423479b88dad914d71" +checksum = "7ec9c6ee01ae07a26adadcdfed22c7a97e0b8cbee9c06e0e96076ece5aeb5cfe" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.45" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" +checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" dependencies = [ "js-sys", "wasm-bindgen", @@ -9766,9 +12918,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.21.3" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab146130f5f790d45f82aeeb09e55a256573373ec64409fc19a6fb82fb1032ae" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" dependencies = [ "ring", "untrusted", @@ -9794,9 +12946,9 @@ dependencies = [ [[package]] name = "wepoll-sys" -version = "3.0.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142bc2cba3fe88be1a8fcb55c727fa4cd5b0cf2d7438722792e22f26f04bc1e0" +checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff" dependencies = [ "cc", ] @@ -9869,7 +13021,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "637ff90c9540fa3073bb577e65033069e4bae7c79d49d74aa3ffdf5342a53217" dependencies = [ - "curve25519-dalek 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 2.1.2", "rand_core 0.5.1", "zeroize", ] @@ -9880,7 +13032,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc614d95359fd7afc321b66d2107ede58b246b844cf5d8a0adcca413e439f088" dependencies = [ - "curve25519-dalek 3.0.0", + "curve25519-dalek 3.0.2", "rand_core 0.5.1", "zeroize", ] @@ -9891,19 +13043,19 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aeb8c4043cac71c3c299dff107171c220d179492350ea198e109a414981b83c" dependencies = [ - "futures 0.3.6", + "futures 0.3.12", "log", "nohash-hasher", - "parking_lot 0.11.0", + "parking_lot 0.11.1", "rand 0.7.3", "static_assertions", ] [[package]] name = "zeroize" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f33972566adbd2d3588b0491eb94b98b43695c4ef897903470ede4f3f5a28a" +checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36" dependencies = [ "zeroize_derive", ] @@ -9922,18 +13074,18 @@ dependencies = [ [[package]] name = "zstd" -version = "0.5.3+zstd.1.4.5" +version = "0.5.4+zstd.1.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b32eaf771efa709e8308605bbf9319bf485dc1503179ec0469b611937c0cd8" +checksum = "69996ebdb1ba8b1517f61387a883857818a66c8a295f487b1ffd8fd9d2c82910" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "2.0.5+zstd.1.4.5" +version = "2.0.6+zstd.1.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfb642e0d27f64729a639c52db457e0ae906e7bc6f5fe8f5c453230400f1055" +checksum = "98aa931fb69ecee256d44589d19754e61851ae4769bf963b385119b1cc37a49e" dependencies = [ "libc", "zstd-sys", @@ -9941,9 +13093,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "1.4.17+zstd.1.4.5" +version = "1.4.18+zstd.1.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b89249644df056b522696b1bb9e7c18c87e8ffa3e2f0dc3b0155875d6498f01b" +checksum = "a1e6e8778706838f43f771d80d37787cb2fe06dafe89dd3aebaf6721b9eaec81" dependencies = [ "cc", "glob 0.3.0", diff --git a/Cargo.toml b/Cargo.toml index 0094751b80..e0197b48a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polymesh" -version = "2.4.0" +version = "2.5.0" authors = ["Anonymous"] build = "build.rs" edition = "2018" @@ -12,7 +12,10 @@ path = "src/main.rs" [workspace] members = [ "bin/bench", + "bin/crypto-cli", "bin/testing", + "migration-tests", + "migration-tests/remote-externalities", "node-rpc", "pallets/asset", "pallets/balances", @@ -33,6 +36,7 @@ members = [ "pallets/protocol-fee/rpc", "pallets/protocol-fee/rpc/runtime-api", "pallets/runtime/common", + "pallets/runtime/extensions", "pallets/runtime/develop", "pallets/runtime/testnet", "pallets/runtime/tests", @@ -49,10 +53,9 @@ members = [ "node-rpc", "pallets/weights", "primitives", - "primitives_derive", "rpc", "rpc/runtime-api", - "utils/wasm-builder" + "utils/permissions", ] [dependencies] @@ -65,21 +68,21 @@ pallet-corporate-actions = { path = "pallets/corporate-actions", default-feature pallet-group = { path = "pallets/group", default-features = false } pallet-protocol-fee = { path = "pallets/protocol-fee", default-features = false } pallet-staking = { path = "pallets/staking", default-features = false } -polymesh-common-utilities = { path = "pallets/common" } -polymesh-primitives = { path = "primitives" } -polymesh-runtime-common = { path = "pallets/runtime/common" } +polymesh-common-utilities = { path = "pallets/common", default-features = false } +polymesh-primitives = { path = "primitives", default-features = false } +polymesh-runtime-common = { path = "pallets/runtime/common", default-features = false } # RPC node-rpc = { path = "rpc" } node-rpc-runtime-api = { path = "rpc/runtime-api" } pallet-protocol-fee-rpc-runtime-api = { path = "pallets/protocol-fee/rpc/runtime-api" } -pallet-contracts-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +pallet-contracts-rpc-runtime-api = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } pallet-staking-rpc-runtime-api = { path = "pallets/staking/rpc/runtime-api" } pallet-protocol-fee-rpc = { path = "pallets/protocol-fee/rpc" } pallet-group-rpc = { path = "pallets/group/rpc" } pallet-group-rpc-runtime-api = { path = "pallets/group/rpc/runtime-api" } polymesh-node-rpc = { path = "node-rpc" } -frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +frame-system-rpc-runtime-api = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } # Runtimes polymesh-runtime-develop = { path = "pallets/runtime/develop" } @@ -96,46 +99,46 @@ chrono = "0.4.11" # Substrate codec = { version = "1.2.0", package = "parity-scale-codec" } -sp-core = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-offchain = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-session = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-consensus = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -grandpa-primitives = { package = "sp-finality-grandpa", git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-inherents = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-transaction-pool = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-consensus-babe = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-authority-discovery = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-offchain = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-block-builder = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-blockchain = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-session = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-consensus = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +grandpa-primitives = { package = "sp-finality-grandpa", git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-inherents = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-transaction-pool = { package = "sp-transaction-pool", git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-consensus-babe = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } -contracts = { package = "pallet-contracts", git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +contracts = { package = "pallet-contracts", git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } -sc-service = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", features = ["wasmtime"] } -sc-chain-spec = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-client-api = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-executor = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", features = ["wasmtime"] } -sc-network = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-cli = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", features = ["wasmtime"] } -sc-telemetry = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-consensus-babe = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-consensus = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-rpc = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-transaction-pool = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-basic-authorship = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-authority-discovery = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sc-service = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", features = ["wasmtime"] } +sc-chain-spec = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-client-api = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-executor = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", features = ["wasmtime"] } +sc-network = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-cli = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", features = ["wasmtime"] } +sc-telemetry = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-consensus-babe = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-consensus = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-rpc = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-transaction-pool = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +grandpa = { package = "sc-finality-grandpa", git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-basic-authorship = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } -sc-light = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-client-db = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sc-light = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-client-db = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } -prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } # These dependencies are used for runtime benchmarking -frame-benchmarking = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +frame-benchmarking-cli = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } # Other serde = { version = "1.0.104", default-features = false } @@ -145,6 +148,9 @@ vergen = "3.1.0" [features] default = ["std"] +running-ci = [ + "polymesh-runtime-develop/running-ci" +] default_identity = [ "polymesh-common-utilities/default_identity" ] diff --git a/bin/bench/Cargo.toml b/bin/bench/Cargo.toml index cfa216a19d..852b7d9012 100644 --- a/bin/bench/Cargo.toml +++ b/bin/bench/Cargo.toml @@ -13,10 +13,10 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" node-primitives = { package = "polymesh-primitives", path = "../../primitives" } node-runtime = { package = "polymesh-runtime-testnet", path = "../../pallets/runtime/testnet" } node-testing = { path = "../testing" } -sc-cli = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", features = ["wasmtime"] } -sc-client-api = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-state-machine = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sc-cli = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", features = ["wasmtime"] } +sc-client-api = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-state-machine = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" @@ -24,15 +24,15 @@ structopt = "0.3" derive_more = "0.99.2" kvdb = "0.7" kvdb-rocksdb = "0.9" -sp-trie = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-core = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-consensus = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-transaction-pool = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-basic-authorship = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-inherents = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-finality-tracker = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-timestamp = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-tracing = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sp-trie = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-consensus = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-transaction-pool = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-basic-authorship = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-inherents = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-finality-tracker = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-timestamp = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-tracing = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } hash-db = "0.15.2" tempfile = "3.1.0" fs_extra = "1" @@ -41,5 +41,5 @@ rand = { version = "0.7.2", features = ["small_rng"] } lazy_static = "1.4.0" parity-util-mem = { version = "0.7.0", default-features = false, features = ["primitive-types"] } parity-db = { version = "0.1.2" } -sc-transaction-pool = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sc-transaction-pool = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } futures = { version = "0.3.4", features = ["thread-pool"] } diff --git a/bin/crypto-cli/Cargo.toml b/bin/crypto-cli/Cargo.toml new file mode 100644 index 0000000000..f0f85413d3 --- /dev/null +++ b/bin/crypto-cli/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "crypto-cli" +version = "1.0.0" +authors = ["Polymath"] +description = "Test utilities for Substrate node." +edition = "2018" + +[dependencies] +polymesh-primitives = { path = "../../primitives" } +confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", tag = "v2.2.2" } +codec = { version = "1.2.0", package = "parity-scale-codec" } +hex = "0.4.0" diff --git a/bin/crypto-cli/README.md b/bin/crypto-cli/README.md new file mode 100644 index 0000000000..fc8578e7cc --- /dev/null +++ b/bin/crypto-cli/README.md @@ -0,0 +1,6 @@ +# Helper CLI for crypto library + +## Usage + +1. Modify the `main.rs` file to include your ticker and did. +2. `cargo run --package crypto-cli --bin crypto-cli`. diff --git a/bin/crypto-cli/src/main.rs b/bin/crypto-cli/src/main.rs new file mode 100644 index 0000000000..c2ef2db638 --- /dev/null +++ b/bin/crypto-cli/src/main.rs @@ -0,0 +1,25 @@ +use codec::Encode; +use confidential_identity::{compute_cdd_id, compute_scope_id, mocked}; +use polymesh_primitives::{IdentityId, InvestorUid, InvestorZKProofData, Ticker}; +use std::convert::TryFrom; + +fn main() { + let user_dids = vec![ + b"did:poly:0600000000000000000000000000000000000000000000000000000000000000", + b"did:poly:8b2270afc77017630caf8463e283470c597231504a9c4707d08e517ad7ff1b67", + ]; + let ticker_name = b"A"; + let ticker = Ticker::try_from(&ticker_name[..]).unwrap(); + for user_did in user_dids { + let did = IdentityId::try_from(&user_did[..]).unwrap(); + let uid = InvestorUid::from(mocked::make_investor_uid(did.as_bytes())); + let proof = InvestorZKProofData::new(&did, &uid, &ticker); + let cdd_claim = InvestorZKProofData::make_cdd_claim(&did, &uid); + let cdd_id = compute_cdd_id(&cdd_claim).compress().to_bytes(); + let scope_claim = InvestorZKProofData::make_scope_claim(&ticker.as_slice(), &uid); + let scope_id = compute_scope_id(&scope_claim).compress().to_bytes(); + println!("ScopeId: 0x{}", hex::encode(scope_id)); + println!("CddId: 0x{}", hex::encode(cdd_id)); + println!("Proof: 0x{}", hex::encode(proof.encode())); + } +} diff --git a/bin/executor/Cargo.toml b/bin/executor/Cargo.toml index 33bb934515..49e98422e2 100644 --- a/bin/executor/Cargo.toml +++ b/bin/executor/Cargo.toml @@ -6,7 +6,7 @@ description = "Substrate node implementation in Rust." edition = "2018" license = "Apache-2.0" homepage = "https://substrate.dev" -repository = "https://github.com/paritytech/substrate/" +repository = "https://github.com/PolymathNetwork/substrate/" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] @@ -15,13 +15,13 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "1.3.4" } node-primitives = { package = "polymesh-primitives", path = "../../primitives" } node-runtime = { package = "polymesh-runtime-testnet", path = "../../pallets/runtime/testnet" } -sc-executor = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", features = ["wasmtime"] } -sp-core = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-state-machine = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-trie = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sc-executor = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", features = ["wasmtime"] } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-state-machine = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-trie = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } trie-root = "0.16.0" -frame-benchmarking = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } pallet-confidential = { path = "../../pallets/confidential" } [dev-dependencies] @@ -31,18 +31,18 @@ pallet-balances = { path = "../../pallets/balances" } pallet-im-online = { path = "../../pallets/im-online" } criterion = "0.3.0" -frame-support = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-contracts = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-grandpa = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-indices = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-session = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-treasury = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-externalities = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -substrate-test-client = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-grandpa = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-indices = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-treasury = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-application-crypto = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-externalities = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +substrate-test-client = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } wabt = "0.10.0" [features] diff --git a/bin/testing/Cargo.toml b/bin/testing/Cargo.toml index d86c6ad443..132a0ada95 100644 --- a/bin/testing/Cargo.toml +++ b/bin/testing/Cargo.toml @@ -7,7 +7,7 @@ description = "Test utilities for Substrate node." edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" homepage = "https://substrate.dev" -repository = "https://github.com/paritytech/substrate/" +repository = "https://github.com/PolymathNetwork/substrate/" publish = true [package.metadata.docs.rs] @@ -23,33 +23,33 @@ pallet-staking = { path = "../../pallets/staking" } pallet-balances = { path = "../../pallets/balances" } node-executor = { path = "../executor", features = ["wasmtime"] } -sc-service = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", features = ["test-helpers", "db", "wasmtime"] } -sc-client-db = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", features = ["kvdb-rocksdb", "parity-db"] } -sc-client-api = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sc-service = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", features = ["test-helpers", "db", "wasmtime"] } +sc-client-db = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", features = ["kvdb-rocksdb", "parity-db"] } +sc-client-api = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } codec = { package = "parity-scale-codec", version = "1.3.4" } -pallet-contracts = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-grandpa = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-indices = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-keyring = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-core = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-session = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-executor = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", features = ["wasmtime"] } -sp-consensus = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -substrate-test-client = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -pallet-treasury = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-grandpa = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-indices = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-keyring = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-executor = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", features = ["wasmtime"] } +sp-consensus = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +substrate-test-client = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +pallet-treasury = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } wabt = "0.10.0" -sp-api = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-finality-tracker = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-block-builder = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-inherents = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-finality-tracker = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-block-builder = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-block-builder = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-inherents = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-blockchain = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } log = "0.4.8" tempfile = "3.1.0" fs_extra = "1" @@ -57,4 +57,4 @@ futures = "0.3.1" [dev-dependencies] criterion = "0.3.0" -sc-cli = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", features = ["wasmtime"] } +sc-cli = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", features = ["wasmtime"] } diff --git a/bin/testing/src/genesis.rs b/bin/testing/src/genesis.rs index db81307ce0..0c5a9804f9 100644 --- a/bin/testing/src/genesis.rs +++ b/bin/testing/src/genesis.rs @@ -19,13 +19,16 @@ //! Genesis Configuration. use crate::keyring::*; -use node_primitives::{AccountId, IdentifyAccount, IdentityId, InvestorUid, Signature}; +use node_primitives::{AccountId, IdentityId, InvestorUid, Signature}; use node_runtime::{config::*, StakerStatus}; use polymesh_common_utilities::constants::currency::*; use sp_core::ChangesTrieConfiguration; use sp_core::{sr25519, Pair, Public}; use sp_keyring::{Ed25519Keyring, Sr25519Keyring}; -use sp_runtime::{traits::Verify, Perbill}; +use sp_runtime::{ + traits::{IdentifyAccount, Verify}, + Perbill, +}; /// Create genesis runtime configuration for tests. pub fn config(support_changes_trie: bool) -> GenesisConfig { config_endowed(support_changes_trie, Default::default()) @@ -191,5 +194,6 @@ pub fn config_endowed(support_changes_trie: bool, extra_endowed: Vec) settlement: Some(Default::default()), checkpoint: Some(Default::default()), multisig: Some(Default::default()), + pallet_corporate_actions: Some(Default::default()), } } diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..1eef63122f --- /dev/null +++ b/codecov.yml @@ -0,0 +1,32 @@ +codecov: + require_ci_to_pass: no + +coverage: + precision: 2 + round: down + range: "50...100" + + status: + project: + default: + target: auto + threshold: 5% # allow for 5% reduction of coverage without failing + + patch: false + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: yes + macro: yes + +comment: + layout: "diff,files" + behavior: default + require_changes: no + +ignore: + - "bin/**/*" + - "**/build.rs" diff --git a/contracts/examples/RuntimeInteraction/Cargo.toml b/contracts/examples/RuntimeInteraction/Cargo.toml index 50fa1fd5e7..e6d8283082 100755 --- a/contracts/examples/RuntimeInteraction/Cargo.toml +++ b/contracts/examples/RuntimeInteraction/Cargo.toml @@ -10,7 +10,6 @@ ink_primitives = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", pa ink_core = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_core", default-features = false } ink_lang = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_lang", default-features = false } ink_prelude = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_prelude", default-features = false } -polymesh-derive = { path = "../../../primitives_derive", default-features = false, package = "polymesh-primitives-derive"} scale = { package = "parity-scale-codec", version = "1.2", default-features = false, features = ["derive"] } serde = { version = "1.0.104", optional = true, features = ["derive"] } diff --git a/contracts/examples/custom-ink-env-types/Cargo.toml b/contracts/examples/custom-ink-env-types/Cargo.toml index 0c88dd973b..cfd28af2ff 100644 --- a/contracts/examples/custom-ink-env-types/Cargo.toml +++ b/contracts/examples/custom-ink-env-types/Cargo.toml @@ -7,13 +7,12 @@ edition = "2018" [dependencies] ink_core = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_core", default-features = false } ink_prelude = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_prelude", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate/", package = "sp-runtime", tag = "v2.0.0", default-features = false } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate/", package = "sp-runtime", tag = "v2.0.1-1", default-features = false } scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } serde = { version = "1.0.104", optional = true, features = ["derive"] } -polymesh-derive = { path = "../../../primitives_derive", default-features = false, package = "polymesh-primitives-derive"} scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true } derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } -sp-io = { git = "https://github.com/paritytech/substrate/", package = "sp-io", tag = "v2.0.0", default-features = false, features = ["disable_panic_handler", "disable_oom", "disable_allocator"] } +sp-io = { git = "https://github.com/PolymathNetwork/substrate/", package = "sp-io", tag = "v2.0.1-1", default-features = false, features = ["disable_panic_handler", "disable_oom", "disable_allocator"] } [dependencies.type-metadata] git = "https://github.com/type-metadata/type-metadata.git" diff --git a/migration-tests/Cargo.toml b/migration-tests/Cargo.toml new file mode 100644 index 0000000000..485f420b6f --- /dev/null +++ b/migration-tests/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "migration-tests" +version = "0.1.0" +authors = ["Polymath"] +edition = "2018" + +[dependencies] +futures = "0.3" +lazy_static = "1.4.0" + +# Old migration helpers +remote-externalities-old = { package = "remote-externalities", git = "https://github.com/PolymathNetwork/Polymesh", rev = "065ea0c243c7e6f6d665d769cf79647d2ecfca00" } +frame-support-old = { package = "frame-support", git = "https://github.com/paritytech/substrate", tag = "v2.0.1" } +sp-state-machine-old = { package = "sp-state-machine", git = "https://github.com/paritytech/substrate", tag = "v2.0.1" } + +# New migration helpers +remote-externalities = { path = "remote-externalities" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } + +# Old pallets +polymesh-runtime-old = { package = "polymesh-runtime-testnet", git = "https://github.com/PolymathNetwork/Polymesh", rev = "14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" } +pallet-asset-old = { package = "pallet-asset", git = "https://github.com/PolymathNetwork/Polymesh", rev = "14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" } +polymesh-primitives-old = { package = "polymesh-primitives", git = "https://github.com/PolymathNetwork/Polymesh", rev = "14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" } + +# New pallets +polymesh-runtime = { package = "polymesh-runtime-testnet", path = "../pallets/runtime/testnet", features = ["migration-dry-run"] } +pallet-asset = { path = "../pallets/asset" } +polymesh-primitives = { path = "../primitives" } diff --git a/migration-tests/remote-externalities/.gitignore b/migration-tests/remote-externalities/.gitignore new file mode 100644 index 0000000000..a8a0dcec44 --- /dev/null +++ b/migration-tests/remote-externalities/.gitignore @@ -0,0 +1 @@ +*.bin diff --git a/migration-tests/remote-externalities/Cargo.toml b/migration-tests/remote-externalities/Cargo.toml new file mode 100644 index 0000000000..67e6246ec6 --- /dev/null +++ b/migration-tests/remote-externalities/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "remote-externalities" +version = "0.1.0" +authors = ["kianenigma "] +edition = "2018" + +[dependencies] +jsonrpc-core-client = { version = "15.1.0", features = ["http"] } +sc-rpc-api = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-rpc = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +futures = "0.1.29" + +hex-literal = "0.3.1" +env_logger = "0.8.2" +log = "0.4.11" +bincode = "1.3.1" +tokio = "0.1.22" + +sp-io = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } + +[dev-dependencies] +async-std = { version = "1.6.5", features = ["attributes"] } + +[features] +remote-test = [] diff --git a/migration-tests/remote-externalities/README.md b/migration-tests/remote-externalities/README.md new file mode 100644 index 0000000000..101954d96d --- /dev/null +++ b/migration-tests/remote-externalities/README.md @@ -0,0 +1,127 @@ +# remote-externalities + +## Remote Externalities + +An equivalent of `sp_io::TestExternalities` that can load its state from a remote substrate +based chain. + +##### Building + +Building this crate can be bit tricky, here are some advise about it. + +You have two main issues: + +1. You need to get your hand on a `Runtime`; something that implements all of the pallet + `Config` traits (formerly `trait Trait`). +2. If that runtime happens to come from the polkadot repo, you need to make sure it compiles. + +In both cases, you probably also need to import an un-merged pallet from substrate that you are +working on, so let's first take a look at that. + +You need to building such a structure: + +```rust +. +| -- ./substrate (where you are coding something new that needs to be tested) +| -- ./substrate-debug-kit (your beloved debug kit) +``` + +From the sibling substrate, you probably want to import `./substrate/frame/new-pallet`. Then, +you need to make sure dependencies used by this crate (i.e. `sp-io`) match the ones being used +in `new-pallet` (otherwise there's a 99% chance that some dependency version resolution will +fail -- try it if you feel fancy). To do this, the easiest way is to make this repo's +dependencies point to your sibling substrate. You can use _cargo path override_ for this, but +there's also a simpler script for this. Simply run `node update_cargo.js local` in the root of +this repo and all of the substrate dependencies will point to a sibling substrate. Use `node +update_cargo.js exact` to switch back. + +> At this point, if there has been a breaking change in `sp-*` crates, this crate might not +compile. Please make an issue. This is rather rare. + +Now we can get to the above issues again. You have two opitions: + +1. Build a mock runtime, similar how to you would build one in a pallet test (see example + below). The very important point here is that this mock needs to hold real values for types + that matter for you. Some typical ones are: + +- `sp_runtime::AccountId32` as `AccountId`. +- `u32` as `BlockNumber`. +- `u128` as Balance. + +And most importantly the types of `my-pallet`. Once you have your `Runtime`, you can use it for +storage type resolution and do things like `>::funciton()` or +`>::get()`. + +2. Finally, the second option: + +If you you alredy have new pallet integrated in polkadot, you can directly pull +`polkadot-runtime` or `kusama-runtime` and use that, like `use polkadot_runtime::Runtime` (which +will take a week to compile). Note that you, again, have to make sure that the substrate +dependencies don't clash: You need a local polkadot repo next to the above two, use it to import +the `Runtime`, and make sure there is a `.cargo/config` file in polkadot overrding substrate +dependencies to point to the local one. + +> I personally recommend building a mock runtime if you only use remote-externalities, and use a +real runtime if you ise `migration-dry-run`. + +#### Example + +With a test runtime + +```rust +use remote_externalities::Builder; + +#[derive(Clone, Eq, PartialEq, Debug, Default)] +pub struct TestRuntime; + +use frame_system as system; +impl_outer_origin! { + pub enum Origin for TestRuntime {} +} + +impl frame_system::Config for TestRuntime { + .. + // we only care about these two for now. The rest can be mock. The block number type of + // kusama is u32. + type BlockNumber = u32; + type Header = Header; + .. +} + +#[test] +fn test_runtime_works() { + let hash: Hash = + hex!["f9a4ce984129569f63edc01b1c13374779f9384f1befd39931ffdcc83acf63a7"].into(); + let parent: Hash = + hex!["540922e96a8fcaf945ed23c6f09c3e189bd88504ec945cc2171deaebeaf2f37e"].into(); + Builder::new() + .at(hash) + .module("System") + .build() + .execute_with(|| { + assert_eq!( + // note: the hash corresponds to 3098546. We can check only the parent. + // https://polkascan.io/kusama/block/3098546 + >::block_hash(3098545u32), + parent, + ) + }); +} +``` + +Or with the real kusama runtime. + +```rust +use remote_externalities::Builder; +use kusama_runtime::Runtime; + +#[test] +fn test_runtime_works() { + let hash: Hash = + hex!["f9a4ce984129569f63edc01b1c13374779f9384f1befd39931ffdcc83acf63a7"].into(); + Builder::new() + .at(hash) + .module("Staking") + .build() + .execute_with(|| assert_eq!(>::validator_count(), 400)); +} diff --git a/migration-tests/remote-externalities/src/lib.rs b/migration-tests/remote-externalities/src/lib.rs new file mode 100644 index 0000000000..2b5f97e365 --- /dev/null +++ b/migration-tests/remote-externalities/src/lib.rs @@ -0,0 +1,512 @@ +// This file is part of Substrate. + +// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # Remote Externalities +//! +//! An equivalent of `sp_io::TestExternalities` that can load its state from a remote substrate +//! based chain, or a local cache file. +//! +//! #### Runtime to Test Against +//! +//! While not absolutely necessary, you most likely need a `Runtime` equivalent in your test setup +//! through which you can infer storage types. There are two options here: +//! +//! 1. Build a mock runtime, similar how to you would build one in a pallet test (see example +//! below). The very important point here is that this mock needs to hold real values for types +//! that matter for you, based on the chain of interest. Some typical ones are: +//! +//! - `sp_runtime::AccountId32` as `AccountId`. +//! - `u32` as `BlockNumber`. +//! - `u128` as Balance. +//! +//! Once you have your `Runtime`, you can use it for storage type resolution and do things like +//! `>::storage_getter()` or `>::get()`. +//! +//! 2. Or, you can use a real runtime. +//! +//! ### Example +//! +//! With a test runtime +//! +//! ```ignore +//! use remote_externalities::Builder; +//! +//! #[derive(Clone, Eq, PartialEq, Debug, Default)] +//! pub struct TestRuntime; +//! +//! use frame_system as system; +//! impl_outer_origin! { +//! pub enum Origin for TestRuntime {} +//! } +//! +//! impl frame_system::Config for TestRuntime { +//! .. +//! // we only care about these two for now. The rest can be mock. The block number type of +//! // kusama is u32. +//! type BlockNumber = u32; +//! type Header = Header; +//! .. +//! } +//! +//! #[test] +//! fn test_runtime_works() { +//! let hash: Hash = +//! hex!["f9a4ce984129569f63edc01b1c13374779f9384f1befd39931ffdcc83acf63a7"].into(); +//! let parent: Hash = +//! hex!["540922e96a8fcaf945ed23c6f09c3e189bd88504ec945cc2171deaebeaf2f37e"].into(); +//! Builder::new() +//! .at(hash) +//! .module("System") +//! .build() +//! .execute_with(|| { +//! assert_eq!( +//! // note: the hash corresponds to 3098546. We can check only the parent. +//! // https://polkascan.io/kusama/block/3098546 +//! >::block_hash(3098545u32), +//! parent, +//! ) +//! }); +//! } +//! ``` +//! +//! Or with the real kusama runtime. +//! +//! ```ignore +//! use remote_externalities::Builder; +//! use kusama_runtime::Runtime; +//! +//! #[test] +//! fn test_runtime_works() { +//! let hash: Hash = +//! hex!["f9a4ce984129569f63edc01b1c13374779f9384f1befd39931ffdcc83acf63a7"].into(); +//! Builder::new() +//! .at(hash) +//! .module("Staking") +//! .build() +//! .execute_with(|| assert_eq!(>::validator_count(), 400)); +//! } +//! ``` + +use futures::future::Future; +use log::*; +use sp_core::hashing::twox_128; +use sp_core::storage::{StorageData, StorageKey}; +pub use sp_io::TestExternalities; +use std::fmt::{Debug, Formatter, Result as FmtResult}; +use std::{ + fs, + path::{Path, PathBuf}, +}; + +type KeyPair = (StorageKey, StorageData); +type Number = u32; +type Hash = sp_core::H256; +// TODO: make these two generic. + +const LOG_TARGET: &'static str = "remote-ext"; + +/// Struct for better hex printing of slice types. +pub struct HexSlice<'a>(&'a [u8]); + +impl<'a> HexSlice<'a> { + pub fn new(data: &'a T) -> HexSlice<'a> + where + T: ?Sized + AsRef<[u8]> + 'a, + { + HexSlice(data.as_ref()) + } +} + +// You can choose to implement multiple traits, like Lower and UpperHex +impl Debug for HexSlice<'_> { + fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { + write!(f, "0x")?; + for byte in self.0 { + write!(f, "{:x}", byte)?; + } + Ok(()) + } +} +/// Extension trait for hex display. +pub trait HexDisplayExt { + fn hex_display(&self) -> HexSlice<'_>; +} + +impl> HexDisplayExt for T { + fn hex_display(&self) -> HexSlice<'_> { + HexSlice::new(self) + } +} + +/// The execution mode. +#[derive(Clone)] +pub enum Mode { + /// Online. + Online(OnlineConfig), + /// Offline. Uses a cached file and needs not any client config. + Offline(OfflineConfig), +} + +/// configuration of the online execution. +/// +/// A cache config must be present. +#[derive(Clone, Default)] +pub struct OfflineConfig { + cache: CacheConfig, +} + +/// Configuration of the online execution. +/// +/// A cache config may be present and will be written to in that case. +#[derive(Clone)] +pub struct OnlineConfig { + pub uri: String, + pub at: Option, + pub cache: Option, + pub modules: Vec, +} + +impl Default for OnlineConfig { + fn default() -> Self { + Self { + uri: "http://localhost:9933".into(), + at: None, + cache: None, + modules: Default::default(), + } + } +} + +/// Configuration of the cache. +#[derive(Clone)] +pub struct CacheConfig { + name: String, + directory: String, +} + +impl Default for CacheConfig { + fn default() -> Self { + Self { + name: "CACHE".into(), + directory: ".".into(), + } + } +} + +impl CacheConfig { + fn path(&self) -> PathBuf { + Path::new(&self.directory).join(self.name.clone()) + } +} + +/// Builder for remote-externalities. +pub struct Builder { + inject: Vec, + mode: Mode, + chain: String, +} + +impl Default for Builder { + fn default() -> Self { + Self { + inject: Default::default(), + mode: Mode::Online(OnlineConfig { + at: None, + uri: "http://localhost:9933".into(), + cache: None, + modules: Default::default(), + }), + chain: "UNSET".into(), + } + } +} + +// Mode methods +impl Builder { + fn as_online(&self) -> &OnlineConfig { + match &self.mode { + Mode::Online(config) => &config, + _ => panic!("Unexpected mode: Online"), + } + } + + fn as_online_mut(&mut self) -> &mut OnlineConfig { + match &mut self.mode { + Mode::Online(config) => config, + _ => panic!("Unexpected mode: Online"), + } + } +} + +// RPC methods +impl Builder { + async fn rpc_get_head(&self) -> Hash { + let mut rt = tokio::runtime::Runtime::new().expect("Unable to create a runtime"); + let uri = self.as_online().uri.clone(); + rt.block_on::<_, _, ()>(futures::lazy(move || { + trace!(target: LOG_TARGET, "rpc: finalized_head"); + let client: sc_rpc_api::chain::ChainClient = + jsonrpc_core_client::transports::http::connect(&uri) + .wait() + .unwrap(); + Ok(client.finalized_head().wait().unwrap()) + })) + .unwrap() + } + + /// Relay the request to `state_getPairs` rpc endpoint. + /// + /// Note that this is an unsafe RPC. + async fn rpc_get_pairs(&self, prefix: StorageKey, at: Hash) -> Vec { + let mut rt = tokio::runtime::Runtime::new().expect("Unable to create a runtime"); + let uri = self.as_online().uri.clone(); + rt.block_on::<_, _, ()>(futures::lazy(move || { + trace!( + target: LOG_TARGET, + "rpc: storage_pairs: {:?} / {:?}", + prefix, + at + ); + let client: sc_rpc_api::state::StateClient = + jsonrpc_core_client::transports::http::connect(&uri) + .wait() + .unwrap(); + Ok(client.storage_pairs(prefix, Some(at)).wait().unwrap()) + })) + .unwrap() + } + + /// Get the chain name. + async fn chain_name(&self) -> String { + let mut rt = tokio::runtime::Runtime::new().expect("Unable to create a runtime"); + let uri = self.as_online().uri.clone(); + rt.block_on::<_, _, ()>(futures::lazy(move || { + trace!(target: LOG_TARGET, "rpc: system_chain"); + let client: sc_rpc_api::system::SystemClient<(), ()> = + jsonrpc_core_client::transports::http::connect(&uri) + .wait() + .unwrap(); + Ok(client.system_chain().wait().unwrap()) + })) + .unwrap() + } +} + +// Internal methods +impl Builder { + /// Save the given data as cache. + fn save_cache(&self, data: &[KeyPair], path: &Path) { + let bdata = bincode::serialize(data).unwrap(); + info!(target: LOG_TARGET, "writing to cache file {:?}", path); + fs::write(path, bdata).unwrap(); + } + + /// initialize `Self` from cache. Panics if the file does not exist. + fn load_cache(&self, path: &Path) -> Vec { + info!( + target: LOG_TARGET, + "scraping keypairs from cache {:?}", path, + ); + let bytes = fs::read(path).unwrap(); + bincode::deserialize(&bytes[..]).unwrap() + } + + /// Build `Self` from a network node denoted by `uri`. + async fn load_remote(&self) -> Vec { + let config = self.as_online(); + let at = self.as_online().at.unwrap().clone(); + info!( + target: LOG_TARGET, + "scraping keypairs from remote node {} @ {:?}", config.uri, at + ); + + let keys_and_values = if config.modules.len() > 0 { + let mut filtered_kv = vec![]; + for f in config.modules.iter() { + let hashed_prefix = StorageKey(twox_128(f.as_bytes()).to_vec()); + let module_kv = self.rpc_get_pairs(hashed_prefix.clone(), at).await; + info!( + target: LOG_TARGET, + "downloaded data for module {} (count: {}).", + f, + module_kv.len(), + ); + filtered_kv.extend(module_kv); + } + filtered_kv + } else { + info!(target: LOG_TARGET, "downloading data for all modules."); + self.rpc_get_pairs(StorageKey(vec![]), at) + .await + .into_iter() + .collect::>() + }; + + keys_and_values + } + + async fn init_remote_client(&mut self) { + self.as_online_mut().at = Some(self.rpc_get_head().await); + // TODO: set the at. + self.chain = self.chain_name().await; + } + + async fn pre_build(mut self) -> Vec { + let mut base_kv = match self.mode.clone() { + Mode::Offline(config) => self.load_cache(&config.cache.path()), + Mode::Online(config) => { + self.init_remote_client().await; + let kp = self.load_remote().await; + if let Some(c) = config.cache { + self.save_cache(&kp, &c.path()); + } + kp + } + }; + + base_kv.extend(self.inject.clone()); + base_kv + } +} + +// Public methods +impl Builder { + /// Create a new builder. + pub fn new() -> Self { + Default::default() + } + + /// Inject a manual list of key and values to the storage. + pub fn inject(mut self, injections: &[KeyPair]) -> Self { + for i in injections { + self.inject.push(i.clone()); + } + self + } + + /// Configure a cache to be used. + pub fn mode(mut self, mode: Mode) -> Self { + self.mode = mode; + self + } + + /// Build the test externalities. + pub async fn build(self) -> TestExternalities { + let kv = self.pre_build().await; + let mut ext = TestExternalities::new_empty(); + + info!(target: LOG_TARGET, "injecting a total of {} keys", kv.len()); + for (k, v) in kv { + let (k, v) = (k.0, v.0); + trace!( + target: LOG_TARGET, + "injecting {:?} -> {:?}", + k.hex_display(), + v.hex_display() + ); + ext.insert(k, v); + } + ext + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[async_std::test] + #[cfg(feature = "remote-test")] + async fn can_build_one_pallet() { + let _ = env_logger::Builder::from_default_env() + .format_module_path(false) + .format_level(true) + .try_init(); + + Builder::new() + .mode(Mode::Online(OnlineConfig { + modules: vec!["Proxy".into()], + ..Default::default() + })) + .build() + .await + .execute_with(|| {}); + } + + #[async_std::test] + async fn can_load_cache() { + let _ = env_logger::Builder::from_default_env() + .format_module_path(false) + .format_level(true) + .try_init(); + + Builder::new() + .mode(Mode::Offline(OfflineConfig { + cache: CacheConfig { + name: "proxy_test".into(), + ..Default::default() + }, + })) + .build() + .await + .execute_with(|| {}); + } + + #[async_std::test] + #[cfg(feature = "remote-test")] + async fn can_create_cache() { + let _ = env_logger::Builder::from_default_env() + .format_module_path(false) + .format_level(true) + .try_init(); + + Builder::new() + .mode(Mode::Online(OnlineConfig { + cache: Some(CacheConfig { + name: "test_cache_to_remove.bin".into(), + ..Default::default() + }), + ..Default::default() + })) + .build() + .await + .execute_with(|| {}); + + let to_delete = std::fs::read_dir(CacheConfig::default().directory) + .unwrap() + .into_iter() + .map(|d| d.unwrap()) + .filter(|p| p.path().extension().unwrap_or_default() == "bin") + .collect::>(); + + assert!(to_delete.len() > 0); + + for d in to_delete { + std::fs::remove_file(d.path()).unwrap(); + } + } + + #[async_std::test] + #[cfg(feature = "remote-test")] + async fn can_build_all() { + let _ = env_logger::Builder::from_default_env() + .format_module_path(true) + .format_level(true) + .try_init(); + + Builder::new().build().await.execute_with(|| {}); + } +} diff --git a/migration-tests/src/README.md b/migration-tests/src/README.md new file mode 100644 index 0000000000..4e3c775108 --- /dev/null +++ b/migration-tests/src/README.md @@ -0,0 +1,9 @@ +# Migration Tests + +This test suite is used to test the storage migrations in runtime upgrades. + +## Notes + +- The old pallets in the Cargo.toml should point to last release. +- If `CACHE` file is present in this directory, the tests use that as the state or else they download Alcyone state from a remote node. +- If you add any storage migration in runtime upgrade, you should add a corresponding test here. diff --git a/migration-tests/src/lib.rs b/migration-tests/src/lib.rs new file mode 100644 index 0000000000..533dfc5e3c --- /dev/null +++ b/migration-tests/src/lib.rs @@ -0,0 +1,74 @@ +use futures::executor::block_on; +use polymesh_runtime::{DryRunRuntimeUpgrade, Runtime}; +use remote_externalities::{Builder, CacheConfig, Mode, OfflineConfig, OnlineConfig}; +use remote_externalities_old::{ + Builder as BuilderOld, Mode as ModeOld, OfflineConfig as OfflineConfigOld, +}; +use sp_core::storage::{StorageData, StorageKey}; +use sp_state_machine_old::backend::Backend; +use std::{sync::Mutex, time::Instant}; + +#[macro_use] +extern crate lazy_static; + +#[cfg(test)] +mod two_five_zero; + +struct TestState; + +impl TestState { + fn init() { + if !std::path::Path::new(".").join("CACHE").exists() { + block_on( + Builder::new() + .mode(Mode::Online(OnlineConfig { + uri: "http://159.69.94.51:9933".into(), + cache: Some(CacheConfig::default()), + ..Default::default() + })) + .build(), + ); + } + } +} + +lazy_static! { + static ref TEST_STATE: Mutex<()> = Mutex::new(TestState::init()); +} + +/// Main helper function for writing migration tests. +/// +/// Takes two closures, executing the first on the current blockchain state, +/// then the storage migrations, and finally the second closure. +pub fn test_migration(pre_tests: impl FnOnce(), post_tests: impl FnOnce()) { + lazy_static::initialize(&TEST_STATE); + + let mut state = block_on( + BuilderOld::new() + .mode(ModeOld::Offline(OfflineConfigOld::default())) + .build(), + ); + + state.execute_with(pre_tests); + + let pairs = state + .commit_all() + .pairs() + .iter() + .map(|(key, data)| (StorageKey(key.clone()), StorageData(data.clone()))) + .collect::>(); + + let mut new_state = block_on( + Builder::new() + .inject(&pairs[..]) + .mode(Mode::Offline(OfflineConfig::default())) + .build(), + ); + + let now = Instant::now(); + new_state.execute_with(::dry_run_runtime_upgrade); + let elapsed = now.elapsed(); + println!("Storage Migrations took: {:#?}", elapsed); + + new_state.execute_with(post_tests); +} diff --git a/migration-tests/src/two_five_zero.rs b/migration-tests/src/two_five_zero.rs new file mode 100644 index 0000000000..0f92943007 --- /dev/null +++ b/migration-tests/src/two_five_zero.rs @@ -0,0 +1,51 @@ +use crate::test_migration; +use std::convert::TryFrom; + +#[test] +fn checkpoints_upgrade() { + test_migration( + pre_migration_checkpoint_tests, + post_migration_checkpoint_tests, + ); +} + +fn pre_migration_checkpoint_tests() { + type CheckpointOldModule = pallet_asset_old::checkpoint::Module; + use frame_support_old::storage::StorageValue; + use pallet_asset_old::checkpoint as checkpoint_old; + use polymesh_primitives_old::{calendar::CheckpointId as CheckpointIdOld, Ticker as TickerOld}; + use polymesh_runtime_old::Runtime as RuntimeOld; + + // Ensure that the cached data is valid + let ticker_name = b"SBL"; + let ticker = TickerOld::try_from(&ticker_name[..]).unwrap(); + assert!( + CheckpointOldModule::total_supply_at((ticker, CheckpointIdOld(1))) == 10_000_000_000u128 + ); + assert!(CheckpointOldModule::checkpoint_id_sequence(ticker) == CheckpointIdOld(1)); + + // Ensure that any changes made here are carry forward after migration + checkpoint_old::SchedulesMaxComplexity::put(666666); +} + +fn post_migration_checkpoint_tests() { + use frame_support::storage::{StorageDoubleMap, StorageMap, StorageValue}; + use pallet_asset::checkpoint; + use polymesh_primitives::{calendar::CheckpointId, Ticker}; + use polymesh_runtime::Runtime; + + // Ensure that the storage is nuked after the upgrade + let ticker_name = b"SBL"; + let ticker = Ticker::try_from(&ticker_name[..]).unwrap(); + assert!(!checkpoint::TotalSupply::::contains_key( + ticker, + CheckpointId(1) + )); + assert!(!checkpoint::CheckpointIdSequence::contains_key(ticker)); + assert!(!checkpoint::Timestamps::contains_key( + ticker, + CheckpointId(1) + )); + + assert!(checkpoint::SchedulesMaxComplexity::get() == 666666); +} diff --git a/node-rpc/Cargo.toml b/node-rpc/Cargo.toml index 3f3134fc50..0b036d80b3 100644 --- a/node-rpc/Cargo.toml +++ b/node-rpc/Cargo.toml @@ -10,8 +10,8 @@ repository = "https://github.com/PolymathNetwork/substrate" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -polymesh-primitives = { path = "../primitives" } -pallet-contracts-rpc = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +polymesh-primitives = { path = "../primitives", default-features = false } +pallet-contracts-rpc = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } pallet-group-rpc = { path = "../pallets/group/rpc" } pallet-staking-rpc = { path = "../pallets/staking/rpc" } pallet-protocol-fee-rpc = { path = "../pallets/protocol-fee/rpc" } @@ -20,21 +20,21 @@ node-rpc = { path = "../rpc" } jsonrpc-core = "15.0.0" codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -sp-blockchain = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-client-api = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-consensus = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-consensus-babe = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -txpool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sp-blockchain = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-client-api = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-consensus = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-consensus-babe = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sp-block-builder = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +txpool-api = { package = "sp-transaction-pool", git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } -sc-rpc = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-consensus-babe = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-consensus-babe-rpc = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } -sc-keystore = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +sc-rpc = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-consensus-babe = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-consensus-babe-rpc = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-consensus-epochs = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-finality-grandpa = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-finality-grandpa-rpc = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } +sc-keystore = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } -frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", tag = "v2.0.0" } +frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1" } diff --git a/pallets/asset/Cargo.toml b/pallets/asset/Cargo.toml index cbcd33f09e..dab1d3ad47 100644 --- a/pallets/asset/Cargo.toml +++ b/pallets/asset/Cargo.toml @@ -12,7 +12,7 @@ polymesh-common-utilities = { path = "../common", default-features = false } # Our Pallets pallet-balances = { path = "../balances", default-features = false } -pallet-contracts = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", default-features = false } +pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", default-features = false } pallet-identity = { path = "../identity", default-features = false } pallet-permissions = { path = "../permissions", default-features = false } pallet-portfolio = { path = "../portfolio", default-features = false } @@ -29,21 +29,21 @@ arrayvec = { version = "0.5.1", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } libsecp256k1 = { version = "0.3.5", default-features = false, features = ["hmac"] } # Only in STD -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } [features] default = ["std"] diff --git a/pallets/asset/src/benchmarking.rs b/pallets/asset/src/benchmarking.rs index 8f0b408fce..b6f8633b9d 100644 --- a/pallets/asset/src/benchmarking.rs +++ b/pallets/asset/src/benchmarking.rs @@ -12,27 +12,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] use crate::*; +use frame_benchmarking::benchmarks; +use frame_support::StorageValue; +use frame_system::RawOrigin; use polymesh_common_utilities::{ - benchs::{User, UserBuilder}, + benchs::{self, User, UserBuilder}, constants::currency::POLY, - traits::asset::AssetName, }; use polymesh_contracts::ExtensionInfo; -use polymesh_primitives::{ticker::TICKER_LEN, ExtensionAttributes, SmartExtension, Ticker}; - -use frame_benchmarking::benchmarks; -use frame_support::StorageValue; -use frame_system::RawOrigin; -use sp_io::hashing::keccak_256; -use sp_std::{ - convert::{TryFrom, TryInto}, - iter, - prelude::*, +use polymesh_primitives::{ + asset::AssetName, ticker::TICKER_LEN, ExtensionAttributes, SmartExtension, Ticker, }; +use sp_io::hashing::keccak_256; +use sp_std::{convert::TryInto, iter, prelude::*}; const MAX_DOCS_PER_ASSET: u32 = 64; const MAX_DOC_URI: usize = 4096; @@ -40,44 +35,21 @@ const MAX_DOC_NAME: usize = 1024; const MAX_DOC_TYPE: usize = 1024; const MAX_IDENTIFIERS_PER_ASSET: u32 = 512; -/// Create a ticker and register it. -pub fn make_ticker(owner: T::Origin, optional_ticker: Option) -> Ticker { - let ticker = optional_ticker - .unwrap_or_else(|| Ticker::try_from(vec![b'A'; TICKER_LEN as usize].as_slice()).unwrap()); - Module::::register_ticker(owner, ticker).unwrap(); - ticker +pub fn make_ticker(owner: T::Origin) -> Ticker { + benchs::make_ticker::(owner, None) + .expect("Ticker cannot be created") } -pub fn make_asset(owner: &User) -> Ticker { - make_base_asset::(owner, true, None) +fn make_asset(owner: &User) -> Ticker { + benchs::make_asset::(owner, None) + .expect("Asset cannot be created") } pub fn make_indivisible_asset(owner: &User) -> Ticker { - make_base_asset::(owner, false, None) -} - -pub fn make_base_asset( - owner: &User, - divisible: bool, - optional_ticker: Option, -) -> Ticker { - let ticker = make_ticker::(owner.origin().into(), optional_ticker); - let name: AssetName = ticker.as_slice().into(); - let total_supply: T::Balance = (1_000_000 * POLY).into(); - - Module::::create_asset( - owner.origin().into(), - name, - ticker, - total_supply, - divisible, - AssetType::default(), - vec![], - None, + benchs::make_indivisible_asset::( + owner, None, ) - .expect("Asset cannot be created"); - - ticker + .expect("Indivisible asset cannot be created") } pub fn make_document() -> Document { @@ -93,7 +65,7 @@ pub fn make_document() -> Document { fn make_default_reg_config() -> TickerRegistrationConfig { TickerRegistrationConfig { max_ticker_length: 8, - registration_length: Some(10000.into()), + registration_length: Some(10000u32.into()), } } @@ -107,7 +79,7 @@ fn make_classic_ticker(eth_owner: ethereum::EthereumAddress, ticker: T let reg_config = make_default_reg_config::(); let root = frame_system::RawOrigin::Root.into(); - >::reserve_classic_ticker(root, classic_ticker, 0.into(), reg_config) + >::reserve_classic_ticker(root, classic_ticker, 0u128.into(), reg_config) .expect("`reserve_classic_ticker` failed"); } @@ -134,63 +106,110 @@ fn make_extension(is_archive: bool) -> SmartExtension { extension_details } +fn add_ext(is_archive: bool) -> (User, Ticker, T::AccountId) { + let owner = owner::(); + let ticker = make_asset::(&owner); + let ext_details = make_extension::(is_archive); + let ext_id = ext_details.extension_id.clone(); + Module::::add_extension(owner.origin().into(), ticker, ext_details) + .expect("Extension cannot be added"); + (owner, ticker, ext_id) +} + +fn emulate_controller_transfer( + ticker: Ticker, + investor_did: IdentityId, + pia: IdentityId, +) { + // Assign balance to an investor. + let mock_storage = |id: IdentityId, bal: T::Balance| { + let s_id: ScopeId = id; + >::insert(ticker, id, bal); + >::insert(s_id, id, bal); + >::insert(ticker, id, bal); + ScopeIdOf::insert(ticker, id, s_id); + Statistics::::update_transfer_stats(&ticker, None, Some(bal), bal); + }; + mock_storage(investor_did, 1000u32.into()); + mock_storage(pia, 5000u32.into()); +} + +fn owner() -> User { + UserBuilder::::default().generate_did().build("owner") +} + +pub fn owned_ticker() -> (User, Ticker) { + let owner = owner::(); + let ticker = make_asset::(&owner); + (owner, ticker) +} + +fn verify_ownership( + ticker: Ticker, + old: IdentityId, + new: IdentityId, + rel: AssetOwnershipRelation, +) { + assert_eq!( + Module::::asset_ownership_relation(old, ticker), + AssetOwnershipRelation::NotOwned + ); + assert_eq!(Module::::asset_ownership_relation(new, ticker), rel); +} + +fn set_config() { + >::put(TickerRegistrationConfig { + max_ticker_length: TICKER_LEN as u8, + registration_length: Some((60u32 * 24 * 60 * 60).into()), + }); +} + benchmarks! { - _ { } + _ {} register_ticker { - >::put(TickerRegistrationConfig { - max_ticker_length: TICKER_LEN as u8, - registration_length: Some((60 * 24 * 60 * 60).into()), - }); - let caller = UserBuilder::::default().generate_did().build("caller"); // Generate a ticker of length `t`. - let ticker = Ticker::try_from(vec![b'A'; TICKER_LEN].as_slice()).unwrap(); }: _(caller.origin, ticker.clone()) verify { + set_config::(); + let ticker = Ticker::repeating(b'A'); + }: _(caller.origin, ticker) + verify { assert_eq!(Module::::is_ticker_available(&ticker), false); } accept_ticker_transfer { - let owner = UserBuilder::::default().generate_did().build("owner"); + let owner = owner::(); + let ticker = make_ticker::(owner.origin().into()); let new_owner = UserBuilder::::default().generate_did().build("new_owner"); - let ticker = make_ticker::(owner.origin().into(), None); + let did = new_owner.did(); - Module::::asset_ownership_relation(owner.did(), ticker.clone()); - let new_owner_auth_id = identity::Module::::add_auth( owner.did(), Signatory::from(new_owner.did()), AuthorizationData::TransferTicker(ticker), None); - }: _(new_owner.origin(), new_owner_auth_id) - verify { - assert_eq!( - Module::::asset_ownership_relation(owner.did(), ticker), - AssetOwnershipRelation::NotOwned - ); - assert_eq!( - Module::::asset_ownership_relation(new_owner.did(), ticker), - AssetOwnershipRelation::TickerOwned + Module::::asset_ownership_relation(owner.did(), ticker); + let new_owner_auth_id = identity::Module::::add_auth( + owner.did(), + Signatory::from(did), + AuthorizationData::TransferTicker(ticker), + None ); + }: _(new_owner.origin, new_owner_auth_id) + verify { + verify_ownership::(ticker, owner.did(), did, AssetOwnershipRelation::TickerOwned); } accept_asset_ownership_transfer { - let owner = UserBuilder::::default().generate_did().build("owner"); + let (owner, ticker) = owned_ticker::(); let new_owner = UserBuilder::::default().generate_did().build("new_owner"); - - let ticker = make_asset::(&owner); + let did = new_owner.did(); let new_owner_auth_id = identity::Module::::add_auth( owner.did(), - Signatory::from(new_owner.did()), + Signatory::from(did), AuthorizationData::TransferAssetOwnership(ticker), None, ); - }: _(new_owner.origin(), new_owner_auth_id) + }: _(new_owner.origin, new_owner_auth_id) verify { - assert_eq!(Module::::token_details(&ticker).owner_did, new_owner.did()); - assert_eq!( - Module::::asset_ownership_relation(owner.did(), ticker), - AssetOwnershipRelation::NotOwned - ); - assert_eq!( - Module::::asset_ownership_relation(new_owner.did(), ticker), - AssetOwnershipRelation::AssetOwned - ); + assert_eq!(Module::::token_details(&ticker).owner_did, did); + verify_ownership::(ticker, owner.did(), did, AssetOwnershipRelation::AssetOwned); } create_asset { @@ -201,55 +220,50 @@ benchmarks! { // Funding round name length. let f in 1 .. T::FundingRoundNameMaxLength::get() as u32; - >::put(TickerRegistrationConfig { - max_ticker_length: TICKER_LEN as u8, - registration_length: Some((60 * 24 * 60 * 60).into()), - }); - let ticker = Ticker::try_from(vec![b'A'; TICKER_LEN].as_slice()).unwrap(); + set_config::(); + let ticker = Ticker::repeating(b'A'); let name = AssetName::from(vec![b'N'; n as usize].as_slice()); - let identifiers: Vec = - iter::repeat(AssetIdentifier::cusip(*b"17275R102").unwrap()).take(i as usize).collect(); + let identifiers: Vec<_> = iter::repeat(AssetIdentifier::cusip(*b"17275R102").unwrap()) + .take(i as usize) + .collect(); + let identifiers2 = identifiers.clone(); let fundr = FundingRoundName::from(vec![b'F'; f as usize].as_slice()); - let owner = UserBuilder::::default().generate_did().build("owner"); - let total_supply: T::Balance = 1_000_000.into(); + let owner = owner::(); + let total_supply: T::Balance = 1_000_000u32.into(); + let asset_type = AssetType::default(); let token = SecurityToken { - name, + name: name.clone(), owner_did: owner.did(), total_supply: total_supply.clone(), divisible: true, - asset_type: AssetType::default(), + asset_type: asset_type.clone(), primary_issuance_agent: None, }; - - }: _(owner.origin(), token.name.clone(), ticker, total_supply, token.divisible, token.asset_type.clone(), identifiers.clone(), Some(fundr)) + }: _(owner.origin, name, ticker, total_supply, token.divisible, asset_type, identifiers, Some(fundr)) verify { assert_eq!(Module::::token_details(ticker), token); - - assert_eq!(Module::::identifiers(ticker), identifiers); + assert_eq!(Module::::identifiers(ticker), identifiers2); } - freeze { - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - }: _(owner.origin, ticker.clone()) + let (owner, ticker) = owned_ticker::(); + }: _(owner.origin, ticker) verify { - assert_eq!( Module::::frozen(&ticker), true); + assert_eq!(Module::::frozen(&ticker), true); } unfreeze { - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); + let (owner, ticker) = owned_ticker::(); - Module::::freeze( owner.origin().into(), ticker.clone()) + Module::::freeze(owner.origin().into(), ticker) .expect("Asset cannot be frozen"); - assert_eq!( Module::::frozen(&ticker), true); - }: _(owner.origin, ticker.clone()) + assert_eq!(Module::::frozen(&ticker), true); + }: _(owner.origin, ticker) verify { - assert_eq!( Module::::frozen(&ticker), false); + assert_eq!(Module::::frozen(&ticker), false); } rename_asset { @@ -257,208 +271,193 @@ benchmarks! { let n in 1 .. T::AssetNameMaxLength::get() as u32; let new_name = AssetName::from(vec![b'N'; n as usize].as_slice()); - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - }: _(owner.origin(), ticker.clone(), new_name.clone()) + let new_name2 = new_name.clone(); + let (owner, ticker) = owned_ticker::(); + }: _(owner.origin, ticker, new_name) verify { - let token = Module::::token_details(ticker); - assert_eq!( token.name, new_name); + assert_eq!(Module::::token_details(ticker).name, new_name2); } issue { - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - - }: _(owner.origin, ticker.clone(), 1_000_000.into()) + let (owner, ticker) = owned_ticker::(); + }: _(owner.origin, ticker, (1_000_000 * POLY).into()) verify { - let token = Module::::token_details(ticker); - assert_eq!( token.total_supply, 2_000_000.into()); + assert_eq!(Module::::token_details(ticker).total_supply, (2_000_000 * POLY).into()); } - redeem { - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - }: _(owner.origin, ticker.clone(), 600_000.into()) + let (owner, ticker) = owned_ticker::(); + }: _(owner.origin, ticker, (600_000 * POLY).into()) verify { - let token = Module::::token_details(ticker); - assert_eq!( token.total_supply, 400_000.into()); + assert_eq!(Module::::token_details(ticker).total_supply, (400_000 * POLY).into()); } make_divisible { - let owner = UserBuilder::default().generate_did().build("owner"); + let owner = owner::(); let ticker = make_indivisible_asset::(&owner); }: _(owner.origin, ticker) verify { - let token = Module::::token_details(ticker); - assert_eq!( token.divisible, true); + assert_eq!(Module::::token_details(ticker).divisible, true); } add_documents { // It starts at 1 in order to get something for `verify` section. let d in 1 .. MAX_DOCS_PER_ASSET; - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - let docs = iter::repeat( make_document()).take( d as usize).collect::>(); - - }: _(owner.origin, docs.clone(), ticker.clone()) + let (owner, ticker) = owned_ticker::(); + let docs = iter::repeat(make_document()).take(d as usize).collect::>(); + let docs2 = docs.clone(); + }: _(owner.origin, docs, ticker) verify { for i in 1..d { - assert_eq!(Module::::asset_documents(ticker, DocumentId(i)), docs[i as usize]); + assert_eq!(Module::::asset_documents(ticker, DocumentId(i)), docs2[i as usize]); } } remove_documents { let d in 1 .. MAX_DOCS_PER_ASSET; - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - let docs = iter::repeat( make_document()).take( MAX_DOCS_PER_ASSET as usize).collect::>(); - Module::::add_documents( owner.origin().into(), docs.clone(), ticker) + let (owner, ticker) = owned_ticker::(); + let docs = iter::repeat(make_document()) + .take(MAX_DOCS_PER_ASSET as usize) + .collect::>(); + Module::::add_documents(owner.origin().into(), docs.clone(), ticker) .expect("Documents cannot be added"); - let remove_doc_ids = (1..d).map(|i| DocumentId(i-1)).collect::>(); - - }: _(owner.origin, remove_doc_ids.clone(), ticker.clone()) + let remove_doc_ids = (1..d).map(|i| DocumentId(i - 1)).collect::>(); + }: _(owner.origin, remove_doc_ids, ticker) verify { for i in 1..d { - assert_eq!(::contains_key( &ticker, DocumentId(i-1)), false); + assert_eq!(AssetDocuments::contains_key( &ticker, DocumentId(i-1)), false); } } - set_funding_round { + set_funding_round { let f in 1 .. T::FundingRoundNameMaxLength::get() as u32; - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - + let (owner, ticker) = owned_ticker::(); let fundr = FundingRoundName::from(vec![b'X'; f as usize].as_slice()); - }: _(owner.origin, ticker.clone(), fundr.clone()) - verify { - assert_eq!( Module::::funding_round(ticker), fundr); - } - - - update_identifiers { - let i in 1 .. MAX_IDENTIFIERS_PER_ASSET; - - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - - let identifiers: Vec = - iter::repeat(AssetIdentifier::cusip(*b"037833100").unwrap()).take(i as usize).collect(); - - }: _(owner.origin(), ticker.clone(), identifiers.clone()) - verify { - assert_eq!( Module::::identifiers(ticker), identifiers); - } - - add_extension { - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - let ext_details = make_extension::(false); - let ext_id = ext_details.extension_id.clone(); - }: _(owner.origin(), ticker.clone(), ext_details.clone()) - verify { - assert_eq!( Module::::extension_details((ticker, ext_id)), ext_details); - } - - archive_extension { - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - let ext_details = make_extension::(false); - let ext_id = ext_details.extension_id.clone(); - Module::::add_extension( owner.origin().into(), ticker.clone(), ext_details) - .expect( "Extension cannot be added"); - - }: _(owner.origin, ticker.clone(), ext_id.clone()) - verify { - let ext_details = Module::::extension_details((ticker,ext_id)); - assert_eq!( ext_details.is_archive, true); - } - - unarchive_extension { - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - let ext_details = make_extension::(true); - let ext_id = ext_details.extension_id.clone(); - Module::::add_extension( owner.origin().into(), ticker.clone(), ext_details) - .expect( "Extension cannot be added"); - - }: _(owner.origin(), ticker.clone(), ext_id.clone()) - verify { - let ext_details = Module::::extension_details((ticker,ext_id)); - assert_eq!( ext_details.is_archive, false); - } - - remove_smart_extension { - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - let ext_details = make_extension::(false); - let ext_id = ext_details.extension_id.clone(); - Module::::add_extension( owner.origin().into(), ticker.clone(), ext_details) - .expect( "Extension cannot be added"); - }: _(owner.origin(), ticker.clone(), ext_id.clone()) - verify { - assert_eq!(>::contains_key((ticker,ext_id)), false); - } + let fundr2 = fundr.clone(); + }: _(owner.origin, ticker, fundr) + verify { + assert_eq!(Module::::funding_round(ticker), fundr2); + } - remove_primary_issuance_agent { - let owner = UserBuilder::default().generate_did().build("owner"); - let ticker = make_asset::(&owner); - }: _(owner.origin(), ticker.clone()) + update_identifiers { + let i in 1 .. MAX_IDENTIFIERS_PER_ASSET; + + let (owner, ticker) = owned_ticker::(); + + let identifiers: Vec<_> = iter::repeat(AssetIdentifier::cusip(*b"037833100").unwrap()) + .take(i as usize) + .collect(); + let identifiers2 = identifiers.clone(); + }: _(owner.origin, ticker, identifiers) + verify { + assert_eq!(Module::::identifiers(ticker), identifiers2); + } + + add_extension { + let (owner, ticker) = owned_ticker::(); + let details = make_extension::(false); + let details2 = details.clone(); + }: _(owner.origin, ticker, details) + verify { + assert_eq!(details2, Module::::extension_details((ticker, details2.extension_id.clone()))); + } + + archive_extension { + let (owner, ticker, ext_id) = add_ext::(false); + let ext_id2 = ext_id.clone(); + }: _(owner.origin, ticker, ext_id) verify { - let token = Module::::token_details(ticker); - assert_eq!( token.primary_issuance_agent, None); + assert_eq!(Module::::extension_details((ticker, ext_id2)).is_archive, true); } + unarchive_extension { + let (owner, ticker, ext_id) = add_ext::(true); + let ext_id2 = ext_id.clone(); + }: _(owner.origin, ticker, ext_id) + verify { + assert_eq!(Module::::extension_details((ticker, ext_id2)).is_archive, false); + } + + remove_smart_extension { + let (owner, ticker, ext_id) = add_ext::(false); + let ext_id2 = ext_id.clone(); + }: _(owner.origin, ticker, ext_id) + verify { + assert_eq!(>::contains_key((ticker, ext_id2)), false); + } + + remove_primary_issuance_agent { + let (owner, ticker) = owned_ticker::(); + }: _(owner.origin, ticker) + verify { + assert_eq!(Module::::token_details(ticker).primary_issuance_agent, None); + } claim_classic_ticker { - let owner = UserBuilder::::default().generate_did().build("owner"); + let owner = owner::(); + let did = owner.did(); let owner_eth_sk = secp256k1::SecretKey::parse(&keccak_256(b"owner")).unwrap(); let owner_eth_pk = ethereum::address(&owner_eth_sk); - let ticker :Ticker = b"USDX1"[..].try_into().unwrap(); - make_classic_ticker::( owner_eth_pk, ticker.clone()); - - let eth_sig = ethereum::eth_msg(owner.did(), b"classic_claim", &owner_eth_sk); + let ticker: Ticker = b"USDX1"[..].try_into().unwrap(); + make_classic_ticker::(owner_eth_pk, ticker); - }: _(owner.origin(), ticker.clone(), eth_sig) + let eth_sig = ethereum::eth_msg(did, b"classic_claim", &owner_eth_sk); + }: _(owner.origin, ticker, eth_sig) verify { - assert_eq!(owner.did(), Module::::ticker_registration(ticker).owner); + assert_eq!(did, Module::::ticker_registration(ticker).owner); } reserve_classic_ticker { - let owner = UserBuilder::::default().generate_did().build("owner"); + let owner = owner::(); - let ticker :Ticker = b"ACME"[..].try_into().unwrap(); + let ticker: Ticker = b"ACME"[..].try_into().unwrap(); let config = make_default_reg_config::(); let classic = ClassicTickerImport { eth_owner: ethereum::EthereumAddress(*b"0x012345678987654321"), - ticker: ticker.clone(), + ticker, is_created: true, is_contract: false, }; - }: _( RawOrigin::Root, classic.clone(), owner.did(), config) + }: _(RawOrigin::Root, classic, owner.did(), config) verify { assert_eq!(>::contains_key(&ticker), true); } accept_primary_issuance_agent_transfer { - let owner = UserBuilder::::default().generate_did().build("owner"); - let primary_issuance_agent = UserBuilder::::default().generate_did().build("1stIssuance"); - let ticker = make_asset::(&owner); + let (owner, ticker) = owned_ticker::(); + let pia = UserBuilder::::default().generate_did().build("1stIssuance"); + + let auth_id = identity::Module::::add_auth( + owner.did(), + Signatory::from(pia.did()), + AuthorizationData::TransferPrimaryIssuanceAgent(ticker), + None, + ); + }: _(pia.origin, auth_id) + verify { + assert_eq!(Module::::token_details(&ticker).primary_issuance_agent, pia.did); + } + controller_transfer { + let (owner, ticker) = owned_ticker::(); + let pia = UserBuilder::::default().generate_did().build("1stIssuance"); + let investor = UserBuilder::::default().generate_did().build("investor"); let auth_id = identity::Module::::add_auth( owner.did(), - Signatory::from(primary_issuance_agent.did()), - AuthorizationData::TransferPrimaryIssuanceAgent(ticker.clone()), + Signatory::from(pia.did()), + AuthorizationData::TransferPrimaryIssuanceAgent(ticker), None, ); - }: _(primary_issuance_agent.origin(), auth_id) + Module::::accept_primary_issuance_agent_transfer(pia.origin().into(), auth_id)?; + emulate_controller_transfer::(ticker, investor.did(), pia.did()); + let portfolio_to = PortfolioId::default_portfolio(investor.did()); + }: _(pia.origin, ticker, 500u32.into(), portfolio_to) verify { - let token = Module::::token_details(&ticker); - assert_eq!(token.primary_issuance_agent, primary_issuance_agent.did); + assert_eq!(Module::::balance_of(ticker, investor.did()), 500u32.into()); } } diff --git a/pallets/asset/src/checkpoint/benchmarking.rs b/pallets/asset/src/checkpoint/benchmarking.rs new file mode 100644 index 0000000000..d46b245feb --- /dev/null +++ b/pallets/asset/src/checkpoint/benchmarking.rs @@ -0,0 +1,100 @@ +// This file is part of the Polymesh distribution (https://github.com/PolymathNetwork/Polymesh). +// Copyright (c) 2020 Polymath + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3. + +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use super::*; +use crate::benchmarking::owned_ticker; +use frame_benchmarking::benchmarks; +use frame_system::RawOrigin; +use polymesh_primitives::calendar::CalendarUnit; + +fn init() -> (RawOrigin, Ticker) { + >::set(1000u32.into()); + let (owner, ticker) = owned_ticker::(); + (owner.origin(), ticker) +} + +fn init_with_existing(existing: u32) -> (RawOrigin, Ticker) { + let (owner, ticker) = init::(); + + // First create some schedules. To make sorting more expensive, we'll make em all equal. + let schedule = ScheduleSpec { + start: Some(2000), + remaining: 0, + period: <_>::default(), + }; + for _ in 0..existing { + Module::::create_schedule(owner.clone().into(), ticker, schedule).unwrap(); + } + + (owner, ticker) +} + +benchmarks! { + _ {} + + set_schedules_max_complexity {}: _(RawOrigin::Root, 7) + verify { + assert_eq!(Module::::schedules_max_complexity(), 7) + } + + create_checkpoint { + let (owner, ticker) = init::(); + }: _(owner, ticker) + verify { + assert_eq!(Module::::checkpoint_id_sequence(ticker), CheckpointId(1)) + } + + create_schedule { + // Stored schedules before creating this one. + let s in 1 .. Module::::schedules_max_complexity() as u32; + + // Make a schedule that is as complex as possible. + let schedule = ScheduleSpec { + // Not entirely clear this is more expensive, but probably is. + // In either case, this triggers `start == now`, which is definitely more expensive. + start: None, + // Forces us into the most amount of branches. + remaining: 2, + period: CalendarPeriod { + // We want the schedule to be recurring as it triggers more branches. + amount: 5, + // Months have the most complicated "next at" calculation, so we use months. + unit: CalendarUnit::Month, + }, + }; + + // Ensure it will fit in the max complexity. + Module::::set_schedules_max_complexity( + RawOrigin::Root.into(), + schedule.period.complexity() * Module::::schedules_max_complexity() + ).unwrap(); + + let (owner, ticker) = init_with_existing::(s); + }: _(owner, ticker, schedule) + verify { + assert_eq!(Module::::schedule_id_sequence(ticker), ScheduleId(s as u64 + 1)) + } + + remove_schedule { + // Stored schedules before creating this one. + let s in 1 .. Module::::schedules_max_complexity() as u32; + + let id = ScheduleId(s as u64); + let (owner, ticker) = init_with_existing::(s); + }: _(owner, ticker, id) + verify { + assert!(Module::::schedules(ticker).iter().all(|s| s.id != id)); + } +} diff --git a/pallets/asset/src/checkpoint.rs b/pallets/asset/src/checkpoint/mod.rs similarity index 73% rename from pallets/asset/src/checkpoint.rs rename to pallets/asset/src/checkpoint/mod.rs index dde8ceaf7d..49f3b03a23 100644 --- a/pallets/asset/src/checkpoint.rs +++ b/pallets/asset/src/checkpoint/mod.rs @@ -39,13 +39,17 @@ //! and applies new balances in `updates` for the last checkpoint. //! - Other misc storage items as defined in `decl_storage!`. +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarking; + use codec::{Decode, Encode}; -use core::iter; +use core::{iter, mem}; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, dispatch::{DispatchError, DispatchResult}, ensure, - traits::{Get, UnixTime}, + traits::UnixTime, + weights::Weight, }; use frame_system::ensure_root; use polymesh_common_utilities::{ @@ -54,8 +58,9 @@ use polymesh_common_utilities::{ }; use polymesh_primitives::{ calendar::{CalendarPeriod, CheckpointId, CheckpointSchedule}, - EventDid, IdentityId, Moment, Ticker, + storage_migrate_on, storage_migration_ver, EventDid, IdentityId, Moment, Ticker, }; +use polymesh_primitives_derive::Migrate; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; use sp_std::prelude::*; @@ -67,12 +72,12 @@ type Asset = pallet_asset::Module; /// ID of a `StoredSchedule`. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Encode, Decode, Copy, Clone, Debug, PartialEq, Eq, Default)] +#[derive(Encode, Decode, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)] pub struct ScheduleId(pub u64); /// One or more scheduled checkpoints in the future. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Encode, Decode, Copy, Clone, Debug, PartialEq, Eq)] +#[derive(Encode, Decode, Copy, Clone, Debug, PartialEq, Eq, Migrate)] pub struct StoredSchedule { /// A series of checkpoints in the future defined by the schedule. pub schedule: CheckpointSchedule, @@ -82,6 +87,12 @@ pub struct StoredSchedule { /// When the next checkpoint is due to be created. /// Used as a cache for more efficient sorting. pub at: Moment, + /// Number of CPs that the schedule may create + /// before it is evicted from the schedule set. + /// + /// The value `0` is special cased to mean infinity. + #[migrate_with(0)] + pub remaining: u32, } /// Input specification for a checkpoint schedule. @@ -93,6 +104,11 @@ pub struct ScheduleSpec { pub start: Option, /// The period at which the checkpoint is set to recur after `start`. pub period: CalendarPeriod, + /// Number of CPs that the schedule may create + /// before it is evicted from the schedule set. + /// + /// The value `0` is special cased to mean infinity. + pub remaining: u32, } /// Create a schedule spec due exactly at the provided `start: Moment` time. @@ -100,10 +116,16 @@ impl From for ScheduleSpec { fn from(start: Moment) -> Self { let period = <_>::default(); let start = start.into(); - Self { start, period } + Self { + start, + period, + remaining: 0, + } } } +storage_migration_ver!(2); + decl_storage! { trait Store for Module as Checkpoint { // --------------------- Supply / Balance storage ---------------------- @@ -112,13 +134,13 @@ decl_storage! { /// /// (ticker, checkpointId) -> total supply at given checkpoint pub TotalSupply get(fn total_supply_at): - map hasher(blake2_128_concat) (Ticker, CheckpointId) => T::Balance; + double_map hasher(blake2_128_concat) Ticker, hasher(twox_64_concat) CheckpointId => T::Balance; /// Balance of a DID at a checkpoint. /// /// (ticker, did, checkpoint ID) -> Balance of a DID at a checkpoint pub Balance get(fn balance_at_checkpoint): - map hasher(blake2_128_concat) (Ticker, IdentityId, CheckpointId) => T::Balance; + double_map hasher(blake2_128_concat) (Ticker, CheckpointId), hasher(twox_64_concat) IdentityId => T::Balance; // ------------------------ Checkpoint storage ------------------------- @@ -132,16 +154,16 @@ decl_storage! { /// Checkpoints where a DID's balance was updated. /// (ticker, did) -> [checkpoint ID where user balance changed] pub BalanceUpdates get(fn balance_updates): - map hasher(blake2_128_concat) (Ticker, IdentityId) => Vec; + double_map hasher(blake2_128_concat) Ticker, hasher(twox_64_concat) IdentityId => Vec; /// Checkpoint timestamps. /// /// Every schedule-originated checkpoint maps its ID to its due time. /// Every checkpoint manually created maps its ID to the time of recording. /// - /// (checkpoint ID) -> checkpoint timestamp + /// (ticker) -> (checkpoint ID) -> checkpoint timestamp pub Timestamps get(fn timestamps): - map hasher(identity) CheckpointId => Moment; + double_map hasher(blake2_128_concat) Ticker, hasher(twox_64_concat) CheckpointId => Moment; // -------------------- Checkpoint Schedule storage -------------------- @@ -161,26 +183,77 @@ decl_storage! { pub Schedules get(fn schedules): map hasher(blake2_128_concat) Ticker => Vec; - /// Is the schedule removable? + /// How many "strong" references are there to a given `ScheduleId`? + /// + /// The presence of a "strong" reference, in the sense of `Rc`, + /// entails that the referenced schedule cannot be removed. + /// Thus, as long as `strong_ref_count(schedule_id) > 0`, + /// `remove_schedule(schedule_id)` will error. /// - /// (ticker, schedule ID) -> removable? - pub ScheduleRemovable get(fn schedule_removable): - map hasher(blake2_128_concat) (Ticker, ScheduleId) => bool; + /// (ticker, schedule ID) -> strong ref count + pub ScheduleRefCount get(fn schedule_ref_count): + double_map hasher(blake2_128_concat) Ticker, hasher(twox_64_concat) ScheduleId => u32; /// All the checkpoints a given schedule originated. /// /// (ticker, schedule ID) -> [checkpoint ID] pub SchedulePoints get(fn schedule_points): - map hasher(blake2_128_concat) (Ticker, ScheduleId) => Vec; + double_map hasher(blake2_128_concat) Ticker, hasher(twox_64_concat) ScheduleId => Vec; + + /// Storage version. + StorageVersion get(fn storage_version) build(|_| Version::new(2).unwrap()): Version; } } +pub trait WeightInfo { + fn create_checkpoint() -> Weight; + fn set_schedules_max_complexity() -> Weight; + fn create_schedule(existing_schedules: u32) -> Weight; + fn remove_schedule(existing_schedules: u32) -> Weight; +} + decl_module! { pub struct Module for enum Call where origin: T::Origin { type Error = Error; fn deposit_event() = default; + fn on_runtime_upgrade() -> Weight { + storage_migrate_on!(StorageVersion::get(), 1, { + use polymesh_primitives::migrate::{migrate_map, Empty}; + use frame_support::migration::{StorageIterator, put_storage_value}; + + StorageIterator::::new(b"Checkpoint", b"ScheduleRemovable") + .drain() + .for_each(|(key, removable)| put_storage_value( + b"Checkpoint", b"ScheduleRefCount", &key, + if removable { 1 } else { 0 } + )); + + migrate_map::(b"Checkpoint", b"Schedules", |_| Empty); + }); + + storage_migrate_on!(StorageVersion::get(), 2, { + // We're making it into a double map due to a bug, nuke storage. + use polymesh_primitives::migrate::kill_item; + for item in &[ + b"TotalSupply" as &[_], + b"Balance" as &[_], + b"CheckpointIdSequence" as &[_], + b"BalanceUpdates" as &[_], + b"Timestamps" as &[_], + b"ScheduleIdSequence" as &[_], + b"Schedules" as &[_], + b"ScheduleRefCount" as &[_], + b"SchedulePoints" as &[_], + ] { + kill_item(b"Checkpoint", item); + } + }); + + 0 + } + /// Creates a single checkpoint at the current time. /// /// # Arguments @@ -190,7 +263,7 @@ decl_module! { /// # Errors /// - `Unauthorized` if the DID of `origin` doesn't own `ticker`. /// - `CheckpointOverflow` if the total checkpoint counter would overflow. - #[weight = T::DbWeight::get().reads_writes(3, 2) + 400_000_000] + #[weight = T::CPWeightInfo::create_checkpoint()] pub fn create_checkpoint(origin, ticker: Ticker) { let owner = >::ensure_perms_owner_asset(origin, &ticker)?.for_event(); Self::create_at_by(owner, ticker, Self::now_unix())?; @@ -205,7 +278,7 @@ decl_module! { /// # Arguments /// - `origin` is the root origin. /// - `max_complexity` allowed for an arbitrary ticker's schedule set. - #[weight = 1_000_000_000] + #[weight = T::CPWeightInfo::set_schedules_max_complexity()] pub fn set_schedules_max_complexity(origin, max_complexity: u64) { ensure_root(origin)?; SchedulesMaxComplexity::put(max_complexity); @@ -215,6 +288,8 @@ decl_module! { /// Creates a schedule generating checkpoints /// in the future at either a fixed time or at intervals. /// + /// The schedule starts out with `strong_ref_count(schedule_id) <- 0`. + /// /// # Arguments /// - `origin` is a signer that has permissions to act as owner of `ticker`. /// - `ticker` to create the schedule for. @@ -227,14 +302,17 @@ decl_module! { /// - `ScheduleOverflow` if the schedule ID counter would overflow. /// - `CheckpointOverflow` if the total checkpoint counter would overflow. /// - `FailedToComputeNextCheckpoint` if the next checkpoint for `schedule` is in the past. - #[weight = T::DbWeight::get().reads_writes(6, 2) + 1_000_000_000] + /// + /// # Permissions + /// * Asset + #[weight = T::CPWeightInfo::create_schedule(1)] pub fn create_schedule( origin, ticker: Ticker, schedule: ScheduleSpec, ) { let owner = >::ensure_perms_owner_asset(origin, &ticker)?.for_event(); - Self::create_schedule_base(owner, ticker, schedule, true)?; + Self::create_schedule_base(owner, ticker, schedule, 0)?; } /// Removes the checkpoint schedule of an asset identified by `id`. @@ -248,7 +326,10 @@ decl_module! { /// - `Unauthorized` if the caller doesn't own the asset. /// - `NoCheckpointSchedule` if `id` does not identify a schedule for this `ticker`. /// - `ScheduleNotRemovable` if `id` exists but is not removable. - #[weight = T::DbWeight::get().reads_writes(5, 2) + 400_000_000] + /// + /// # Permissions + /// * Asset + #[weight = T::CPWeightInfo::remove_schedule(1)] pub fn remove_schedule( origin, ticker: Ticker, @@ -257,16 +338,15 @@ decl_module! { let owner = >::ensure_perms_owner_asset(origin, &ticker)?; // If the ID matches and schedule is removable, it should be removed. - let schedule_id = (ticker, id); let schedule = Schedules::try_mutate(&ticker, |ss| { - ensure!(ScheduleRemovable::get(schedule_id), Error::::ScheduleNotRemovable); + ensure!(ScheduleRefCount::get(ticker, id) == 0, Error::::ScheduleNotRemovable); // By definiton of `id` existing, `.remove(pos)` won't panic. Self::ensure_schedule_exists(&ss, id).map(|pos| ss.remove(pos)) })?; // Remove some additional data. // We don't remove historical points related to the schedule. - ScheduleRemovable::remove(schedule_id); + ScheduleRefCount::remove(ticker, id); // Emit event. Self::deposit_event(RawEvent::ScheduleRemoved(owner, ticker, schedule)); @@ -309,7 +389,7 @@ decl_error! { ScheduleOverflow, /// A checkpoint schedule does not exist for the asset. NoSuchSchedule, - /// A checkpoint schedule is not removable. + /// A checkpoint schedule is not removable as `ref_count(schedule_id) > 0`. ScheduleNotRemovable, /// Failed to compute the next checkpoint. /// The schedule does not have any upcoming checkpoints. @@ -338,15 +418,14 @@ impl Module { /// N.B. in case of `None`, you likely want the current balance instead. /// To compute that, use `Asset::get_balance_at(ticker, did, cp)`, which calls into here. pub fn balance_at(ticker: Ticker, did: IdentityId, cp: CheckpointId) -> Option { - let ticker_did = (ticker, did); - if Self::checkpoint_exists(&ticker, cp) && BalanceUpdates::contains_key(&ticker_did) { + if Self::checkpoint_exists(&ticker, cp) && BalanceUpdates::contains_key(ticker, did) { // Checkpoint exists and user has some part in that. - let balance_updates = BalanceUpdates::get(&ticker_did); + let balance_updates = BalanceUpdates::get(ticker, did); if cp <= balance_updates.last().copied().unwrap_or(CheckpointId(0)) { // Use first checkpoint created after target checkpoint. // The user has data for that checkpoint. let id = *find_ceiling(&balance_updates, &cp); - return Some(Self::balance_at_checkpoint((ticker, did, id))); + return Some(Self::balance_at_checkpoint((ticker, id), did)); } // User has not transacted after checkpoint creation. // This means their current balance = their balance at that cp. @@ -376,10 +455,10 @@ impl Module { return; } for (did, balance) in updates { - let bal_key = (*ticker, did, last_cp); - if !>::contains_key(bal_key) { - >::insert(bal_key, balance); - BalanceUpdates::append((*ticker, did), last_cp); + let first_key = (ticker, last_cp); + if !>::contains_key(first_key, did) { + >::insert(first_key, did, balance); + BalanceUpdates::append(ticker, did, last_cp); } } } @@ -397,7 +476,7 @@ impl Module { return Ok(()); } - // Find the first schedule not due. All the schedule before `end` are due. + // Find the first schedule not due. All the schedules before `end` are due. let now = Self::now_unix(); let end = schedules .iter() @@ -412,23 +491,47 @@ impl Module { // Plan for CP creation for due schedules and rescheduling. let mut reschedule = Vec::new(); let mut create = Vec::with_capacity(end); // Lower bound; might add more. - for store in schedules.drain(..end) { - let schedule = store.schedule; - // If the schedule is recurring, we'll need to reschedule. - if let Some(at) = schedule.next_checkpoint(now) { - reschedule.push(StoredSchedule { at, ..store }); - } + for StoredSchedule { + schedule, + id, + at, + mut remaining, + } in schedules.drain(..end) + { + let infinite = remaining == 0; // Plan for all checkpoints for this schedule. + // // There might be more than one. // As an example, consider a checkpoint due every day, // and then there's a week without any transactions. + // + // Also consider schedules with a bounded number of CPs to make before being evicted. + // Here we limit the number of CPs to make, taking at most that many. create.extend( - iter::successors(Some(store.at), |&at| { - schedule.next_checkpoint(at).filter(|&at| at <= now) - }) - .map(|at| (at, store.id)), + iter::successors(Some(at), |&at| schedule.next_checkpoint(at)) + .take_while(|&at| at <= now) + .take_while(|_| { + infinite || { + let new = remaining.saturating_sub(1); + mem::replace(&mut remaining, new) > 0 + } + }) + .map(|at| (at, id)), ); + + // If the schedule is recurring, we'll need to reschedule. + // Non-`infinite` schedules with no `remaining` ticks are not rescheduled. + if infinite || remaining > 0 { + if let Some(at) = schedule.next_checkpoint(now) { + reschedule.push(StoredSchedule { + schedule, + id, + at, + remaining, + }); + } + } } // Ensure that ID count won't overflow. @@ -438,7 +541,7 @@ impl Module { // Create all checkpoints we planned for. for ((at, id), cp_id) in create.into_iter().zip(id_seq) { Self::create_at(None, *ticker, cp_id, at); - SchedulePoints::append((*ticker, id), cp_id); + SchedulePoints::append(ticker, id, cp_id); } // Reschedule schedules we need to. @@ -459,9 +562,13 @@ impl Module { did: EventDid, ticker: Ticker, schedule: ScheduleSpec, - removable: bool, + ref_count: u32, ) -> Result { - let ScheduleSpec { period, start } = schedule; + let ScheduleSpec { + period, + start, + mut remaining, + } = schedule; // Ensure the total complexity for all schedules is not too great. let schedules = Schedules::get(ticker); @@ -476,16 +583,25 @@ impl Module { let id = Self::next_schedule_id(&ticker)?; // If start is now, we'll create the first checkpoint immediately later at (1). + let infinite = remaining == 0; let now = Self::now_unix(); let start = start.unwrap_or(now); let cp_id = (start == now) - .then(|| Self::next_cp_ids(&ticker, 1).map(|(cp_id, _)| cp_id)) + .then(|| { + Self::next_cp_ids(&ticker, 1).map(|(cp_id, _)| { + // Decrement remaining, maintaining infinity -> infinity. + remaining = remaining.saturating_sub(1); + cp_id + }) + }) .transpose()?; // Compute the next timestamp, if needed. - // If the start isn't now or this schedule recurs, we'll need to schedule as done in (2). + // If the start isn't now or this schedule recurs, + // including having more CPs-to-generate remaining, + // we'll need to schedule as done in (2). let schedule = CheckpointSchedule { start, period }; - let future_at = (cp_id.is_none() || period.amount > 0) + let future_at = (cp_id.is_none() || (period.amount > 0 && (infinite || remaining != 0))) .then(|| { schedule .next_checkpoint(now) @@ -501,16 +617,20 @@ impl Module { // (1) Start is now, so create the checkpoint. if let Some(cp_id) = cp_id { CheckpointIdSequence::insert(ticker, cp_id); - SchedulePoints::append((ticker, id), cp_id); + SchedulePoints::append(ticker, id, cp_id); Self::create_at(Some(did), ticker, cp_id, now); } // (2) There will be some future checkpoint, so schedule it. let at = future_at.unwrap_or(now); - let schedule = StoredSchedule { at, id, schedule }; + let schedule = StoredSchedule { + at, + id, + schedule, + remaining, + }; if let Some(_) = future_at { - // Store removability + Sort schedule into the queue. - ScheduleRemovable::insert((ticker, id), removable); + // Sort schedule into the queue. Schedules::insert(&ticker, { let mut schedules = schedules; add_schedule(&mut schedules, schedule); @@ -518,6 +638,7 @@ impl Module { }) } + ScheduleRefCount::insert(ticker, id, ref_count); ScheduleIdSequence::insert(ticker, id); Self::deposit_event(RawEvent::ScheduleCreated(did, ticker, schedule)); Ok(schedule) @@ -546,10 +667,10 @@ impl Module { fn create_at(actor: Option, ticker: Ticker, id: CheckpointId, at: Moment) { // Record total supply at checkpoint ID. let supply = >::token_details(ticker).total_supply; - >::insert(&(ticker, id), supply); + >::insert(ticker, id, supply); - // Relate ID -> time. - Timestamps::insert(id, at); + // Relate Ticker -> ID -> time. + Timestamps::insert(ticker, id, at); // Emit event & we're done. Self::deposit_event(RawEvent::CheckpointCreated(actor, ticker, id, supply, at)); @@ -597,7 +718,10 @@ impl Module { /// Add `schedule` to `ss` in its sorted place, assuming `ss` is already sorted. fn add_schedule(ss: &mut Vec, schedule: StoredSchedule) { - let Ok(i) | Err(i) = ss.binary_search_by_key(&schedule.at, |s| s.at); + // `Ok(_)` is unreachable at runtime as adding a schedule with the same ID twice won't happen. + // However, we do this to simplify, as the comparison against IDs affords us sorting stability. + let Err(i) | Ok(i) = + ss.binary_search_by(|s| s.at.cmp(&schedule.at).then(s.id.cmp(&schedule.id))); ss.insert(i, schedule); } diff --git a/pallets/asset/src/lib.rs b/pallets/asset/src/lib.rs index 6c292722a0..80080f01a7 100644 --- a/pallets/asset/src/lib.rs +++ b/pallets/asset/src/lib.rs @@ -76,6 +76,7 @@ //! - `get_balance_at` - It provides the balance of a DID at a certain checkpoint. //! - `verify_restriction` - It is use to verify the restriction implied by the smart extension and the Compliance Manager. //! - `call_extension` - A helper function that is used to call the smart extension function. + #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] #![feature(bool_to_option, or_patterns, const_option)] @@ -103,19 +104,20 @@ use pallet_contracts::{ExecResult, Gas}; use pallet_identity::{self as identity, PermissionedCallOriginData}; use pallet_statistics::Counter; use polymesh_common_utilities::{ - asset::{AssetName, AssetSubTrait, AssetType, FundingRoundName, Trait as AssetTrait}, + asset::{AssetFnTrait, AssetSubTrait}, balances::Trait as BalancesTrait, compliance_manager::Trait as ComplianceManagerTrait, constants::*, - identity::Trait as IdentityTrait, protocol_fee::{ChargeProtocolFee, ProtocolOp}, with_transaction, CommonTrait, Context, SystematicIssuers, }; use polymesh_primitives::{ - calendar::CheckpointId, migrate::MigrationError, storage_migrate_on, storage_migration_ver, - AssetIdentifier, AuthorizationData, Document, DocumentId, IdentityId, - MetaVersion as ExtVersion, PortfolioId, ScopeId, SecondaryKey, Signatory, SmartExtension, - SmartExtensionName, SmartExtensionType, Ticker, + asset::{AssetName, AssetType, FundingRoundName}, + calendar::CheckpointId, + migrate::MigrationError, + storage_migrate_on, storage_migration_ver, AssetIdentifier, AuthorizationData, Document, + DocumentId, IdentityId, MetaVersion as ExtVersion, PortfolioId, ScopeId, SecondaryKey, + Signatory, SmartExtension, SmartExtensionName, SmartExtensionType, Ticker, }; use sp_runtime::traits::{CheckedAdd, Saturating, Zero}; #[cfg(feature = "std")] @@ -149,13 +151,12 @@ pub trait WeightInfo { fn archive_extension() -> Weight; fn unarchive_extension() -> Weight; fn accept_primary_issuance_agent_transfer() -> Weight; + fn controller_transfer() -> Weight; } /// The module's configuration trait. pub trait Trait: - frame_system::Trait - + BalancesTrait - + IdentityTrait + BalancesTrait + pallet_session::Trait + pallet_statistics::Trait + polymesh_contracts::Trait @@ -184,10 +185,13 @@ pub trait Trait: /// Max length of the funding round name. type FundingRoundNameMaxLength: Get; + type AssetFn: AssetFnTrait; + /// Maximum gas used for smart extension execution. type AllowedGasLimit: Get; type WeightInfo: WeightInfo; + type CPWeightInfo: checkpoint::WeightInfo; } /// Ownership status of a ticker/token. @@ -424,6 +428,9 @@ decl_module! { /// # Arguments /// * `origin` It contains the secondary key of the caller (i.e who signed the transaction to execute this function). /// * `ticker` ticker to register. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::register_ticker()] pub fn register_ticker(origin, ticker: Ticker) { let to_did = Identity::::ensure_perms(origin)?; @@ -482,8 +489,8 @@ decl_module! { /// * `identifiers` - a vector of asset identifiers. /// * `funding_round` - name of the funding round. /// - /// # Weight - /// `3_000_000_000 + 20_000 * identifiers.len()` + /// # Permissions + /// * Portfolio #[weight = ::WeightInfo::create_asset( name.len() as u32, identifiers.len() as u32, @@ -607,6 +614,9 @@ decl_module! { /// # Arguments /// * `origin` - the secondary key of the sender. /// * `ticker` - the ticker of the token. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::freeze()] pub fn freeze(origin, ticker: Ticker) { // Verify the ownership of the token @@ -622,6 +632,9 @@ decl_module! { /// # Arguments /// * `origin` - the secondary key of the sender. /// * `ticker` - the ticker of the frozen token. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::unfreeze()] pub fn unfreeze(origin, ticker: Ticker) { // Verify the ownership of the token @@ -638,6 +651,9 @@ decl_module! { /// * `origin` - the secondary key of the sender. /// * `ticker` - the ticker of the token. /// * `name` - the new name of the token. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::rename_asset(ticker.len() as u32)] pub fn rename_asset(origin, ticker: Ticker, name: AssetName) { ensure!(name.len() <= T::AssetNameMaxLength::get(), Error::::MaxLengthOfAssetNameExceeded); @@ -656,6 +672,10 @@ decl_module! { /// * `origin` Secondary key of token owner. /// * `ticker` Ticker of the token. /// * `value` Amount of tokens that get issued. + /// + /// # Permissions + /// * Asset + /// * Portfolio #[weight = ::WeightInfo::issue()] pub fn issue(origin, ticker: Ticker, value: T::Balance) -> DispatchResult { // Ensure origin is PIA with custody and permissions for default portfolio. @@ -679,6 +699,10 @@ decl_module! { /// - `Unauthorized` If called by someone other than the token owner or the PIA /// - `InvalidGranularity` If the amount is not divisible by 10^6 for non-divisible tokens /// - `InsufficientPortfolioBalance` If the PIA's default portfolio doesn't have enough free balance + /// + /// # Permissions + /// * Asset + /// * Portfolio #[weight = ::WeightInfo::redeem()] pub fn redeem(origin, ticker: Ticker, value: T::Balance) { // Ensure origin is PIA with custody and permissions for default portfolio. @@ -734,6 +758,9 @@ decl_module! { /// # Arguments /// * `origin` Secondary key of the token owner. /// * `ticker` Ticker of the token. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::make_divisible()] pub fn make_divisible(origin, ticker: Ticker) { let did = Self::ensure_perms_owner_asset(origin, &ticker)?; @@ -752,8 +779,8 @@ decl_module! { /// * `ticker` Ticker of the token. /// * `docs` Documents to be attached to `ticker`. /// - /// # Weight - /// `500_000_000 + 600_000 * docs.len()` + /// # Permissions + /// * Asset #[weight = ::WeightInfo::add_documents(docs.len() as u32)] pub fn add_documents(origin, docs: Vec, ticker: Ticker) { let did = Self::ensure_perms_owner_asset(origin, &ticker)?; @@ -776,8 +803,8 @@ decl_module! { /// * `ticker` Ticker of the token. /// * `ids` Documents ids to be removed from `ticker`. /// - /// # Weight - /// `500_000_000 + 600_000 * ids.len()` + /// # Permissions + /// * Asset #[weight = ::WeightInfo::remove_documents(ids.len() as u32)] pub fn remove_documents(origin, ids: Vec, ticker: Ticker) { let did = Self::ensure_perms_owner_asset(origin, &ticker)?; @@ -793,6 +820,9 @@ decl_module! { /// * `origin` - the secondary key of the token owner DID. /// * `ticker` - the ticker of the token. /// * `name` - the desired name of the current funding round. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::set_funding_round( name.len() as u32 )] pub fn set_funding_round(origin, ticker: Ticker, name: FundingRoundName) { ensure!(name.len() <= T::FundingRoundNameMaxLength::get(), Error::::FundingRoundNameMaxLengthExceeded); @@ -810,8 +840,8 @@ decl_module! { /// * `identifiers` - the asset identifiers to be updated in the form of a vector of pairs /// of `IdentifierType` and `AssetIdentifier` value. /// - /// # Weight - /// `150_000 + 20_000 * identifiers.len()` + /// # Permissions + /// * Asset #[weight = ::WeightInfo::update_identifiers( identifiers.len() as u32)] pub fn update_identifiers( origin, @@ -834,6 +864,9 @@ decl_module! { /// * `origin` - Signatory who owns to ticker/asset. /// * `ticker` - ticker for whom extension get added. /// * `extension_details` - Details of the smart extension. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::add_extension()] pub fn add_extension(origin, ticker: Ticker, extension_details: SmartExtension) { let my_did = Self::ensure_perms_owner_asset(origin, &ticker)?; @@ -857,6 +890,9 @@ decl_module! { /// * `origin` - Signatory who owns the ticker/asset. /// * `ticker` - Ticker symbol of the asset. /// * `extension_id` - AccountId of the extension that need to be archived. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::archive_extension()] pub fn archive_extension(origin, ticker: Ticker, extension_id: T::AccountId) { // Ensure the extrinsic is signed and have valid extension id. @@ -874,6 +910,9 @@ decl_module! { /// * `origin` - Signatory who owns the ticker/asset. /// * `ticker` - Ticker symbol of the asset. /// * `extension_id` - AccountId of the extension that need to be un-archived. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::unarchive_extension()] pub fn unarchive_extension(origin, ticker: Ticker, extension_id: T::AccountId) { // Ensure the extrinsic is signed and have valid extension id. @@ -891,6 +930,9 @@ decl_module! { /// # Arguments /// * `origin` - The asset issuer. /// * `ticker` - Ticker symbol of the asset. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::remove_primary_issuance_agent()] pub fn remove_primary_issuance_agent( origin, @@ -906,6 +948,9 @@ decl_module! { /// # Arguments /// * `origin` - The asset issuer. /// * `ticker` - Ticker symbol of the asset. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::remove_smart_extension()] pub fn remove_smart_extension(origin, ticker: Ticker, extension_id: T::AccountId) { // Ensure the extrinsic is signed and have valid extension id. @@ -1012,6 +1057,29 @@ decl_module! { }; ClassicTickers::insert(&classic_ticker_import.ticker, classic_ticker); } + + /// Forces a transfer of token from `from_portfolio` to the PIA's default portfolio. + /// Only PIA is allowed to execute this. + /// + /// # Arguments + /// * `origin` Must be a PIA for a given ticker. + /// * `ticker` Ticker symbol of the asset. + /// * `value` Amount of tokens need to force transfer. + /// * `from_portfolio` From whom portfolio tokens gets transferred. + #[weight = ::WeightInfo::controller_transfer()] + pub fn controller_transfer(origin, ticker: Ticker, value: T::Balance, from_portfolio: PortfolioId) { + // Ensure that `origin` is the PIA or the token owner. + let pia = Self::ensure_pia_with_custody_and_permissions(origin, ticker)?.primary_did; + + // Transfer `value` of ticker tokens from `investor_did` to controller + Self::unsafe_transfer( + from_portfolio, + PortfolioId::default_portfolio(pia), + &ticker, + value, + )?; + Self::deposit_event(RawEvent::ControllerTransfer(pia, ticker, from_portfolio, value)); + } } } @@ -1031,9 +1099,6 @@ decl_event! { /// Emit when tokens get redeemed. /// caller DID, ticker, from DID, value Redeemed(IdentityId, Ticker, IdentityId, Balance), - /// Event for when a forced redemption takes place. - /// caller DID/ controller DID, ticker, token holder DID, value, data, operator data - ControllerRedemption(IdentityId, Ticker, IdentityId, Balance, Vec, Vec), /// Event for creation of the asset. /// caller DID/ owner DID, ticker, total supply, divisibility, asset type, beneficiary DID AssetCreated(IdentityId, Ticker, Balance, bool, AssetType, IdentityId), @@ -1093,6 +1158,9 @@ decl_event! { ClassicTickerClaimed(IdentityId, Ticker, ethereum::EthereumAddress), /// Migration error event. MigrationFailure(MigrationError), + /// Event for when a forced transfer takes place. + /// caller DID/ controller DID, ticker, Portfolio of token holder, value. + ControllerTransfer(IdentityId, Ticker, PortfolioId, Balance), } } @@ -1136,8 +1204,6 @@ decl_error! { TotalSupplyOverflow, /// An invalid granularity. InvalidGranularity, - /// The account does not hold this token. - NotAnAssetHolder, /// The asset must be frozen. NotFrozen, /// No such smart extension. @@ -1171,16 +1237,7 @@ decl_error! { } } -impl AssetTrait for Module { - fn _mint_from_sto( - ticker: &Ticker, - caller: T::AccountId, - sender: IdentityId, - assets_purchased: T::Balance, - ) -> DispatchResult { - Self::_mint(ticker, caller, sender, assets_purchased, None) - } - +impl AssetFnTrait for Module { fn is_owner(ticker: &Ticker, did: IdentityId) -> bool { Self::_is_owner(ticker, did) } @@ -1245,6 +1302,31 @@ impl AssetTrait for Module { funding_round, ) } + + #[inline] + fn register_ticker(origin: T::Origin, ticker: Ticker) -> DispatchResult { + Self::register_ticker(origin, ticker) + } + + #[cfg(feature = "runtime-benchmarks")] + /// Adds an artificial IU claim for benchmarks + fn add_investor_uniqueness_claim(did: IdentityId, ticker: Ticker) { + use polymesh_primitives::{CddId, Claim, InvestorUid, Scope}; + Identity::::base_add_claim( + did, + Claim::InvestorUniqueness( + Scope::Ticker(ticker), + did, + CddId::new(did, InvestorUid::from(did.to_bytes())), + ), + did, + None, + ); + let current_balance = Self::balance_of(ticker, did); + >::insert(ticker, &did, current_balance); + >::insert(did, did, current_balance); + ::insert(ticker, did, did); + } } impl AssetSubTrait for Module { @@ -1594,10 +1676,6 @@ impl Module { ) -> DispatchResult { Self::ensure_granular(ticker, value)?; - ensure!( - >::contains_key(ticker, &from_portfolio.did), - Error::::NotAnAssetHolder - ); ensure!( from_portfolio.did != to_portfolio.did, Error::::SenderSameAsReceiver @@ -1805,7 +1883,7 @@ impl Module { /// Is `value` a multiple of "one unit"? fn is_unit_multiple(value: T::Balance) -> bool { - value % ONE_UNIT.into() == 0.into() + value % ONE_UNIT.into() == 0u32.into() } /// Accept and process a ticker transfer. @@ -1861,27 +1939,6 @@ impl Module { Ok(()) } - /// Forces a transfer between two DIDs. - pub fn controller_transfer( - origin: T::Origin, - ticker: Ticker, - value: T::Balance, - investor_portfolio_id: PortfolioId, - ) -> DispatchResult { - let pia = Identity::::ensure_perms(origin)?; - // Ensure that `origin` is the PIA or the token owner. - Self::ensure_pia(&ticker, pia)?; - - // transfer `value` of ticker tokens from `investor_did` to controller - Self::unsafe_transfer( - investor_portfolio_id, - PortfolioId::default_portfolio(pia), - &ticker, - value, - )?; - Ok(()) - } - /// Accept and process a token ownership transfer. pub fn _accept_token_ownership_transfer(to_did: IdentityId, auth_id: u64) -> DispatchResult { let auth = >::ensure_authorization(&to_did.into(), auth_id)?; @@ -1929,7 +1986,7 @@ impl Module { let selector = hex!("D1140AC9"); let balance = |did| { T::Balance::encode(&match did { - None => 0.into(), + None => 0u32.into(), Some(did) => { let scope_id = Self::scope_id_of(ticker, &did); // Using aggregate balance instead of individual identity balance. @@ -2002,7 +2059,7 @@ impl Module { gas_limit: Gas, data: Vec, ) -> (ExecResult, Gas) { - >::bare_call(from, dest, 0.into(), gas_limit, data) + >::bare_call(from, dest, 0u32.into(), gas_limit, data) } /// RPC: Function allows external users to know wether the transfer extrinsic diff --git a/pallets/balances/Cargo.toml b/pallets/balances/Cargo.toml index 044881621e..9afce6df2b 100644 --- a/pallets/balances/Cargo.toml +++ b/pallets/balances/Cargo.toml @@ -9,29 +9,28 @@ pallet-permissions = { path = "../permissions", default-features = false } pallet-transaction-payment = { path = "../transaction-payment", default-features = false } polymesh-common-utilities = { path = "../common", default-features = false } polymesh-primitives = { path = "../../primitives", default-features = false } -polymesh-primitives-derive = { path = "../../primitives_derive", default-features = false } serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false} codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Only for test in STD -substrate-test-runtime-client = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true} +substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true} # Benchmarking -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0", optional = true } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1", optional = true } [features] equalize = [] diff --git a/pallets/balances/src/benchmarking.rs b/pallets/balances/src/benchmarking.rs index ec6fc992f7..911228402b 100644 --- a/pallets/balances/src/benchmarking.rs +++ b/pallets/balances/src/benchmarking.rs @@ -17,14 +17,11 @@ //! Balances pallet benchmarking. -#![cfg(feature = "runtime-benchmarks")] - use super::*; use crate::Module as Balances; -use polymesh_common_utilities::benchs::UserBuilder; - use frame_benchmarking::benchmarks; use frame_system::RawOrigin; +use polymesh_common_utilities::benchs::UserBuilder; fn make_worst_memo() -> Option { Some(Memo([7u8; 32])) @@ -36,40 +33,40 @@ benchmarks! { // Benchmark `transfer` extrinsic with the worst possible conditions: // * Transfer will create the recipient account. transfer { - let amount = T::Balance::from(500); - let caller = UserBuilder::::default().balance(1200).generate_did().build("caller"); - let recipient = UserBuilder::::default().balance(0).generate_did().build( "recipient"); + let amount = T::Balance::from(500u32); + let caller = UserBuilder::::default().balance(1200u32).generate_did().build("caller"); + let recipient = UserBuilder::::default().balance(0u32).generate_did().build( "recipient"); }: _(caller.origin(), recipient.lookup(), amount) verify { - assert_eq!(Balances::::free_balance(&caller.account), (1200-500).into()); + assert_eq!(Balances::::free_balance(&caller.account), (1200u32-500).into()); assert_eq!(Balances::::free_balance(&recipient.account), amount); } transfer_with_memo { - let caller = UserBuilder::::default().balance(1000).generate_did().build("caller"); - let recipient = UserBuilder::::default().balance(0).generate_did().build("recipient"); - let amount = 42.into(); + let caller = UserBuilder::::default().balance(1000u32).generate_did().build("caller"); + let recipient = UserBuilder::::default().balance(0u32).generate_did().build("recipient"); + let amount = 42u32.into(); let memo = make_worst_memo(); }: _(caller.origin(), recipient.lookup(), amount, memo) verify { - assert_eq!(Balances::::free_balance(&caller.account), (1000-42).into()); + assert_eq!(Balances::::free_balance(&caller.account), (1000u32-42).into()); assert_eq!(Balances::::free_balance(&recipient.account), amount); } deposit_block_reward_reserve_balance { - let caller = UserBuilder::::default().balance(1000).generate_did().build("caller"); - let amount = 500.into(); + let caller = UserBuilder::::default().balance(1000u32).generate_did().build("caller"); + let amount = 500u32.into(); }: _(caller.origin(), amount) verify { - assert_eq!(Balances::::free_balance(&caller.account), (1000-500).into()); + assert_eq!(Balances::::free_balance(&caller.account), (1000u32-500).into()); assert_eq!(Balances::::block_rewards_reserve_balance(), amount); } set_balance { - let caller = UserBuilder::::default().balance(1000).generate_did().build("caller"); - let free_balance :T::Balance = 1_000_000.into(); - let reserved_balance :T::Balance = 100.into(); + let caller = UserBuilder::::default().balance(1000u32).generate_did().build("caller"); + let free_balance :T::Balance = 1_000_000u32.into(); + let reserved_balance :T::Balance = 100u32.into(); }: _(RawOrigin::Root, caller.lookup(), free_balance.clone(), reserved_balance) verify { assert_eq!(Balances::::free_balance(&caller.account), free_balance); @@ -77,20 +74,20 @@ benchmarks! { } force_transfer { - let source = UserBuilder::::default().balance(1000).generate_did().build("source"); - let dest = UserBuilder::::default().balance(1).generate_did().build("dest"); - let amount = 500.into(); + let source = UserBuilder::::default().balance(1000u32).generate_did().build("source"); + let dest = UserBuilder::::default().balance(1u32).generate_did().build("dest"); + let amount = 500u32.into(); }: _(RawOrigin::Root, source.lookup(), dest.lookup(), amount) verify { - assert_eq!(Balances::::free_balance(&source.account), (1000-500).into()); - assert_eq!(Balances::::free_balance(&dest.account), (1+500).into()); + assert_eq!(Balances::::free_balance(&source.account), (1000u32-500).into()); + assert_eq!(Balances::::free_balance(&dest.account), (1u32+500).into()); } burn_account_balance { - let caller = UserBuilder::::default().balance(1000).generate_did().build("caller"); - let amount = 500.into(); + let caller = UserBuilder::::default().balance(1000u32).generate_did().build("caller"); + let amount = 500u32.into(); }: _(caller.origin(), amount) verify { - assert_eq!(Balances::::free_balance(&caller.account), (1000-500).into()); + assert_eq!(Balances::::free_balance(&caller.account), (1000u32-500).into()); } } diff --git a/pallets/balances/src/lib.rs b/pallets/balances/src/lib.rs index 91a7d62d3f..022adaaa50 100644 --- a/pallets/balances/src/lib.rs +++ b/pallets/balances/src/lib.rs @@ -267,7 +267,7 @@ decl_module! { // Polymesh modified code. Existential Deposit requirements are zero in Polymesh. /// This is no longer needed but kept for compatibility reasons /// The minimum amount required to keep an account open. - const ExistentialDeposit: T::Balance = 0.into(); + const ExistentialDeposit: T::Balance = 0u32.into(); fn deposit_event() = default; diff --git a/pallets/bridge/Cargo.toml b/pallets/bridge/Cargo.toml index b61f9682a9..a407553382 100644 --- a/pallets/bridge/Cargo.toml +++ b/pallets/bridge/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [dependencies] polymesh-common-utilities = { path = "../common", default-features = false } polymesh-primitives = { path = "../../primitives", default-features = false } -polymesh-primitives-derive = { path = "../../primitives_derive", default-features = false } pallet-balances = { path = "../balances", default-features = false } pallet-identity = { path = "../identity", default-features = false } @@ -15,14 +14,14 @@ pallet-multisig = { path = "../multisig", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-scheduler = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-scheduler = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } # Other serde = { version = "1.0.104", default-features = false } @@ -30,7 +29,7 @@ serde = { version = "1.0.104", default-features = false } [features] equalize = [] only-staking = [] -default = ["std", "equalize", "runtime-benchmarks"] +default = ["std", "equalize"] no_std = [] std = [ "frame-benchmarking/std", diff --git a/pallets/committee/Cargo.toml b/pallets/committee/Cargo.toml index a766d2e392..6822b1e6b0 100644 --- a/pallets/committee/Cargo.toml +++ b/pallets/committee/Cargo.toml @@ -16,18 +16,18 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0", optional = true } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1", optional = true } [features] equalize = [] diff --git a/pallets/committee/src/benchmarking.rs b/pallets/committee/src/benchmarking.rs new file mode 100644 index 0000000000..56d2b011c8 --- /dev/null +++ b/pallets/committee/src/benchmarking.rs @@ -0,0 +1,225 @@ +// This file is part of the Polymesh distribution (https://github.com/PolymathNetwork/Polymesh). +// Copyright (c) 2020 Polymath + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3. + +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::*; +use frame_benchmarking::benchmarks_instance; +use frame_support::{ + dispatch::DispatchResult, + traits::{ChangeMembers, UnfilteredDispatchable}, + StorageValue, +}; +use polymesh_common_utilities::{ + benchs::{user, User}, + MaybeBlock, +}; +use sp_std::prelude::*; + +const PROPOSAL_PADDING_WORDS: usize = 1_000; +// The number of the proposal that has ceil(1/2)-1 aye votes after make_proposals_and_vote. One more +// aye vote leads to acceptance of that proposal. +const PROPOSAL_ALMOST_APPROVED: u32 = COMMITTEE_MEMBERS_MAX - 3; + +fn make_proposal(n: u32) -> (>::Proposal, ::Hash) +where + I: Instance, + T: Trait, +{ + let bytes: [u8; 4] = n.to_be_bytes(); + let padding = bytes.repeat(PROPOSAL_PADDING_WORDS); + let proposal: >::Proposal = frame_system::Call::::remark(padding).into(); + let hash = ::Hashing::hash_of(&proposal); + (proposal, hash) +} + +fn make_proposals_and_vote(users: &[User]) -> DispatchResult +where + I: Instance, + T: Trait, +{ + ensure!( + users.len() > 0, + "make_proposals_and_vote requires non-empty users" + ); + for i in 0..PROPOSALS_MAX { + let index = Module::::proposal_count(); + let proposal = make_proposal::(i).0; + identity::CurrentDid::put(users[0].did()); + Module::::vote_or_propose(users[0].origin.clone().into(), true, Box::new(proposal))?; + if users.len() > 1 { + let hash = *Module::::proposals() + .last() + .ok_or("missing last proposal")?; + // cast min(user.len(), N) - 1 additional votes for proposal #N + // alternating nay, aye, nay, aye... + for (j, user) in users.iter().skip(1).take(i as usize).enumerate() { + // Vote for the proposal if it's not finalised. + if Module::::voting(&hash).is_some() { + identity::CurrentDid::put(user.did()); + Module::::vote(user.origin.clone().into(), hash, index, j % 2 != 0)?; + } + } + } + } + Ok(()) +} + +fn make_members_and_proposals() -> Result>, DispatchError> +where + I: Instance, + T: Trait, +{ + let members: Vec<_> = (0..COMMITTEE_MEMBERS_MAX) + .map(|i| user::("member", i)) + .collect(); + let mut dids: Vec<_> = members.iter().map(|m| m.did()).collect(); + dids.sort(); + Module::::change_members_sorted(&dids, &[], &dids); + make_proposals_and_vote::(&members)?; + Ok(members) +} + +fn vote_verify( + did: &IdentityId, + hash: ::Hash, + proposal_num: u32, + vote: bool, +) -> DispatchResult +where + I: Instance, + T: Trait, +{ + if COMMITTEE_MEMBERS_MAX > 4 || (COMMITTEE_MEMBERS_MAX == 4 && !vote) { + // The proposal is not finalised because there is no quorum yet. + let votes = Voting::::get(&hash).ok_or("cannot get votes")?; + ensure!(votes.index == proposal_num, "wrong proposal_num"); + ensure!(vote == votes.ayes.contains(did), "aye vote missing"); + ensure!(vote != votes.nays.contains(did), "nay vote missing"); + } else { + // The proposal is finalised and removed from storage. + // TODO: pattern-match an event emitted during proposal finalisation. + ensure!( + !Voting::::contains_key(&hash), + "executed proposal is not removed" + ); + } + Ok(()) +} + +benchmarks_instance! { + _ {} + + set_vote_threshold { + let n = 1; + let d = 2; + let origin = T::CommitteeOrigin::successful_origin(); + let call = Call::::set_vote_threshold(n, d); + }: { + call.dispatch_bypass_filter(origin)?; + } + verify { + ensure!(Module::::vote_threshold() == (n, d), "incorrect vote threshold"); + } + + set_release_coordinator { + let mut dids: Vec<_> = (0..COMMITTEE_MEMBERS_MAX) + .map(|i| user::("member", i).did()) + .collect(); + dids.sort(); + let coordinator = dids.last().unwrap().clone(); + Module::::change_members_sorted(&dids, &[], &dids); + let origin = T::CommitteeOrigin::successful_origin(); + let call = Call::::set_release_coordinator(coordinator); + }: { + call.dispatch_bypass_filter(origin)?; + } + verify { + ensure!( + Module::::release_coordinator() == Some(coordinator), + "incorrect release coordinator" + ); + } + + set_expires_after { + let maybe_block = MaybeBlock::Some(1u32.into()); + let origin = T::CommitteeOrigin::successful_origin(); + let call = Call::::set_expires_after(maybe_block); + }: { + call.dispatch_bypass_filter(origin)?; + } + verify { + ensure!(Module::::expires_after() == maybe_block, "incorrect expiration"); + } + + vote_or_propose_new_proposal { + let members = make_members_and_proposals::()?; + let last_proposal_num = ProposalCount::::get(); + let (proposal, hash) = make_proposal::(PROPOSALS_MAX); + identity::CurrentDid::put(members[0].did()); + }: vote_or_propose(members[0].origin.clone(), true, Box::new(proposal.clone())) + verify { + // The proposal was stored. + ensure!(Proposals::::get().contains(&hash), "new proposal hash not found"); + ensure!(ProposalOf::::get(&hash) == Some(proposal), "new proposal not found"); + } + + vote_or_propose_existing_proposal { + let members = make_members_and_proposals::()?; + let (proposal, hash) = make_proposal::(0); + let proposals = Proposals::::get(); + ensure!(proposals.contains(&hash), "cannot find the first proposal"); + identity::CurrentDid::put(members[1].did()); + let member1 = members[1].origin.clone(); + let boxed_proposal = Box::new(proposal.clone()); + }: vote_or_propose(member1, true, boxed_proposal) + verify { + if COMMITTEE_MEMBERS_MAX <= 4 { + // Proposal was executed. + ensure!( + Module::::voting(&hash).is_none(), + "votes are present on an executed existing proposal" + ); + } else { + // The proposal was stored. + ensure!(Proposals::::get().contains(&hash), "existing proposal hash not found"); + ensure!(ProposalOf::::get(&hash) == Some(proposal), "existing proposal not found"); + } + } + + vote_aye { + let members = make_members_and_proposals::()?; + let hash = make_proposal::(PROPOSAL_ALMOST_APPROVED).1; + ensure!(Proposals::::get().contains(&hash), "vote_aye target proposal not found"); + let member = &members[PROPOSAL_ALMOST_APPROVED as usize + 1]; + let origin = member.origin.clone(); + let did = member.did(); + identity::CurrentDid::put(did); + }: vote(origin, hash, PROPOSAL_ALMOST_APPROVED, true) + verify { + ensure!(!Proposals::::get().contains(&hash), "vote_aye target proposal not executed"); + } + + vote_nay { + let members = make_members_and_proposals::()?; + let first_proposal_num = 0; + let hash = make_proposal::(first_proposal_num).1; + let member = &members[1]; + let origin = member.origin.clone(); + let did = member.did(); + identity::CurrentDid::put(did); + }: vote(origin, hash, first_proposal_num, false) + verify { + vote_verify::(&did, hash, first_proposal_num, false)?; + } +} diff --git a/pallets/committee/src/lib.rs b/pallets/committee/src/lib.rs index d3497aee60..26a469129a 100644 --- a/pallets/committee/src/lib.rs +++ b/pallets/committee/src/lib.rs @@ -21,7 +21,6 @@ // -`set_members()` dispatchable get removed and members are maintained by the group module // - New instance of the group module is being added and assigned committee instance to // `MembershipInitialized` & `MembershipChanged` trait -// - If MotionDuration > 0 then only the `close()` dispatchable will be used. //! # Committee Module //! @@ -55,15 +54,20 @@ //! `false` otherwise. #![cfg_attr(not(feature = "std"), no_std)] +#![feature(const_option)] +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarking; + +use core::marker::PhantomData; use core::mem; use frame_support::{ codec::{Decode, Encode}, decl_error, decl_event, decl_module, decl_storage, dispatch::{DispatchError, DispatchResult, Dispatchable, Parameter}, ensure, - traits::{ChangeMembers, EnsureOrigin, Get, InitializeMembers}, - weights::{DispatchClass::Operational, GetDispatchInfo, Pays}, + traits::{ChangeMembers, EnsureOrigin, InitializeMembers}, + weights::{GetDispatchInfo, Weight}, }; use frame_system::{self as system}; use pallet_identity as identity; @@ -73,11 +77,32 @@ use polymesh_common_utilities::{ identity::{IdentityFnTrait, Trait as IdentityModuleTrait}, Context, MaybeBlock, SystematicIssuers, GC_DID, }; -use polymesh_primitives::IdentityId; -use sp_core::u32_trait::Value as U32; -use sp_runtime::traits::{Hash, Zero}; +use polymesh_primitives::{storage_migration_ver, IdentityId}; +use sp_runtime::traits::Hash; use sp_std::{prelude::*, vec}; +/// The maximum number of members in a committee defined for the sake of weight computation. This +/// is not defined as a trait parameter but rather as a plain constant because this value has to be +/// the same for all instances. +// TODO: ensure this bound when adding members. +pub const COMMITTEE_MEMBERS_MAX: u32 = 500; + +/// The maximum number of concurrently active proposals defined for the sake of weight computation. +/// This is not defined as a trait parameter but rather as a plain constant because this value has +/// to be the same for all instances. +// TODO: ensure this bound when adding proposals. +pub const PROPOSALS_MAX: u32 = 500; + +pub trait WeightInfo { + fn set_vote_threshold() -> Weight; + fn set_release_coordinator() -> Weight; + fn set_expires_after() -> Weight; + fn vote_or_propose_new_proposal() -> Weight; + fn vote_or_propose_existing_proposal() -> Weight; + fn vote_aye() -> Weight; + fn vote_nay() -> Weight; +} + /// Simple index type for proposal counting. pub type ProposalIndex = u32; @@ -87,25 +112,30 @@ pub trait Trait: frame_system::Trait + IdentityModuleTrait { type Origin: From::AccountId, I>>; /// The outer call dispatch type. - type Proposal: Parameter + Dispatchable>::Origin> + GetDispatchInfo; + type Proposal: Parameter + + Dispatchable>::Origin> + + GetDispatchInfo + + From>; /// Required origin for changing behaviour of this module. type CommitteeOrigin: EnsureOrigin<::Origin>; + /// Required origin for changing the voting threshold. + type VoteThresholdOrigin: EnsureOrigin<::Origin>; + /// The outer event type. type Event: From> + Into<::Event>; - /// The time-out for council motions. - type MotionDuration: Get; + /// Weight computation. + type WeightInfo: WeightInfo; } /// Origin for the committee module. #[derive(PartialEq, Eq, Clone, Debug, Encode, Decode)] pub enum RawOrigin { - /// It has been condoned by M of N members of this committee. - Members(MemberCount, MemberCount), - /// Dummy to manage the fact we have instancing. - _Phantom(sp_std::marker::PhantomData<(AccountId, I)>), + /// It has been condoned by M of N members of this committee + /// with `M` and `N` set dynamically in `set_vote_threshold`. + Endorsed(PhantomData<(AccountId, I)>), } /// Origin for the committee module. @@ -113,19 +143,57 @@ pub type Origin = RawOrigin<::Accoun #[derive(PartialEq, Eq, Clone, Encode, Decode, Debug)] /// Info for keeping track of a motion being voted on. -pub struct PolymeshVotes { +pub struct PolymeshVotes { /// The proposal's unique index. pub index: ProposalIndex, /// The current set of committee members that approved it. pub ayes: Vec, /// The current set of committee members that rejected it. pub nays: Vec, - /// The hard end time of this vote. - pub end: BlockNumber, /// The time **at** which the proposal is expired. pub expiry: MaybeBlock, } +mod migrate { + use super::*; + use polymesh_primitives::migrate::{Empty, Migrate}; + #[derive(PartialEq, Eq, Clone, Encode, Decode, Debug)] + /// Info for keeping track of a motion being voted on. + pub struct PolymeshVotesOld { + /// The proposal's unique index. + pub index: ProposalIndex, + /// The current set of committee members that approved it. + pub ayes: Vec, + /// The current set of committee members that rejected it. + pub nays: Vec, + /// The hard end time of this vote. + pub end: BlockNumber, + /// The time **at** which the proposal is expired. + pub expiry: MaybeBlock, + } + impl Migrate for PolymeshVotesOld { + type Context = Empty; + type Into = PolymeshVotes; + fn migrate(self, _: Self::Context) -> Option { + let Self { + index, + ayes, + nays, + end: _, + expiry, + } = self; + Some(Self::Into { + index, + ayes, + nays, + expiry, + }) + } + } +} + +storage_migration_ver!(1); + decl_storage! { trait Store for Module, I: Instance=DefaultInstance> as Committee { /// The hashes of the active proposals. @@ -133,7 +201,7 @@ decl_storage! { /// Actual proposal for a given hash. pub ProposalOf get(fn proposal_of): map hasher(twox_64_concat) T::Hash => Option<>::Proposal>; /// PolymeshVotes on a given proposal, if it is ongoing. - pub Voting get(fn voting): map hasher(twox_64_concat) T::Hash => Option>; + pub Voting get(fn voting): map hasher(twox_64_concat) T::Hash => Option>; /// Proposals so far. pub ProposalCount get(fn proposal_count): u32; /// The current members of the committee. @@ -144,9 +212,11 @@ decl_storage! { pub ReleaseCoordinator get(fn release_coordinator) config(): Option; /// Time after which a proposal will expire. pub ExpiresAfter get(fn expires_after) config(): MaybeBlock; + /// Storage version. + StorageVersion get(fn storage_version) build(|_| Version::new(1).unwrap()): Version; } add_extra_genesis { - config(phantom): sp_std::marker::PhantomData<(T, I)>; + config(phantom): PhantomData<(T, I)>; } } @@ -179,9 +249,6 @@ decl_event!( /// A motion was executed; `DispatchResult` is `Ok(())` if returned without error. /// Parameters: caller DID, proposal hash, result of proposal dispatch. Executed(IdentityId, Hash, DispatchResult), - /// A proposal was closed after its duration was up. - /// Parameters: caller DID, proposal hash, yay vote count, nay vote count. - Closed(IdentityId, Hash, MemberCount, MemberCount), /// Release coordinator has been updated. /// Parameters: caller DID, DID of the release coordinator. ReleaseCoordinatorUpdated(IdentityId, Option), @@ -211,10 +278,6 @@ decl_error! { MismatchedVotingIndex, /// Proportion must be a rational number. InvalidProportion, - /// The close call is made too early, before the end of the voting. - CloseBeforeVoteEnd, - /// When `MotionDuration` is set to 0. - NotAllowed, /// First vote on a proposal creates it, so it must be an approval. /// All proposals are motions to execute something as "GC majority". /// To reject e.g., a PIP, a motion to reject should be *approved*. @@ -231,16 +294,27 @@ decl_module! { fn deposit_event() = default; - /// Change the vote threshold the determines the winning proposal. For e.g., for a simple - /// majority use (1, 2) which represents the in-equation ">= 1/2" + fn on_runtime_upgrade() -> Weight { + use polymesh_primitives::{storage_migrate_on, migrate::{migrate_map, Empty}}; + + storage_migrate_on!(Self::storage_version(), 1, [I] { + migrate_map::, _>( + b"Committee", b"Voting", |_| Empty + ); + }); + + 0 + } + + /// Change the vote threshold the determines the winning proposal. + /// For e.g., for a simple majority use (1, 2) which represents the in-equation ">= 1/2". /// /// # Arguments - /// * `match_criteria` - One of {AtLeast, MoreThan}. /// * `n` - Numerator of the fraction representing vote threshold. /// * `d` - Denominator of the fraction representing vote threshold. - #[weight = (100_000_000, Operational, Pays::Yes)] + #[weight = >::WeightInfo::set_vote_threshold()] pub fn set_vote_threshold(origin, n: u32, d: u32) { - T::CommitteeOrigin::ensure_origin(origin)?; + T::VoteThresholdOrigin::ensure_origin(origin)?; // Proportion must be a rational number ensure!(d > 0 && n <= d, Error::::InvalidProportion); >::put((n, d)); @@ -254,7 +328,7 @@ decl_module! { /// /// # Errors /// * `NotAMember`, If the new coordinator `id` is not part of the committee. - #[weight = (T::DbWeight::get().reads_writes(1, 1) + 200_000_000, Operational, Pays::Yes)] + #[weight = >::WeightInfo::set_release_coordinator()] pub fn set_release_coordinator(origin, id: IdentityId) { T::CommitteeOrigin::ensure_origin(origin)?; Self::ensure_did_is_member(&id)?; @@ -266,53 +340,13 @@ decl_module! { /// /// # Arguments /// * `expiry` - The new expiry time. - #[weight = (T::DbWeight::get().reads_writes(1, 1) + 200_000_000, Operational, Pays::Yes)] + #[weight = >::WeightInfo::set_expires_after()] pub fn set_expires_after(origin, expiry: MaybeBlock) { T::CommitteeOrigin::ensure_origin(origin)?; >::put(expiry); Self::deposit_event(RawEvent::ExpiresAfterUpdated(GC_DID, expiry)); } - /// May be called by any signed account after the voting duration has ended in order to - /// finish voting and close the proposal. - /// - /// Abstentions are counted as rejections. - /// - /// # Arguments - /// * `proposal` - A hash of the proposal to be closed. - /// * `index` - The proposal index. - /// - /// # Complexity - /// - the weight of `proposal` preimage. - /// - up to three events deposited. - /// - one read, two removals, one mutation. (plus three static reads.) - /// - computation and i/o `O(P + L + M)` where: - /// - `M` is number of members, - /// - `P` is number of active proposals, - /// - `L` is the encoded length of `proposal` preimage. - #[weight = (T::DbWeight::get().reads_writes(6, 2) + 650_000_000, Operational, Pays::Yes)] - fn close(origin, proposal: T::Hash, #[compact] index: ProposalIndex) { - let did = Self::ensure_is_member(origin)?; - let voting = Self::ensure_proposal(&proposal, index)?; - - // Ensure proposal hasn't expired. If it has, prune the proposal and bail. - let now = system::Module::::block_number(); - Self::ensure_not_expired(&proposal, voting.expiry, now)?; - - ensure!(T::MotionDuration::get() > Zero::zero(), Error::::NotAllowed); - ensure!(now >= voting.end, Error::::CloseBeforeVoteEnd); - - let mut no_votes = voting.nays.len() as MemberCount; - let yes_votes = voting.ayes.len() as MemberCount; - let seats = Self::seats(); - let abstentions = seats - (yes_votes + no_votes); - no_votes += abstentions; - - Self::deposit_event(RawEvent::Closed(did, proposal, yes_votes, no_votes)); - - Self::check_threshold_finalize(proposal, did, voting, yes_votes, no_votes, seats); - } - /// Proposes to the committee that `call` should be executed in its name. /// Alternatively, if the hash of `call` has already been recorded, i.e., already proposed, /// then this call counts as a vote, i.e., as if `vote_by_hash` was called. @@ -329,15 +363,9 @@ decl_module! { /// /// # Errors /// * `FirstVoteReject`, if `call` hasn't been proposed and `approve == false`. - /// * `BadOrigin`, if the `origin` is not a member of this committee. - #[weight = { - let dispatch_info = call.get_dispatch_info(); - ( - 500_000_000 + dispatch_info.weight, - dispatch_info.class, - Pays::Yes - ) - }] + /// * `NotAMember`, if the `origin` is not a member of this committee. + #[weight = >::WeightInfo::vote_or_propose_new_proposal() + + call.get_dispatch_info().weight] pub fn vote_or_propose(origin, approve: bool, call: Box<>::Proposal>) -> DispatchResult { // Either create a new proposal or vote on an existing one. let hash = T::Hashing::hash_of(&call); @@ -359,13 +387,17 @@ decl_module! { /// /// # Errors /// * `NotAMember`, if the `origin` is not a member of this committee. - #[weight = (500_000_000, Operational, Pays::Yes)] + #[weight = if *approve { + >::WeightInfo::vote_aye() + } else { + >::WeightInfo::vote_nay() + }] pub fn vote( origin, proposal: T::Hash, index: ProposalIndex, approve: bool, - ) -> DispatchResult { + ) { // 1. Ensure `origin` is a committee member. let did = Self::ensure_is_member(origin)?; @@ -373,7 +405,7 @@ decl_module! { let mut voting = Self::ensure_proposal(&proposal, index)?; // 2b. Ensure proposal hasn't expired. If it has, prune the proposal and bail. - Self::ensure_not_expired(&proposal, voting.expiry, system::Module::::block_number())?; + Self::ensure_not_expired(&proposal, voting.expiry)?; // 3. Vote on aye / nay and remove from the other. let aye = (voting.ayes.iter().position(|a| a == &did), &mut voting.ayes); @@ -394,8 +426,7 @@ decl_module! { )); // 5. Check whether majority has been reached and if so, execute proposal. - Self::check_proposal_threshold(proposal); - Ok(()) + Self::execute_if_passed(proposal); } } } @@ -405,7 +436,7 @@ impl, I: Instance> Module { fn ensure_proposal( hash: &T::Hash, idx: ProposalIndex, - ) -> Result, DispatchError> { + ) -> Result, DispatchError> { let voting = Self::voting(&hash).ok_or(Error::::NoSuchProposal)?; ensure!(voting.index == idx, Error::::MismatchedVotingIndex); Ok(voting) @@ -462,42 +493,27 @@ impl, I: Instance> Module { } /// Accepts or rejects the proposal if its threshold is satisfied. - fn check_proposal_threshold(proposal: T::Hash) { - if let Some(voting) = Self::voting(&proposal) { + fn execute_if_passed(proposal: T::Hash) { + let voting = match Self::voting(&proposal) { // Make sure we don't have an expired proposal at this point. - if let Err(_) = Self::ensure_not_expired( - &proposal, - voting.expiry, - system::Module::::block_number(), - ) { - return; - } + Some(v) if Self::ensure_not_expired(&proposal, v.expiry).is_ok() => v, + _ => return, + }; + let ayes = voting.ayes.len() as MemberCount; + let nays = voting.nays.len() as MemberCount; - let ayes = voting.ayes.len() as MemberCount; - let nays = voting.nays.len() as MemberCount; - let did = Context::current_identity::>().unwrap_or_default(); - Self::check_threshold_finalize(proposal, did, voting, ayes, nays, Self::seats()); - } - } - - fn check_threshold_finalize( - proposal: T::Hash, - did: IdentityId, - voting: PolymeshVotes, - yes_votes: MemberCount, - no_votes: MemberCount, - seats: MemberCount, - ) { let threshold = >::get(); + let seats = Self::seats(); let satisfied = |main, other| main >= other && Self::is_threshold_satisfied(main, seats, threshold); - let approved = satisfied(yes_votes, no_votes); - let rejected = satisfied(no_votes, yes_votes); - + let approved = satisfied(ayes, nays); + let rejected = satisfied(nays, ayes); if !approved && !rejected { return; } - Self::finalize_proposal(approved, seats, yes_votes, no_votes, proposal, did); + + let did = Context::current_identity::>().unwrap_or_default(); + Self::finalize_proposal(approved, seats, ayes, nays, proposal, did); let event = RawEvent::FinalVotes(did, voting.index, proposal, voting.ayes, voting.nays); Self::deposit_event(event); } @@ -526,18 +542,18 @@ impl, I: Instance> Module { proposal: T::Hash, current_did: IdentityId, ) { - if approved { - let event = RawEvent::Approved(current_did, proposal, yes_votes, no_votes, seats); - Self::deposit_event(event); + let event = if approved { + RawEvent::Approved + } else { + RawEvent::Rejected + }; + Self::deposit_event(event(current_did, proposal, yes_votes, no_votes, seats)); + if approved { // execute motion, assuming it exists. if let Some(p) = >::take(&proposal) { - Self::execute(current_did, p, proposal, yes_votes, seats); + Self::execute(current_did, p, proposal); } - } else { - // rejected - let event = RawEvent::Rejected(current_did, proposal, yes_votes, no_votes, seats); - Self::deposit_event(event); } // Clear remaining proposal data. @@ -556,10 +572,9 @@ impl, I: Instance> Module { fn ensure_not_expired( proposal: &T::Hash, expiry: MaybeBlock, - now: T::BlockNumber, ) -> Result<(), Error> { match expiry { - MaybeBlock::Some(e) if e <= now => { + MaybeBlock::Some(e) if e <= system::Module::::block_number() => { Self::clear_proposal(proposal); >::remove(proposal); Err(Error::::ProposalExpired) @@ -568,14 +583,8 @@ impl, I: Instance> Module { } } - fn execute( - did: IdentityId, - proposal: >::Proposal, - hash: T::Hash, - ayes: MemberCount, - seats: MemberCount, - ) { - let origin = RawOrigin::Members(ayes, seats).into(); + fn execute(did: IdentityId, proposal: >::Proposal, hash: T::Hash) { + let origin = RawOrigin::Endorsed(PhantomData).into(); let res = proposal.dispatch(origin).map_err(|e| e.error).map(drop); Self::deposit_event(RawEvent::Executed(did, hash, res)); } @@ -599,9 +608,8 @@ impl, I: Instance> Module { ); // 3. Execute if committee is single member, and otherwise record the vote. - let seats = Self::seats(); - if seats < 2 { - Self::execute(did, proposal, proposal_hash, 1, seats); + if Self::seats() < 2 { + Self::execute(did, proposal, proposal_hash); } else { let index = >::mutate(|i| mem::replace(i, *i + 1)); >::append(proposal_hash); @@ -611,7 +619,6 @@ impl, I: Instance> Module { index, ayes: vec![did], nays: vec![], - end: now + T::MotionDuration::get(), expiry: Self::expires_after() + now, }; >::insert(proposal_hash, votes); @@ -679,7 +686,7 @@ impl, I: Instance> ChangeMembers for Module { .iter() .any(|id| Self::remove_vote_from(*id, *proposal)) }) - .for_each(Self::check_proposal_threshold); + .for_each(Self::execute_if_passed); // Double check if any `outgoing` is the Release coordinator. if let Some(curr_rc) = Self::release_coordinator() { @@ -715,52 +722,18 @@ impl, I: Instance> InitializeMembers for Module { } } -pub struct EnsureProportionMoreThan( - sp_std::marker::PhantomData<(N, D, AccountId, I)>, -); -impl< - O: Into, O>> + From>, - N: U32, - D: U32, - AccountId, - I, - > EnsureOrigin for EnsureProportionMoreThan -{ - type Success = (); - fn try_origin(o: O) -> Result { - o.into().and_then(|o| match o { - RawOrigin::Members(n, m) if n * D::VALUE > N::VALUE * m => Ok(()), - r => Err(O::from(r)), - }) - } - - #[cfg(feature = "runtime-benchmarks")] - fn successful_origin() -> O { - O::from(RawOrigin::Members(1u32, 0u32)) - } -} - -pub struct EnsureProportionAtLeast( - sp_std::marker::PhantomData<(N, D, AccountId, I)>, -); -impl< - O: Into, O>> + From>, - N: U32, - D: U32, - AccountId, - I, - > EnsureOrigin for EnsureProportionAtLeast +pub struct EnsureThresholdMet(PhantomData<(AccountId, I)>); +impl EnsureOrigin for EnsureThresholdMet +where + O: Into, O>> + From>, { type Success = (); fn try_origin(o: O) -> Result { - o.into().and_then(|o| match o { - RawOrigin::Members(n, m) if n * D::VALUE >= N::VALUE * m => Ok(()), - r => Err(O::from(r)), - }) + o.into().map(|RawOrigin::Endorsed(PhantomData)| ()) } #[cfg(feature = "runtime-benchmarks")] fn successful_origin() -> O { - O::from(RawOrigin::Members(0u32, 0u32)) + O::from(RawOrigin::Endorsed(PhantomData)) } } diff --git a/pallets/common/Cargo.toml b/pallets/common/Cargo.toml index 1fb1b6456e..7a0a740d79 100644 --- a/pallets/common/Cargo.toml +++ b/pallets/common/Cargo.toml @@ -15,24 +15,24 @@ serde_derive = { version = "1.0.112", optional = true, default-features = false} # Substrate codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Only for test in STD -substrate-test-runtime-client = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true} +substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true} # Benchmarks -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } schnorrkel = { git = "https://github.com/PolymathNetwork/schnorrkel.git", branch = "fix-simd-issue", default-features = false, optional = true } [dev-dependencies] diff --git a/pallets/common/src/benchs/asset.rs b/pallets/common/src/benchs/asset.rs new file mode 100644 index 0000000000..591d7ac97f --- /dev/null +++ b/pallets/common/src/benchs/asset.rs @@ -0,0 +1,109 @@ +use crate::{ + benchs::User, + constants::currency::POLY, + traits::{asset::AssetFnTrait, identity::Trait as IdentityTrait}, +}; + +use polymesh_primitives::{ + asset::{AssetName, AssetType}, + Ticker, +}; + +use frame_system::RawOrigin; +use sp_std::{convert::TryFrom, prelude::*}; + +pub type ResultTicker = Result; + +/// Create a ticker and register it. +pub fn make_ticker(owner: O, opt_name: Option) -> ResultTicker +where + Asset: AssetFnTrait, + N: AsRef<[u8]>, +{ + let ticker = match &opt_name { + Some(name) => Ticker::try_from(name.as_ref()).map_err(|_| "Invalid ticker name")?, + _ => Ticker::repeating(b'A'), + }; + Asset::register_ticker(owner, ticker).map_err(|_| "Ticker cannot be registered")?; + + Ok(ticker) +} + +pub fn make_asset( + owner: &User, + name: Option, +) -> ResultTicker +where + Asset: AssetFnTrait, + Identity: IdentityTrait, + Origin: From::AccountId>>, + Balance: From, + N: AsRef<[u8]>, +{ + make_base_asset::(owner, true, name) +} + +pub fn make_indivisible_asset( + owner: &User, + name: Option, +) -> ResultTicker +where + Asset: AssetFnTrait, + Identity: IdentityTrait, + Origin: From::AccountId>>, + Balance: From, + N: AsRef<[u8]>, +{ + make_base_asset::(owner, false, name) +} + +fn make_base_asset( + owner: &User, + divisible: bool, + name: Option, +) -> ResultTicker +where + Asset: AssetFnTrait, + Identity: IdentityTrait, + Origin: From::AccountId>>, + Balance: From, + N: AsRef<[u8]>, +{ + let ticker = make_ticker::(owner.origin().into(), name)?; + let name: AssetName = ticker.as_slice().into(); + let total_supply: Balance = (1_000_000 * POLY).into(); + + Asset::create_asset( + owner.origin().into(), + name, + ticker, + total_supply, + divisible, + AssetType::default(), + vec![], + None, + ) + .map_err(|_| "Asset cannot be created")?; + + Ok(ticker) +} + +/// Given a number, this function generates a ticker with +/// A-Z, least number of characters in Lexicographic order +pub fn generate_ticker(n: u64) -> Vec { + fn calc_base26(n: u64, base_26: &mut Vec) { + if n >= 26 { + // Subtracting 1 is not required and shouldn't be done for a proper base_26 conversion + // However, without this hack, B will be the first char after a bump in number of chars. + // i.e. the sequence will go A,B...Z,BA,BB...ZZ,BAA. We want the sequence to start with A. + // Subtracting 1 here means we are doing 1 indexing rather than 0. + // i.e. A = 1, B = 2 instead of A = 0, B = 1 + calc_base26((n / 26) - 1, base_26); + } + let character = n % 26 + 65; + base_26.push(character as u8); + } + let mut base_26 = Vec::new(); + calc_base26(n, &mut base_26); + base_26 +} diff --git a/pallets/common/src/benchs/mod.rs b/pallets/common/src/benchs/mod.rs index 73035fd32a..ae6003f2f1 100644 --- a/pallets/common/src/benchs/mod.rs +++ b/pallets/common/src/benchs/mod.rs @@ -20,6 +20,9 @@ pub use user::{PublicKey, SecretKey, User}; mod user_builder; pub use user_builder::{uid_from_name_and_idx, UserBuilder}; +mod asset; +pub use asset::{generate_ticker, make_asset, make_indivisible_asset, make_ticker, ResultTicker}; + pub fn user(prefix: &'static str, u: u32) -> User { UserBuilder::::default() .generate_did() diff --git a/pallets/common/src/benchs/user.rs b/pallets/common/src/benchs/user.rs index 22909d5773..8bb94a9cf2 100644 --- a/pallets/common/src/benchs/user.rs +++ b/pallets/common/src/benchs/user.rs @@ -22,6 +22,7 @@ use sp_runtime::traits::StaticLookup; pub use schnorrkel::keys::{PublicKey, SecretKey}; /// Helper class to create accounts and its DID to simplify benchmarks and UT. +#[derive(Clone, Debug, PartialEq, Eq)] pub struct User { pub account: T::AccountId, pub secret: Option, @@ -31,23 +32,23 @@ pub struct User { } impl User { - pub fn did(self: &Self) -> IdentityId { - self.did.clone().expect("User without DID") + pub fn did(&self) -> IdentityId { + self.did.expect("User without DID") } - pub fn uid(self: &Self) -> InvestorUid { - self.uid.clone().expect("User without UID") + pub fn uid(&self) -> InvestorUid { + self.uid.expect("User without UID") } - pub fn account(self: &Self) -> T::AccountId { + pub fn account(&self) -> T::AccountId { self.account.clone() } - pub fn origin(self: &Self) -> RawOrigin { + pub fn origin(&self) -> RawOrigin { self.origin.clone() } - pub fn lookup(self: &Self) -> ::Source { + pub fn lookup(&self) -> ::Source { T::Lookup::unlookup(self.account.clone()) } diff --git a/pallets/common/src/benchs/user_builder.rs b/pallets/common/src/benchs/user_builder.rs index f8611d1d4b..ee2847c7dd 100644 --- a/pallets/common/src/benchs/user_builder.rs +++ b/pallets/common/src/benchs/user_builder.rs @@ -27,7 +27,7 @@ use frame_support::traits::Currency; use frame_system::RawOrigin; use polymesh_primitives::{IdentityId, InvestorUid}; use sp_io::hashing::blake2_256; -use sp_std::{convert::TryInto, prelude::*}; +use sp_std::prelude::*; pub fn uid_from_name_and_idx(name: &'static str, u: u32) -> InvestorUid { InvestorUid::from((name, u).encode().as_slice()) @@ -37,7 +37,7 @@ pub struct UserBuilder { account: Option, uid: Option, did: Option, - balance: T::Balance, + balance: u32, seed: u32, generate_did: bool, as_cdd_provider: bool, @@ -59,8 +59,7 @@ impl UserBuilder { .clone() .map_or_else(|| Self::make_key_pair(name, self.seed), |acc| (acc, None)); let origin = RawOrigin::Signed(account.clone()); - let amount: u32 = self.balance.try_into().unwrap_or_default() as u32; - let _ = T::Balances::make_free_balance_be(&account, amount.into()); + let _ = T::Balances::make_free_balance_be(&account, self.balance.into()); // Generate DID or use the one given. let uid = self @@ -116,7 +115,7 @@ impl UserBuilder { self_update!(self, account, Some(acc.into())) } - pub fn balance>(self, b: B) -> Self { + pub fn balance>(self, b: B) -> Self { self_update!(self, balance, b.into()) } @@ -147,7 +146,7 @@ impl Default for UserBuilder { account: None, uid: None, did: None, - balance: 5_000_000u128.into(), + balance: 5_000_000u32, seed: 0, generate_did: false, as_cdd_provider: false, diff --git a/pallets/common/src/traits/asset.rs b/pallets/common/src/traits/asset.rs index 6ac2652ae6..79e4956865 100644 --- a/pallets/common/src/traits/asset.rs +++ b/pallets/common/src/traits/asset.rs @@ -13,15 +13,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use codec::{Decode, Encode}; use frame_support::dispatch::{DispatchError, DispatchResult}; use polymesh_primitives::{ - calendar::CheckpointId, AssetIdentifier, IdentityId, PortfolioId, ScopeId, Ticker, + asset::{AssetName, AssetType, FundingRoundName}, + calendar::CheckpointId, + AssetIdentifier, IdentityId, PortfolioId, ScopeId, Ticker, }; -use polymesh_primitives_derive::VecU8StrongTyped; -use sp_std::prelude::*; - -pub const GAS_LIMIT: u64 = 13_000_000_000; +use sp_std::prelude::Vec; /// This trait is used by the `identity` pallet to interact with the `pallet-asset`. pub trait AssetSubTrait { @@ -59,58 +57,10 @@ pub trait AssetSubTrait { /// * `target` - The `IdentityId` whose balance needs to be queried. fn balance_of_at_scope(scope_id: &ScopeId, target: &IdentityId) -> Balance; } -#[derive(Encode, Decode, Default, Clone, PartialEq, Debug)] -pub struct IssueAssetItem { - pub investor_did: IdentityId, - pub value: U, -} - -/// A wrapper for a token name. -#[derive( - Decode, Encode, Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord, VecU8StrongTyped, -)] -pub struct AssetName(pub Vec); - -/// The type of an asset represented by a token. -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq)] -pub enum AssetType { - EquityCommon, - EquityPreferred, - Commodity, - FixedIncome, - REIT, - Fund, - RevenueShareAgreement, - StructuredProduct, - Derivative, - Custom(Vec), -} - -impl Default for AssetType { - fn default() -> Self { - Self::Custom(b"undefined".to_vec()) - } -} -/// A wrapper for a funding round name. -#[derive(Decode, Encode, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, VecU8StrongTyped)] -pub struct FundingRoundName(pub Vec); - -impl Default for FundingRoundName { - fn default() -> Self { - Self(Vec::new()) - } -} - -pub trait Trait { +pub trait AssetFnTrait { fn total_supply(ticker: &Ticker) -> Balance; fn balance(ticker: &Ticker, did: IdentityId) -> Balance; - fn _mint_from_sto( - ticker: &Ticker, - caller: Account, - sender_did: IdentityId, - assets_purchased: Balance, - ) -> DispatchResult; /// Check if an Identity is the owner of a ticker. fn is_owner(ticker: &Ticker, did: IdentityId) -> bool; /// Get an Identity's balance of a token at a particular checkpoint. @@ -140,4 +90,9 @@ pub trait Trait { identifiers: Vec, funding_round: Option, ) -> DispatchResult; + + fn register_ticker(origin: Origin, ticker: Ticker) -> DispatchResult; + #[cfg(feature = "runtime-benchmarks")] + /// Adds an artificial IU claim for benchmarks + fn add_investor_uniqueness_claim(did: IdentityId, ticker: Ticker); } diff --git a/pallets/common/src/traits/permissions.rs b/pallets/common/src/traits/permissions.rs index 5a50954b4d..472442d677 100644 --- a/pallets/common/src/traits/permissions.rs +++ b/pallets/common/src/traits/permissions.rs @@ -14,16 +14,10 @@ // along with this program. If not, see . use codec::{Decode, Encode}; -use frame_support::{dispatch::PostDispatchInfo, traits::GetCallMetadata}; use polymesh_primitives::{DispatchableName, IdentityId, PalletName, SecondaryKey}; -use sp_runtime::traits::Dispatchable; /// Permissions module configuration trait. pub trait PermissionChecker: frame_system::Trait { - /// The call type with additional traits. - type Call: From<::Call> - + GetCallMetadata - + Dispatchable::Origin, PostInfo = PostDispatchInfo>; /// The type that implements the permission check function. type Checker: CheckAccountCallPermissions; } diff --git a/pallets/compliance-manager/Cargo.toml b/pallets/compliance-manager/Cargo.toml index 6bc184f99a..ae1e9b7e85 100644 --- a/pallets/compliance-manager/Cargo.toml +++ b/pallets/compliance-manager/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [dependencies] # Common polymesh-primitives = { path = "../../primitives", default-features = false } -polymesh-primitives-derive = { path = "../../primitives_derive" } polymesh-common-utilities = { path = "../common", default-features = false } # Our pallets @@ -24,18 +23,18 @@ either = { version = "1.6.1", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0", optional = true } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1", optional = true } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } [features] diff --git a/pallets/compliance-manager/src/benchmarking.rs b/pallets/compliance-manager/src/benchmarking.rs index 907a616d35..1e60a4b505 100644 --- a/pallets/compliance-manager/src/benchmarking.rs +++ b/pallets/compliance-manager/src/benchmarking.rs @@ -13,18 +13,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] - use crate::*; -use pallet_asset::SecurityToken; -use polymesh_common_utilities::{ - asset::AssetType, - benchs::{User, UserBuilder}, -}; -use polymesh_primitives::{TrustedFor, TrustedIssuer}; - use frame_benchmarking::benchmarks; +use pallet_asset::SecurityToken; +use polymesh_common_utilities::benchs::{User, UserBuilder}; +use polymesh_primitives::{asset::AssetType, TrustedFor, TrustedIssuer}; const MAX_DEFAULT_TRUSTED_CLAIM_ISSUERS: u32 = 3; const MAX_TRUSTED_ISSUER_PER_CONDITION: u32 = 3; @@ -60,7 +54,7 @@ pub fn make_conditions(s: u32, issuers: &Vec) -> Vec { condition_type: ConditionType::IsPresent(Claim::NoData), issuers: issuers.clone(), }) - .collect::>() + .collect() } /// Create a new token with name `name` on behalf of `owner`. /// The new token is a _divisible_ one with 1_000_000 units. @@ -79,7 +73,7 @@ pub fn make_token(owner: &User, name: Vec) -> Ticker { owner.origin.clone().into(), token.name.clone(), ticker.clone(), - token.total_supply.into(), + u128::try_from(token.total_supply).unwrap().into(), true, token.asset_type.clone(), vec![], diff --git a/pallets/compliance-manager/src/lib.rs b/pallets/compliance-manager/src/lib.rs index 09ce458783..13deed39da 100644 --- a/pallets/compliance-manager/src/lib.rs +++ b/pallets/compliance-manager/src/lib.rs @@ -88,7 +88,7 @@ use frame_support::{ use pallet_identity as identity; pub use polymesh_common_utilities::traits::compliance_manager::WeightInfo; use polymesh_common_utilities::{ - asset::Trait as AssetTrait, + asset::AssetFnTrait, balances::Trait as BalancesTrait, compliance_manager::Trait as ComplianceManagerTrait, constants::*, @@ -115,7 +115,7 @@ pub trait Trait: type Event: From + Into<::Event>; /// Asset module - type Asset: AssetTrait; + type Asset: AssetFnTrait; /// Weight details of all extrinsic type WeightInfo: WeightInfo; @@ -301,6 +301,9 @@ decl_module! { /// * ticker - Symbol of the asset /// * sender_conditions - Sender transfer conditions. /// * receiver_conditions - Receiver transfer conditions. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::add_compliance_requirement( sender_conditions.len() as u32, receiver_conditions.len() as u32)] pub fn add_compliance_requirement(origin, ticker: Ticker, sender_conditions: Vec, receiver_conditions: Vec) { let did = T::Asset::ensure_perms_owner_asset(origin, &ticker)?; @@ -332,6 +335,9 @@ decl_module! { /// * origin - Signer of the dispatchable. It should be the owner of the ticker /// * ticker - Symbol of the asset /// * id - Compliance requirement id which is need to be removed + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::remove_compliance_requirement()] pub fn remove_compliance_requirement(origin, ticker: Ticker, id: u32) { let did = T::Asset::ensure_perms_owner_asset(origin, &ticker)?; @@ -356,6 +362,8 @@ decl_module! { /// * `Unauthorized` if `origin` is not the owner of the ticker. /// * `DuplicateAssetCompliance` if `asset_compliance` contains multiple entries with the same `requirement_id`. /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::replace_asset_compliance( asset_compliance.len() as u32)] pub fn replace_asset_compliance(origin, ticker: Ticker, asset_compliance: Vec) { let did = T::Asset::ensure_perms_owner_asset(origin, &ticker)?; @@ -379,6 +387,9 @@ decl_module! { /// # Arguments /// * origin - Signer of the dispatchable. It should be the owner of the ticker /// * ticker - Symbol of the asset + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::reset_asset_compliance()] pub fn reset_asset_compliance(origin, ticker: Ticker) { let did = T::Asset::ensure_perms_owner_asset(origin, &ticker)?; @@ -391,6 +402,9 @@ decl_module! { /// # Arguments /// * origin - Signer of the dispatchable. It should be the owner of the ticker /// * ticker - Symbol of the asset + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::pause_asset_compliance()] pub fn pause_asset_compliance(origin, ticker: Ticker) { let did = Self::pause_resume_asset_compliance(origin, ticker, true)?; @@ -402,6 +416,9 @@ decl_module! { /// # Arguments /// * origin - Signer of the dispatchable. It should be the owner of the ticker /// * ticker - Symbol of the asset + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::resume_asset_compliance()] pub fn resume_asset_compliance(origin, ticker: Ticker) { let did = Self::pause_resume_asset_compliance(origin, ticker, false)?; @@ -414,6 +431,9 @@ decl_module! { /// * origin - Signer of the dispatchable. It should be the owner of the ticker. /// * ticker - Symbol of the asset. /// * issuer - IdentityId of the trusted claim issuer. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::add_default_trusted_claim_issuer()] pub fn add_default_trusted_claim_issuer(origin, ticker: Ticker, issuer: TrustedIssuer) { let did = T::Asset::ensure_perms_owner_asset(origin, &ticker)?; @@ -433,6 +453,9 @@ decl_module! { /// * origin - Signer of the dispatchable. It should be the owner of the ticker. /// * ticker - Symbol of the asset. /// * issuer - IdentityId of the trusted claim issuer. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::remove_default_trusted_claim_issuer()] pub fn remove_default_trusted_claim_issuer(origin, ticker: Ticker, issuer: IdentityId) { let did = T::Asset::ensure_perms_owner_asset(origin, &ticker)?; @@ -451,6 +474,9 @@ decl_module! { /// * origin - Signer of the dispatchable. It should be the owner of the ticker. /// * ticker - Symbol of the asset. /// * new_req - Compliance requirement. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::change_compliance_requirement( new_req.sender_conditions.len() as u32, new_req.receiver_conditions.len() as u32)] diff --git a/pallets/confidential/Cargo.toml b/pallets/confidential/Cargo.toml index 7327bbecd9..c1ac9c5de6 100644 --- a/pallets/confidential/Cargo.toml +++ b/pallets/confidential/Cargo.toml @@ -14,27 +14,27 @@ pallet-asset = { path = "../asset", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -sp-runtime-interface = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-runtime-interface = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Crypto rand_core = { version = "0.5", default-features = false } rand = { version = "0.7.3", default-features = false, optional = true } -cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "v2.2.0" } +cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "v2.2.2" } # Only Benchmarking -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } [features] equalize = [] diff --git a/pallets/confidential/src/benchmarking.rs b/pallets/confidential/src/benchmarking.rs index b7ad8da9f8..63d31053ce 100644 --- a/pallets/confidential/src/benchmarking.rs +++ b/pallets/confidential/src/benchmarking.rs @@ -13,15 +13,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] use crate::*; -use polymesh_common_utilities::{ - benchs::{User, UserBuilder}, - traits::asset::AssetType, -}; - use frame_benchmarking::benchmarks; +use polymesh_common_utilities::benchs::{User, UserBuilder}; +use polymesh_primitives::asset::AssetType; use sp_std::convert::TryFrom; const MAX_TICKER_LENGTH: u8 = 12; @@ -34,7 +30,7 @@ fn make_ticker(owner: &User) -> Ticker { owner.origin().into(), sc_name, ticker.clone(), - 1_000.into(), + 1_000u32.into(), true, AssetType::default(), vec![], diff --git a/pallets/confidential/src/lib.rs b/pallets/confidential/src/lib.rs index 3b0e50f592..e6ce2bbbd5 100644 --- a/pallets/confidential/src/lib.rs +++ b/pallets/confidential/src/lib.rs @@ -26,7 +26,7 @@ use frame_support::{ weights::Weight, }; use pallet_identity as identity; -use polymesh_common_utilities::{asset::Trait as AssetTrait, identity::Trait as IdentityTrait}; +use polymesh_common_utilities::{asset::AssetFnTrait, identity::Trait as IdentityTrait}; use polymesh_primitives::{IdentityId, Ticker}; use polymesh_primitives_derive::{SliceU8StrongTyped, VecU8StrongTyped}; use sp_std::prelude::*; @@ -60,7 +60,7 @@ pub trait WeightInfo { pub trait Trait: frame_system::Trait + IdentityTrait { type Event: From + Into<::Event>; - type Asset: AssetTrait; + type Asset: AssetFnTrait; type WeightInfo: WeightInfo; } diff --git a/pallets/contracts/Cargo.toml b/pallets/contracts/Cargo.toml index 7733a3c221..0a2d0fa3a1 100644 --- a/pallets/contracts/Cargo.toml +++ b/pallets/contracts/Cargo.toml @@ -9,13 +9,13 @@ edition = "2018" # Substrate specific serde = { version = "1.0.104", default-features = false } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-contracts = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } wat = { version = "1.0", optional = true, default-features = false } parity-wasm = { version = "0.41.0", default-features = false } @@ -26,7 +26,7 @@ polymesh-common-utilities = { path = "../common", default-features = false } pallet-protocol-fee = { path = "../protocol-fee", default-features = false } # Only in STD env -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, tag = "v2.0.0" } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, optional = true, tag = "v2.0.1-1" } [features] default = ["std"] diff --git a/pallets/contracts/src/benchmarking.rs b/pallets/contracts/src/benchmarking.rs index 99d7312944..b212372fa9 100644 --- a/pallets/contracts/src/benchmarking.rs +++ b/pallets/contracts/src/benchmarking.rs @@ -13,18 +13,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] - use crate::*; -use pallet_contracts::PristineCode; -use polymesh_common_utilities::benchs::UserBuilder; -use polymesh_primitives::{MetaDescription, MetaUrl, SmartExtensionType, TemplateMetadata}; - use frame_benchmarking::benchmarks; use frame_support::storage::IterableStorageMap; use frame_system::RawOrigin; +use pallet_contracts::PristineCode; use parity_wasm::elements::FuncBody; +use polymesh_common_utilities::benchs::UserBuilder; +use polymesh_primitives::{MetaDescription, MetaUrl, SmartExtensionType, TemplateMetadata}; use sp_runtime::traits::Hash; type BaseContracts = pallet_contracts::Module; @@ -124,7 +121,7 @@ pub fn emulate_blueprint_in_storage( let meta_info = TemplateMetadata { url, se_type: SmartExtensionType::TransferManager, - usage_fee: 100.into(), + usage_fee: 100u32.into(), description, version: 5000, }; @@ -162,13 +159,13 @@ benchmarks! { let meta_info = TemplateMetadata { url, se_type: SmartExtensionType::TransferManager, - usage_fee: 100.into(), + usage_fee: 100u32.into(), description, version: 5000 }; let (wasm_blob, code_hash) = expanded_contract::(l); let user = UserBuilder::::default().generate_did().build("creator"); - }: _(user.origin, meta_info, 1000.into(), wasm_blob) + }: _(user.origin, meta_info, 1000u32.into(), wasm_blob) verify { ensure!(matches!(Module::::get_metadata_of(code_hash), meta_info), "Contracts_putCode: Meta info set incorrect"); ensure!(PristineCode::::get(code_hash).is_some(), "Contracts_putCode: Base contract doesn't get updated with given code hash"); @@ -181,7 +178,7 @@ benchmarks! { let creator = UserBuilder::::default().generate_did().build("creator"); let code_hash = emulate_blueprint_in_storage::(max_fee, creator.origin, "dummy")?; let deployer = UserBuilder::::default().generate_did().build("deployer"); - }: _(deployer.origin, 1_000_000.into(), Weight::max_value(), code_hash, data, max_fee.into()) + }: _(deployer.origin, 1_000_000u32.into(), Weight::max_value(), code_hash, data, max_fee.into()) verify { let (key, value) = ExtensionInfo::::iter().next().unwrap(); let attributes = Module::::ext_details(&code_hash); @@ -221,10 +218,10 @@ benchmarks! { change_template_fees { let creator = UserBuilder::::default().generate_did().build("creator"); let code_hash = emulate_blueprint_in_storage::(100, creator.origin.clone(), "")?; - }: _(creator.origin, code_hash, Some(500.into()), Some(650.into())) + }: _(creator.origin, code_hash, Some(500u32.into()), Some(650u32.into())) verify { - ensure!(Module::::get_template_details(code_hash).get_instantiation_fee() == 500.into(), "Contracts_change_template_fees: Failed to change the instantiation fees"); - ensure!(Module::::get_metadata_of(code_hash).usage_fee == 650.into(), "Contracts_change_template_fees: Failed to change the usage fees"); + ensure!(Module::::get_template_details(code_hash).get_instantiation_fee() == 500u32.into(), "Contracts_change_template_fees: Failed to change the instantiation fees"); + ensure!(Module::::get_metadata_of(code_hash).usage_fee == 650u32.into(), "Contracts_change_template_fees: Failed to change the usage fees"); } change_template_meta_url { diff --git a/pallets/contracts/src/lib.rs b/pallets/contracts/src/lib.rs index 1ff5569972..6f7848eadc 100644 --- a/pallets/contracts/src/lib.rs +++ b/pallets/contracts/src/lib.rs @@ -239,7 +239,7 @@ decl_module! { /// # Errors /// InstantiationIsNotAllowed - It occurred when instantiation of the template is frozen. /// InsufficientMaxFee - Provided max_fee is less than required. - #[weight = ::WeightInfo::instantiate() + *gas_limit] + #[weight = ::WeightInfo::instantiate().saturating_add(*gas_limit)] pub fn instantiate( origin, #[compact] endowment: BalanceOf, @@ -277,7 +277,7 @@ decl_module! { >::insert(contract_address, Self::ext_details(&code_hash)); // Update the actual weight of the extrinsic. - Ok(actual_weight.map(|w| w + 500_000_000).into()) + Ok(actual_weight.map(|w| w.saturating_add(500_000_000)).into()) } /// Allows a smart extension template owner to freeze the instantiation. diff --git a/pallets/corporate-actions/Cargo.toml b/pallets/corporate-actions/Cargo.toml index c94f35e06c..ea4315e0c1 100644 --- a/pallets/corporate-actions/Cargo.toml +++ b/pallets/corporate-actions/Cargo.toml @@ -22,21 +22,21 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false # Substrate codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } libsecp256k1 = { version = "0.3.5", default-features = false, features = ["hmac"] } -confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "v2.2.0", optional = true } +confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "v2.2.2", optional = true } pallet-compliance-manager = { path = "../compliance-manager", default-features = false, optional = true } [features] diff --git a/pallets/corporate-actions/src/ballot/benchmarking.rs b/pallets/corporate-actions/src/ballot/benchmarking.rs index e17b3441d3..b75927637d 100644 --- a/pallets/corporate-actions/src/ballot/benchmarking.rs +++ b/pallets/corporate-actions/src/ballot/benchmarking.rs @@ -13,8 +13,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] - use super::*; use crate::benchmarking::{set_ca_targets, setup_ca}; use core::iter; @@ -53,9 +51,9 @@ benchmarks! { _ {} attach_ballot { - let j in 0..MAX_CHOICES; + let c in 0..MAX_CHOICES; - let meta = meta(1, j); + let meta = meta(1, c); let (owner, ca_id) = setup_ca::(CAKind::IssuerNotice); }: _(owner.origin(), ca_id, RANGE, meta, true) verify { @@ -63,21 +61,21 @@ benchmarks! { } vote { - let j in 0..MAX_CHOICES; - let k in 0..MAX_TARGETS; + let c in 0..MAX_CHOICES; + let t in 0..MAX_TARGETS; // Attach and prepare to vote. - let (owner, ca_id) = attach::(1, j); - >::set(3000.into()); + let (owner, ca_id) = attach::(1, c); + >::set(3000u32.into()); // Change targets, as they are read in voting. - set_ca_targets::(ca_id, k); + set_ca_targets::(ca_id, t); // Construct the voting list. - let votes = (0..j) - .map(|j| BallotVote { - power: 0.into(), - fallback: (j as u16).checked_sub(1), + let votes = (0..c) + .map(|c| BallotVote { + power: 0u32.into(), + fallback: (c as u16).checked_sub(1), }) .collect::>(); @@ -97,10 +95,10 @@ benchmarks! { } change_meta { - let j in 0..MAX_CHOICES; + let c in 0..MAX_CHOICES; let (owner, ca_id) = attach::(0, 0); - let meta = meta(1, j); + let meta = meta(1, c); let meta2 = meta.clone(); }: _(owner.origin(), ca_id, meta) verify { diff --git a/pallets/corporate-actions/src/benchmarking.rs b/pallets/corporate-actions/src/benchmarking.rs index b7a0953e1c..88a9960bfc 100644 --- a/pallets/corporate-actions/src/benchmarking.rs +++ b/pallets/corporate-actions/src/benchmarking.rs @@ -13,15 +13,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] - use crate::*; use core::convert::TryFrom; use core::iter; use frame_benchmarking::benchmarks; use frame_system::RawOrigin; -use pallet_asset::benchmarking::{make_asset, make_document}; -use polymesh_common_utilities::benchs::{user, User, UserBuilder}; +use pallet_asset::benchmarking::make_document; +use polymesh_common_utilities::benchs::{make_asset, user, User, UserBuilder}; const TAX: Tax = Tax::one(); crate const SEED: u32 = 0; @@ -37,10 +35,12 @@ const RD_SPEC2: Option = Some(RecordDateSpec::Scheduled(3000)); // Therefore, in general, we'll be using the owner as the CAA. fn setup() -> (User, Ticker) { - >::set(1000.into()); + >::set(1000u32.into()); let owner = user("owner", SEED); - let ticker = make_asset::(&owner); + let ticker = + make_asset::(&owner, None) + .expect("Asset cannot be created"); (owner, ticker) } @@ -90,7 +90,7 @@ fn add_docs(origin: &T::Origin, ticker: Ticker, n: u32) -> Vec(kind: CAKind) -> (User, CAId) { let (owner, ticker) = setup::(); - >::set(1000.into()); + >::set(1000u32.into()); let origin: T::Origin = owner.origin().into(); >::initiate_corporate_action( @@ -137,7 +137,7 @@ crate fn currency(owner: &User) -> Ticker { owner.origin().into(), currency.as_slice().into(), currency, - 1_000_000.into(), + 1_000_000u32.into(), true, <_>::default(), vec![], @@ -154,7 +154,7 @@ fn distribute(owner: &User, ca_id: CAId) { ca_id, None, currency, - 1000.into(), + 1000u32.into(), 4000, None, ) @@ -212,10 +212,10 @@ benchmarks! { } set_default_targets { - let i in 0..MAX_TARGET_IDENTITIES; + let t in 0..MAX_TARGET_IDENTITIES; let (owner, ticker) = setup::(); - let targets = target_ids::(i, TargetTreatment::Exclude); + let targets = target_ids::(t, TargetTreatment::Exclude); let targets2 = targets.clone(); }: _(owner.origin(), ticker, targets) verify { @@ -230,11 +230,11 @@ benchmarks! { } set_did_withholding_tax { - let i in 0..(MAX_DID_WHT_IDS - 1); + let w in 0..(MAX_DID_WHT_IDS - 1); let (owner, ticker) = setup::(); - let mut whts = init_did_whts::(ticker, i); - let last = target::(i + 1); + let mut whts = init_did_whts::(ticker, w); + let last = target::(w + 1); }: _(owner.origin(), ticker, last, Some(TAX)) verify { whts.push((last, TAX)); @@ -243,13 +243,13 @@ benchmarks! { } initiate_corporate_action_use_defaults { - let j in 0..MAX_DID_WHT_IDS; - let k in 0..MAX_TARGET_IDENTITIES; + let w in 0..MAX_DID_WHT_IDS; + let t in 0..MAX_TARGET_IDENTITIES; let (owner, ticker) = setup::(); let details = details(DETAILS_LEN); - let whts = init_did_whts::(ticker, j); - let targets = target_ids::(k, TargetTreatment::Exclude).dedup(); + let whts = init_did_whts::(ticker, w); + let targets = target_ids::(t, TargetTreatment::Exclude).dedup(); DefaultTargetIdentities::insert(ticker, targets); }: initiate_corporate_action( owner.origin(), ticker, CAKind::Other, 1000, RD_SPEC, details, None, None, None @@ -259,13 +259,13 @@ benchmarks! { } initiate_corporate_action_provided { - let j in 0..MAX_DID_WHT_IDS; - let k in 0..MAX_TARGET_IDENTITIES; + let w in 0..MAX_DID_WHT_IDS; + let t in 0..MAX_TARGET_IDENTITIES; let (owner, ticker) = setup::(); let details = details(DETAILS_LEN); - let whts = Some(did_whts::(j)); - let targets = Some(target_ids::(k, TargetTreatment::Exclude)); + let whts = Some(did_whts::(w)); + let targets = Some(target_ids::(t, TargetTreatment::Exclude)); }: initiate_corporate_action( owner.origin(), ticker, CAKind::Other, 1000, RD_SPEC, details, targets, Some(TAX), whts ) @@ -274,11 +274,11 @@ benchmarks! { } link_ca_doc { - let i in 0..MAX_DOCS; + let d in 0..MAX_DOCS; let (owner, ticker) = setup::(); let origin: T::Origin = owner.origin().into(); - let ids = add_docs::(&origin, ticker, i); + let ids = add_docs::(&origin, ticker, d); let ids2 = ids.clone(); >::initiate_corporate_action( origin, ticker, CAKind::Other, 1000, None, "".into(), None, None, None diff --git a/pallets/corporate-actions/src/distribution/benchmarking.rs b/pallets/corporate-actions/src/distribution/benchmarking.rs index 76f4a891af..c3a007e183 100644 --- a/pallets/corporate-actions/src/distribution/benchmarking.rs +++ b/pallets/corporate-actions/src/distribution/benchmarking.rs @@ -13,16 +13,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] - use super::*; use crate::benchmarking::{currency, did_whts, set_ca_targets, setup_ca, SEED}; use crate::{CAKind, CorporateActions}; use frame_benchmarking::benchmarks; use pallet_compliance_manager::Module as ComplianceManager; use pallet_portfolio::MovePortfolioItem; -use polymesh_common_utilities::benchs::{user, User}; - +use polymesh_common_utilities::{ + asset::AssetFnTrait, + benchs::{user, User}, +}; +use polymesh_primitives::{PortfolioId, PortfolioNumber, Ticker}; const MAX_TARGETS: u32 = 1000; const MAX_DID_WHT_IDS: u32 = 1000; @@ -43,8 +44,8 @@ fn dist(target_ids: u32) -> (User, CAId, Ticker) { let (owner, ca_id) = setup_ca::(CAKind::UnpredictableBenefit); let currency = currency::(&owner); - let amount = 1000.into(); - let pnum = 1.into(); + let amount = 1000u32.into(); + let pnum = 1u64.into(); portfolio::(&owner, pnum, currency, amount); >::distribute( @@ -63,31 +64,6 @@ fn dist(target_ids: u32) -> (User, CAId, Ticker) { (owner, ca_id, currency) } -fn add_investor_uniqueness_claim(user: &User, scope: Ticker) { - use confidential_identity::{compute_cdd_id, compute_scope_id}; - use frame_system::Origin; - use polymesh_primitives::{Claim, InvestorZKProofData, Scope}; - - let claim_to = user.did(); - let investor_uid = user.uid(); - let proof: InvestorZKProofData = InvestorZKProofData::new(&claim_to, &investor_uid, &scope); - let cdd_claim = InvestorZKProofData::make_cdd_claim(&claim_to, &investor_uid); - let cdd_id = compute_cdd_id(&cdd_claim).compress().to_bytes().into(); - let scope_claim = InvestorZKProofData::make_scope_claim(&scope.as_slice(), &investor_uid); - let scope_id = compute_scope_id(&scope_claim).compress().to_bytes().into(); - - let signed_claim_to = >::Signed(>::did_records(claim_to).primary_key); - - >::add_investor_uniqueness_claim( - signed_claim_to.into(), - claim_to, - Claim::InvestorUniqueness(Scope::Ticker(scope), scope_id, cdd_id), - proof, - None, - ) - .unwrap(); -} - fn prepare_transfer( target_ids: u32, did_whts_num: u32, @@ -100,11 +76,17 @@ fn prepare_transfer( ca.as_mut().unwrap().withholding_tax = whts; }); - >::set(3000.into()); + >::set(3000u32.into()); let holder = user::("holder", SEED); - add_investor_uniqueness_claim(&owner, currency); - add_investor_uniqueness_claim(&holder, currency); + ::Asset::add_investor_uniqueness_claim( + owner.did(), + currency, + ); + ::Asset::add_investor_uniqueness_claim( + holder.did(), + currency, + ); >::add_compliance_requirement( owner.origin().into(), currency, @@ -124,31 +106,29 @@ benchmarks! { distribute { let (owner, ca_id) = setup_ca::(CAKind::UnpredictableBenefit); let currency = currency::(&owner); - let amount = 1000.into(); - let pnum = 1.into(); + let amount = 1000u32.into(); + let pnum =1u64.into(); portfolio::(&owner, pnum, currency, amount); }: _(owner.origin(), ca_id, Some(pnum), currency, amount, 3000, Some(4000)) verify { ensure!(>::get(ca_id).is_some(), "distribution not created"); } - // TODO(Centril): make this work with WASM execution. claim { - let i in 0..MAX_TARGETS; - let j in 0..MAX_DID_WHT_IDS; + let t in 0..MAX_TARGETS; + let w in 0..MAX_DID_WHT_IDS; - let (_, holder, ca_id) = prepare_transfer::(i, j); + let (_, holder, ca_id) = prepare_transfer::(t, w); }: _(holder.origin(), ca_id) verify { ensure!(HolderPaid::get((ca_id, holder.did())), "not paid"); } - // TODO(Centril): make this work with WASM execution. push_benefit { - let i in 0..MAX_TARGETS; - let j in 0..MAX_DID_WHT_IDS; + let t in 0..MAX_TARGETS; + let w in 0..MAX_DID_WHT_IDS; - let (owner, holder, ca_id) = prepare_transfer::(i, j); + let (owner, holder, ca_id) = prepare_transfer::(t, w); }: _(owner.origin(), ca_id, holder.did()) verify { ensure!(HolderPaid::get((ca_id, holder.did())), "not paid"); @@ -157,7 +137,7 @@ benchmarks! { reclaim { let (owner, ca_id, currency) = dist::(0); - >::set(5000.into()); + >::set(5000u32.into()); }: _(owner.origin(), ca_id) verify { ensure!(>::get(ca_id).unwrap().reclaimed, "not reclaimed"); diff --git a/pallets/corporate-actions/src/distribution/mod.rs b/pallets/corporate-actions/src/distribution/mod.rs index 37207f25e0..3caff6aed5 100644 --- a/pallets/corporate-actions/src/distribution/mod.rs +++ b/pallets/corporate-actions/src/distribution/mod.rs @@ -176,6 +176,10 @@ decl_module! { /// - `UnauthorizedCustodian` if CAA is not the custodian of `portfolio`. /// - `InsufficientPortfolioBalance` if `portfolio` has less than `amount` of `currency`. /// - `InsufficientBalance` if the protocol fee couldn't be charged. + /// + /// # Permissions + /// * Asset + /// * Portfolio #[weight = ::DistWeightInfo::distribute()] pub fn distribute( origin, @@ -329,7 +333,7 @@ decl_module! { Self::unlock(&dist, dist.remaining)?; // Zero `remaining` + note that we've reclaimed. - >::insert(ca_id, Distribution { reclaimed: true, remaining: 0.into(), ..dist }); + >::insert(ca_id, Distribution { reclaimed: true, remaining:0u32.into(), ..dist }); // Emit event. Self::deposit_event(Event::::Reclaimed(did, ca_id, dist.remaining)); diff --git a/pallets/corporate-actions/src/lib.rs b/pallets/corporate-actions/src/lib.rs index 592d536c34..72a4df160d 100644 --- a/pallets/corporate-actions/src/lib.rs +++ b/pallets/corporate-actions/src/lib.rs @@ -92,6 +92,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![feature(bool_to_option)] #![feature(crate_visibility_modifier)] +#![feature(const_option)] #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; @@ -111,7 +112,7 @@ use frame_support::{ use frame_system::ensure_root; use pallet_asset::{ self as asset, - checkpoint::{self, ScheduleId}, + checkpoint::{self, ScheduleId, SchedulePoints, ScheduleRefCount}, }; use pallet_identity::{self as identity, PermissionedCallOriginData}; use polymesh_common_utilities::{ @@ -120,9 +121,10 @@ use polymesh_common_utilities::{ with_transaction, GC_DID, }; use polymesh_primitives::{ - calendar::CheckpointId, AuthorizationData, DocumentId, EventDid, IdentityId, Moment, Ticker, + calendar::CheckpointId, storage_migrate_on, storage_migration_ver, AuthorizationData, + DocumentId, EventDid, IdentityId, Moment, Ticker, }; -use polymesh_primitives_derive::VecU8StrongTyped; +use polymesh_primitives_derive::{Migrate, VecU8StrongTyped}; use sp_arithmetic::Permill; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; @@ -223,11 +225,15 @@ pub struct CADetails(pub Vec); /// Defines how to identify a CA's associated checkpoint, if any. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Debug, Migrate)] pub enum CACheckpoint { /// CA uses a record date scheduled to occur in the future. /// Checkpoint ID will be taken after the record date. - Scheduled(ScheduleId), + /// + /// Since a schedule can be recurring, + /// the `u64` stores the number of checkpoints before the CA was made. + /// This allows indexing into the list of CPs, getting exactly the right one. + Scheduled(ScheduleId, #[migrate_with(0)] u64), /// CA uses an existing checkpoint ID which was recorded in the past. Existing(CheckpointId), } @@ -235,11 +241,12 @@ pub enum CACheckpoint { /// Defines the record date, at which impact should be calculated, /// along with checkpoint info to assess the impact at the date. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Debug, Migrate)] pub struct RecordDate { /// When the impact should be calculated, or already has. pub date: Moment, /// Info used to determine the `CheckpointId` once `date` has passed. + #[migrate] pub checkpoint: CACheckpoint, } @@ -259,13 +266,14 @@ pub enum RecordDateSpec { /// Details of a generic CA. /// The `(Ticker, ID)` denoting a unique identifier for the CA is stored as a key outside. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Clone, PartialEq, Eq, Encode, Decode, Debug, Migrate)] pub struct CorporateAction { /// The kind of CA that this is. pub kind: CAKind, /// When the CA was declared off-chain. pub decl_date: Moment, /// Date at which any impact, if any, should be calculated. + #[migrate(RecordDate)] pub record_date: Option, /// Free-form text up to a limit. pub details: CADetails, @@ -413,9 +421,14 @@ decl_storage! { /// The `CorporateActions` map stores `Ticker => LocalId => The CA`, /// so we can infer `Ticker => CAId`. Therefore, we don't need a double map. pub CADocLink get(fn ca_doc_link): map hasher(blake2_128_concat) CAId => Vec; + + /// Storage version. + StorageVersion get(fn storage_version) build(|_| Version::new(1).unwrap()): Version; } } +storage_migration_ver!(1); + // Public interface for this runtime module. decl_module! { pub struct Module for enum Call where origin: T::Origin { @@ -424,6 +437,15 @@ decl_module! { /// initialize the default event for this module fn deposit_event() = default; + fn on_runtime_upgrade() -> Weight { + storage_migrate_on!(StorageVersion::get(), 1, { + use polymesh_primitives::migrate::{Empty, migrate_map}; + migrate_map::(b"CorporateActions", b"CorporateActions", |_| Empty); + }); + + 0 + } + /// Set the max `length` of `details` in terms of bytes. /// May only be called via a PIP. #[weight = ::WeightInfo::set_max_details_length()] @@ -441,6 +463,9 @@ decl_module! { /// /// ## Errors /// - `Unauthorized` if `origin` isn't `ticker`'s owner. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::reset_caa()] pub fn reset_caa(origin, ticker: Ticker) { let did = >::ensure_perms_owner_asset(origin, &ticker)?; @@ -457,6 +482,9 @@ decl_module! { /// ## Errors /// - `UnauthorizedAsAgent` if `origin` is not `ticker`'s sole CAA (owner is not necessarily the CAA). /// - `TooManyTargetIds` if `targets.identities.len() > T::MaxTargetIds::get()`. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::set_default_targets(targets.identities.len() as u32)] pub fn set_default_targets(origin, ticker: Ticker, targets: TargetIdentities) { let caa = Self::ensure_ca_agent(origin, ticker)?; @@ -480,6 +508,9 @@ decl_module! { /// /// ## Errors /// - `UnauthorizedAsAgent` if `origin` is not `ticker`'s sole CAA (owner is not necessarily the CAA). + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::set_default_withholding_tax()] pub fn set_default_withholding_tax(origin, ticker: Ticker, tax: Tax) { let caa = Self::ensure_ca_agent(origin, ticker)?; @@ -500,6 +531,9 @@ decl_module! { /// ## Errors /// - `UnauthorizedAsAgent` if `origin` is not `ticker`'s sole CAA (owner is not necessarily the CAA). /// - `TooManyDidTaxes` if `Some(tax)` and adding the override would go over the limit `MaxDidWhts`. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::set_did_withholding_tax(T::MaxDidWhts::get())] pub fn set_did_withholding_tax(origin, ticker: Ticker, taxed_did: IdentityId, tax: Option) { let caa = Self::ensure_ca_agent(origin, ticker)?; @@ -547,7 +581,13 @@ decl_module! { /// - `TooManyTargetIds` if `targets.unwrap().identities.len() > T::MaxTargetIds::get()`. /// - `DeclDateInFuture` if the declaration date is not in the past. /// - When `record_date.is_some()`, other errors due to checkpoint scheduling may occur. - #[weight = ::WeightInfo::initiate_corporate_action_use_defaults(1, 1) + /// + /// # Permissions + /// * Asset + #[weight = ::WeightInfo::initiate_corporate_action_use_defaults( + T::MaxDidWhts::get(), + T::MaxTargetIds::get(), + ) .max(::WeightInfo::initiate_corporate_action_provided( withholding_tax.as_ref().map_or(0, |whts| whts.len() as u32), targets.as_ref().map_or(0, |t| t.identities.len() as u32), @@ -651,6 +691,9 @@ decl_module! { /// - `UnauthorizedAsAgent` if `origin` is not `ticker`'s sole CAA (owner is not necessarily the CAA). /// - `NoSuchCA` if `id` does not identify an existing CA. /// - `NoSuchDoc` if any of `docs` does not identify an existing document. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::link_ca_doc(docs.len() as u32)] pub fn link_ca_doc(origin, id: CAId, docs: Vec) { // Ensure that CAA is calling and that CA and the docs exists. @@ -666,9 +709,13 @@ decl_module! { } /// Removes the CA identified by `ca_id`. + /// /// Associated data, such as document links, ballots, /// and capital distributions are also removed. /// + /// Any schedule associated with the record date will see + /// `strong_ref_count(schedule_id)` decremented. + /// /// ## Arguments /// - `origin` which must be a signer for the CAA of `ca_id`. /// - `ca_id` of the CA to remove. @@ -676,6 +723,9 @@ decl_module! { /// # Errors /// - `UnauthorizedAsAgent` if `origin` is not `ticker`'s sole CAA (owner is not necessarily the CAA). /// - `NoSuchCA` if `id` does not identify an existing CA. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::remove_ca_with_ballot() .max(::WeightInfo::remove_ca_with_dist())] pub fn remove_ca(origin, ca_id: CAId) { @@ -698,7 +748,8 @@ decl_module! { } } - // Remove + emit event. + // Decrement, Remove, and Emit event. + Self::dec_strong_ref_count(ca_id, ca.record_date); CorporateActions::remove(ca_id.ticker, ca_id.local_id); CADocLink::remove(ca_id); Self::deposit_event(Event::CARemoved(caa, ca_id)); @@ -716,6 +767,9 @@ decl_module! { /// - `UnauthorizedAsAgent` if `origin` is not `ticker`'s sole CAA (owner is not necessarily the CAA). /// - `NoSuchCA` if `id` does not identify an existing CA. /// - When `record_date.is_some()`, other errors due to checkpoint scheduling may occur. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::change_record_date_with_ballot() .max(::WeightInfo::change_record_date_with_dist())] pub fn change_record_date(origin, ca_id: CAId, record_date: Option) { @@ -725,6 +779,7 @@ decl_module! { with_transaction(|| -> DispatchResult { // If provided, either use the existing CP ID or schedule one to be made. + Self::dec_strong_ref_count(ca_id, ca.record_date); ca.record_date = record_date .map(|date| Self::handle_record_date(caa, ca_id.ticker, date)) .transpose()?; @@ -820,8 +875,6 @@ decl_error! { DeclDateInFuture, /// CA does not target the DID. NotTargetedByCA, - /// An existing schedule was used for a new CA that was removable, and that is not allowed. - ExistingScheduleRemovable, } } @@ -876,7 +929,7 @@ impl Module { let ticker = ca_id.ticker; match cp { // CP exists, use it. - Some(cp_id) => >::total_supply_at((ticker, cp_id)), + Some(cp_id) => >::total_supply_at(ticker, cp_id), // Although record date has passed, no transfers have happened yet for `ticker`. // Thus, there is no checkpoint ID, and we must use current supply instead. None => >::token_details(ticker).total_supply, @@ -902,9 +955,13 @@ impl Module { let ticker = ca_id.ticker; match ca.record_date.unwrap().checkpoint { CACheckpoint::Existing(id) => Some(id), - // For CAs, there will ever be at most one CP. - // And assuming transfers have happened since the record date, there's exactly one CP. - CACheckpoint::Scheduled(id) => >::schedule_points((ticker, id)).pop(), + // For CAs, there can be more than one CP, + // since you may attach a pre-existing and recurring schedule to it. + // However, the record date stores the index for the CP, + // assuming a transfer has happened since the record date. + CACheckpoint::Scheduled(id, idx) => >::schedule_points(ticker, id) + .get(idx as usize) + .copied(), } } @@ -914,6 +971,18 @@ impl Module { Ok(()) } + /// Decrement the strong reference count of any schedule used in the `record_date` of `ca_id`. + fn dec_strong_ref_count(ca_id: CAId, record_date: Option) { + if let Some(RecordDate { + checkpoint: CACheckpoint::Scheduled(sh_id, _), + .. + }) = record_date + { + // We've proven by getting here that `c > 0`, so `c - 1` cannot underflow. + ScheduleRefCount::mutate(ca_id.ticker, sh_id, |c| *c -= 1); + } + } + /// Translate record date to a format we can store. /// In the process, create a checkpoint schedule if needed. fn handle_record_date( @@ -924,21 +993,22 @@ impl Module { let (date, checkpoint) = match date { RecordDateSpec::Scheduled(date) => { // Create the schedule and extract the date + id. + // We set initial `strong_ref_count(id) <- 1`. let date = date.into(); - let schedule = >::create_schedule_base(caa, ticker, date, false)?; - (schedule.at, CACheckpoint::Scheduled(schedule.id)) + let schedule = >::create_schedule_base(caa, ticker, date, 1)?; + // It might be the case that the CP was instantly created ^--. + // Or it might not have. In either case, it will end up at index 0. + (schedule.at, CACheckpoint::Scheduled(schedule.id, 0)) } RecordDateSpec::ExistingSchedule(id) => { - // Schedule cannot be removable, otherwise the CP module may remove it, - // resulting a "dangling reference", figuratively speaking. - ensure!( - !>::schedule_removable((ticker, id)), - Error::::ExistingScheduleRemovable, - ); // Ensure the schedule exists and extract the record date. let schedules = >::schedules(ticker); let schedule = schedules[>::ensure_schedule_exists(&schedules, id)?]; - (schedule.at, CACheckpoint::Scheduled(schedule.id)) + // Schedule cannot be removable, otherwise the CP module may remove it, + // so we increment the strong reference count of `id`. + ScheduleRefCount::mutate(ticker, id, |c| *c += 1); + let cp_at_idx = SchedulePoints::decode_len(ticker, id).unwrap_or(0) as u64; + (schedule.at, CACheckpoint::Scheduled(schedule.id, cp_at_idx)) } RecordDateSpec::Existing(id) => { // Ensure the CP exists. @@ -946,7 +1016,10 @@ impl Module { >::checkpoint_exists(&ticker, id), Error::::NoSuchCheckpointId ); - (>::timestamps(id), CACheckpoint::Existing(id)) + ( + >::timestamps(ticker, id), + CACheckpoint::Existing(id), + ) } }; Ok(RecordDate { date, checkpoint }) diff --git a/pallets/group/Cargo.toml b/pallets/group/Cargo.toml index f2dfe860eb..809397c38d 100644 --- a/pallets/group/Cargo.toml +++ b/pallets/group/Cargo.toml @@ -15,26 +15,26 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false # Substrate codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Only for benchmarking -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } [features] equalize = [] default = ["std", "equalize"] no_std = [] only-staking = [] -std = [ +std = [ "serde_derive", "serde/std", "codec/std", diff --git a/pallets/group/rpc/Cargo.toml b/pallets/group/rpc/Cargo.toml index bfcdedd137..ea28871056 100644 --- a/pallets/group/rpc/Cargo.toml +++ b/pallets/group/rpc/Cargo.toml @@ -21,10 +21,10 @@ jsonrpc-derive = "15.0.0" # Substrate codec = { package = "parity-scale-codec", version = "1.2.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-blockchain = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0"} -sp-std = {git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } -sp-api = {git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-blockchain = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1"} +sp-std = {git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } +sp-api = {git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } [dev-dependencies] -substrate-test-runtime-client = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } +substrate-test-runtime-client = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } diff --git a/pallets/group/rpc/runtime-api/Cargo.toml b/pallets/group/rpc/runtime-api/Cargo.toml index d71d0b6854..1158561477 100644 --- a/pallets/group/rpc/runtime-api/Cargo.toml +++ b/pallets/group/rpc/runtime-api/Cargo.toml @@ -14,9 +14,9 @@ serde = { version = "1.0.104", optional = true, features = ["derive"] } # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-api = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } -sp-std = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } -sp-runtime = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } +sp-api = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } +sp-std = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } +sp-runtime = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } [dev-dependencies] serde_json = "1.0.41" diff --git a/pallets/group/src/benchmarking.rs b/pallets/group/src/benchmarking.rs index 8c6b3672ed..9efa00f41b 100644 --- a/pallets/group/src/benchmarking.rs +++ b/pallets/group/src/benchmarking.rs @@ -21,7 +21,7 @@ fn make_users, I: Instance>(m: u32) -> Vec>() + .collect() } /// Create `m` new users and add them into the group. @@ -90,7 +90,7 @@ benchmarks_instance! { disable_member { let members = make_members::(MAX_MEMBERS); let target = members.last().unwrap().clone(); - let expiry_at = Some(200.into()); + let expiry_at = Some(200u32.into()); }: _(RawOrigin::Root, target, expiry_at, None) verify { assert_eq!( Module::::get_members().contains(&target), false); diff --git a/pallets/identity/Cargo.toml b/pallets/identity/Cargo.toml index 1895bc4fab..0236b80797 100644 --- a/pallets/identity/Cargo.toml +++ b/pallets/identity/Cargo.toml @@ -16,29 +16,30 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false either = { version = "1.6.1", default-features = false } # Cryptography -confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "v2.2.0" } +confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "v2.2.2" } schnorrkel = { git = "https://github.com/PolymathNetwork/schnorrkel.git", branch = "fix-simd-issue", default-features = false, optional = true } # Substrate codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Only in STD -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } [features] equalize = [] default = ["std", "equalize"] no_cdd = [] +running-ci = [] no_std = [ "confidential_identity/u64_backend", ] diff --git a/pallets/identity/src/benchmarking.rs b/pallets/identity/src/benchmarking.rs index 75ac23f758..7bc1f7a3ed 100644 --- a/pallets/identity/src/benchmarking.rs +++ b/pallets/identity/src/benchmarking.rs @@ -13,9 +13,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] use crate::*; +use frame_benchmarking::{account, benchmarks}; +use frame_system::RawOrigin; use polymesh_common_utilities::{ benchs::{uid_from_name_and_idx, User, UserBuilder}, traits::identity::TargetIdAuthorization, @@ -23,9 +24,6 @@ use polymesh_common_utilities::{ use polymesh_primitives::{ AuthorizationData, Claim, CountryCode, IdentityId, Permissions, Scope, Signatory, }; - -use frame_benchmarking::{account, benchmarks}; -use frame_system::RawOrigin; use sp_std::prelude::*; const SEED: u32 = 0; @@ -47,7 +45,7 @@ fn setup_investor_uniqueness_claim( 191, 123, 156, 212, 20, 215, 87, 23, 42, 84, 181, 128, 73, ]); let cdd_claim = Claim::CustomerDueDiligence(cdd_id); - Module::::base_add_claim(did, cdd_claim, did, Some(666.into())); + Module::::base_add_claim(did, cdd_claim, did, Some(666u32.into())); let scope = Scope::Custom([228u8, 152, 116, 104, 5, 8, 30, 188, 143, 185, 10, 208].to_vec()); let scope_did = IdentityId::from([ @@ -82,12 +80,24 @@ fn generate_secondary_keys( secondary_keys } +#[cfg(feature = "running-ci")] +mod limits { + pub const MAX_SECONDARY_KEYS: u32 = 2; +} + +#[cfg(not(feature = "running-ci"))] +mod limits { + pub const MAX_SECONDARY_KEYS: u32 = 100; +} + +use limits::*; + benchmarks! { _ {} register_did { // Number of secondary items. - let i in 0 .. 50; + let i in 0 .. MAX_SECONDARY_KEYS; let _cdd = UserBuilder::::default().generate_did().become_cdd_provider().build("cdd"); let caller = UserBuilder::::default().build("caller"); @@ -97,7 +107,7 @@ benchmarks! { cdd_register_did { // Number of secondary items. - let i in 0 .. 50; + let i in 0 .. MAX_SECONDARY_KEYS; let cdd = UserBuilder::::default().generate_did().become_cdd_provider().build("cdd"); let target: T::AccountId = account("target", SEED, SEED); @@ -116,11 +126,11 @@ benchmarks! { let cdd = UserBuilder::::default().generate_did().become_cdd_provider().build("cdd"); - }: _(RawOrigin::Root, cdd.did(), 0.into(), None) + }: _(RawOrigin::Root, cdd.did(), 0u32.into(), None) remove_secondary_keys { // Number of secondary items. - let i in 0 .. 50; + let i in 0 .. MAX_SECONDARY_KEYS; let target = UserBuilder::::default().generate_did().build("target"); @@ -155,7 +165,18 @@ benchmarks! { ); }: _(new_key.origin, owner_auth_id, Some(cdd_auth_id)) - change_cdd_requirement_for_mk_rotation {}: _(RawOrigin::Root, true) + change_cdd_requirement_for_mk_rotation { + ensure!( + Module::::cdd_auth_for_primary_key_rotation() == false, + "CDD auth for primary key rotation is enabled" + ); + }: _(RawOrigin::Root, true) + verify { + ensure!( + Module::::cdd_auth_for_primary_key_rotation() == true, + "CDD auth for primary key rotation did not change" + ); + } join_identity_as_key { let target = UserBuilder::::default().generate_did().build("target"); @@ -186,9 +207,22 @@ benchmarks! { let key = UserBuilder::::default().build("key"); let signatory = Signatory::Account(key.account()); - Module::::unsafe_join_identity(target.did(), Permissions::default(), signatory)?; - - }: _(key.origin) + let auth_id = Module::::add_auth( + target.did(), + signatory, + AuthorizationData::JoinIdentity(Permissions::default()), + None, + ); + Module::::join_identity_as_key(key.origin().into(), auth_id) + .expect("Key cannot be joined to identity"); + + }: _(key.origin()) + verify { + ensure!( + KeyToIdentityIds::::contains_key(key.account) == false, + "Key was not removed from its identity" + ); + } leave_identity_as_identity { let target = UserBuilder::::default().generate_did().build("target"); @@ -204,7 +238,7 @@ benchmarks! { let target = UserBuilder::::default().generate_did().build("target"); let scope = Scope::Identity(caller.did()); let claim = Claim::Jurisdiction(CountryCode::BB, scope); - }: _(caller.origin, target.did(), claim, Some(666.into())) + }: _(caller.origin, target.did(), claim, Some(666u32.into())) forwarded_call { // NB: The automated weight calculation does not account for weight of the transaction being forwarded. @@ -221,7 +255,7 @@ benchmarks! { revoke_claim { let (caller, conf_scope_claim, inv_proof) = setup_investor_uniqueness_claim::("caller"); - Module::::add_investor_uniqueness_claim(caller.origin.clone().into(), caller.did(), conf_scope_claim.clone(), inv_proof, Some(666.into()))?; + Module::::add_investor_uniqueness_claim(caller.origin.clone().into(), caller.did(), conf_scope_claim.clone(), inv_proof, Some(666u32.into()))?; }: _(caller.origin, caller.did(), conf_scope_claim) set_permission_to_signer { @@ -245,7 +279,7 @@ benchmarks! { let caller = UserBuilder::::default().generate_did().build("caller"); let signatory = Signatory::Identity(caller.did()); let auth_data = AuthorizationData::JoinIdentity(Permissions::default()); - }: _(caller.origin, signatory, auth_data, Some(666.into())) + }: _(caller.origin, signatory, auth_data, Some(666u32.into())) remove_authorization { let caller = UserBuilder::::default().generate_did().build("caller"); @@ -254,7 +288,7 @@ benchmarks! { caller.did(), signatory.clone(), AuthorizationData::JoinIdentity(Permissions::default()), - Some(666.into()), + Some(666u32.into()), ); }: _(caller.origin, signatory, auth_id, true) @@ -309,11 +343,11 @@ benchmarks! { let authorization = TargetIdAuthorization:: { target_id: caller.did(), nonce, - expires_at: 600.into(), + expires_at: 600u32.into(), }; }: _(caller.origin, Signatory::Identity(caller.did()), authorization) add_investor_uniqueness_claim { let (caller, conf_scope_claim, inv_proof) = setup_investor_uniqueness_claim::("caller"); - }: _(caller.origin, caller.did(), conf_scope_claim, inv_proof, Some(666.into())) + }: _(caller.origin, caller.did(), conf_scope_claim, inv_proof, Some(666u32.into())) } diff --git a/pallets/identity/src/lib.rs b/pallets/identity/src/lib.rs index a5aee10098..bd3c01ebe8 100644 --- a/pallets/identity/src/lib.rs +++ b/pallets/identity/src/lib.rs @@ -1696,7 +1696,7 @@ impl Module { ); } else { ensure!( - !Self::base_fetch_valid_cdd_claims(target, 0.into(), None).any(|id_claim| { + !Self::base_fetch_valid_cdd_claims(target, 0u32.into(), None).any(|id_claim| { if let Claim::CustomerDueDiligence(c_id) = id_claim.claim { return !c_id.is_default_cdd() && c_id != *cdd_id; } diff --git a/pallets/im-online/Cargo.toml b/pallets/im-online/Cargo.toml index 29013872d3..9c337018bb 100644 --- a/pallets/im-online/Cargo.toml +++ b/pallets/im-online/Cargo.toml @@ -11,22 +11,22 @@ serde = { version = "1.0.104", optional = true } # Substrate codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-staking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-staking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0", features = ["historical"] } +pallet-authorship = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1", features = ["historical"] } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-application-crypto = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Only in STD -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0", optional = true } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1", optional = true } [features] default = ["std", "pallet-session/historical"] no_std = [] diff --git a/pallets/im-online/src/benchmarking.rs b/pallets/im-online/src/benchmarking.rs index 8120baddb4..ca490dd15a 100644 --- a/pallets/im-online/src/benchmarking.rs +++ b/pallets/im-online/src/benchmarking.rs @@ -17,8 +17,6 @@ //! I'm Online pallet benchmarking. -#![cfg(feature = "runtime-benchmarks")] - use super::*; use frame_benchmarking::benchmarks; diff --git a/pallets/im-online/src/lib.rs b/pallets/im-online/src/lib.rs index 2291985f58..c2f471ab73 100644 --- a/pallets/im-online/src/lib.rs +++ b/pallets/im-online/src/lib.rs @@ -631,7 +631,7 @@ impl Module { // clear the lock in case we have failed to send transaction. if res.is_err() { - new_status.sent_at = 0.into(); + new_status.sent_at = 0u32.into(); storage.set(&new_status); } @@ -674,7 +674,7 @@ impl pallet_session::OneSessionHandler for Module { // Since we consider producing blocks as being online, // the heartbeat is deferred a bit to prevent spamming. let block_number = >::block_number(); - let half_session = T::SessionDuration::get() / 2.into(); + let half_session = T::SessionDuration::get() / 2u32.into(); >::put(block_number + half_session); // Remember who the authorities are for the new session. @@ -766,7 +766,7 @@ impl frame_support::unsigned::ValidateUnsigned for Module { .priority(T::UnsignedPriority::get()) .and_provides((current_session, authority_id)) .longevity( - TryInto::::try_into(T::SessionDuration::get() / 2.into()) + TryInto::::try_into(T::SessionDuration::get() / 2u32.into()) .unwrap_or(64_u64), ) .propagate(true) diff --git a/pallets/im-online/src/tests.rs b/pallets/im-online/src/tests.rs index 273ecd4476..5280a29b1c 100644 --- a/pallets/im-online/src/tests.rs +++ b/pallets/im-online/src/tests.rs @@ -260,7 +260,7 @@ fn should_mark_online_validator_when_heartbeat_is_received() { assert!(!ImOnline::is_online(2)); // when - let _ = heartbeat(1, 2, 0, 1.into(), Session::validators()).unwrap(); + let _ = heartbeat(1, 2, 0, 1u32.into(), Session::validators()).unwrap(); // then assert!(ImOnline::is_online(0)); @@ -292,17 +292,17 @@ fn late_heartbeat_and_invalid_keys_len_should_fail() { // when assert_noop!( - heartbeat(1, 3, 0, 1.into(), Session::validators()), + heartbeat(1, 3, 0, 1u32.into(), Session::validators()), "Transaction is outdated" ); assert_noop!( - heartbeat(1, 1, 0, 1.into(), Session::validators()), + heartbeat(1, 1, 0, 1u32.into(), Session::validators()), "Transaction is outdated" ); // invalid validators_len assert_noop!( - heartbeat(1, 2, 0, 1.into(), vec![]), + heartbeat(1, 2, 0, 1u32.into(), vec![]), "invalid validators len" ); }); @@ -372,7 +372,7 @@ fn should_cleanup_received_heartbeats_on_session_end() { assert_eq!(Session::validators(), vec![1, 2, 3]); // send an heartbeat from authority id 0 at session 2 - let _ = heartbeat(1, 2, 0, 1.into(), Session::validators()).unwrap(); + let _ = heartbeat(1, 2, 0, 1u32.into(), Session::validators()).unwrap(); // the heartbeat is stored assert!(!ImOnline::received_heartbeats(&2, &0).is_none()); diff --git a/pallets/multisig/Cargo.toml b/pallets/multisig/Cargo.toml index c73aaab6c5..b6ef4e2eb1 100644 --- a/pallets/multisig/Cargo.toml +++ b/pallets/multisig/Cargo.toml @@ -17,16 +17,16 @@ serde = { version = "1.0.104", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } [features] equalize = [] diff --git a/pallets/multisig/src/benchmarking.rs b/pallets/multisig/src/benchmarking.rs index fe9cfd1766..a7f1777a41 100644 --- a/pallets/multisig/src/benchmarking.rs +++ b/pallets/multisig/src/benchmarking.rs @@ -13,7 +13,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] use crate::*; use frame_benchmarking::benchmarks; use frame_system::RawOrigin; @@ -208,28 +207,28 @@ benchmarks! { create_or_approve_proposal_as_identity { let (alice, multisig, signers, _, proposal_id, proposal, ephemeral_multisig) = generate_multisig_and_proposal_for_alice::(1, 1)?; - }: _(alice.origin(), ephemeral_multisig, proposal, Some(1337.into()), true) + }: _(alice.origin(), ephemeral_multisig, proposal, Some(1337u32.into()), true) verify { ensure_proposal_created!(proposal_id, multisig); } create_or_approve_proposal_as_key { let (alice, multisig, _, signer_origin, proposal_id, proposal, ephemeral_multisig) = generate_multisig_and_proposal_for_alice::(2, 1)?; - }: _(signer_origin, ephemeral_multisig, proposal, Some(1337.into()), true) + }: _(signer_origin, ephemeral_multisig, proposal, Some(1337u32.into()), true) verify { ensure_proposal_created!(proposal_id, multisig); } create_proposal_as_identity { let (alice, multisig, _, _, proposal_id, proposal, ephemeral_multisig) = generate_multisig_and_proposal_for_alice::(1, 1)?; - }: _(alice.origin(), ephemeral_multisig, proposal, Some(1337.into()), true) + }: _(alice.origin(), ephemeral_multisig, proposal, Some(1337u32.into()), true) verify { ensure_proposal_created!(proposal_id, multisig); } create_proposal_as_key { let (_, multisig, _, signer_origin, proposal_id, proposal, ephemeral_multisig) = generate_multisig_and_proposal_for_alice::(2, 1)?; - }: _(signer_origin, ephemeral_multisig, proposal, Some(1337.into()), true) + }: _(signer_origin, ephemeral_multisig, proposal, Some(1337u32.into()), true) verify { ensure_proposal_created!(proposal_id, multisig); } diff --git a/pallets/multisig/src/lib.rs b/pallets/multisig/src/lib.rs index eec15388b8..17e12b34b4 100644 --- a/pallets/multisig/src/lib.rs +++ b/pallets/multisig/src/lib.rs @@ -59,7 +59,7 @@ //! - `change_sigs_required` - Changes the number of signatures required to execute a transaction. //! - `make_multisig_signer` - Adds a multisig as a signer of the current DID if the current DID is //! the creator of the multisig. -//! - `make_multisig_primary` - Adds a multisig as the primary key of the current DID if the current did +//! - `make_multisig_primary` - Adds a multisig as the primary key of the current DID if the current DID //! is the creator of the multisig. //! //! ### Other Public Functions @@ -293,10 +293,8 @@ decl_module! { expiry: Option, auto_close: bool ) { - let sender = ensure_signed(origin)?; - let sender_did = Context::current_identity_or::>(&sender)?; - let sender_signer = Signatory::from(sender_did); - Self::create_or_approve_proposal(multisig, sender_signer, proposal, expiry, auto_close)?; + let signer = Self::ensure_signed_did(origin)?; + Self::create_or_approve_proposal(multisig, signer, proposal, expiry, auto_close)?; } /// Creates a multisig proposal if it hasn't been created or approves it if it has. @@ -490,10 +488,10 @@ decl_module! { ensure!(Self::is_changing_signers_allowed(&multisig), Error::::ChangeNotAllowed); let signers_len: u64 = u64::try_from(signers.len()).unwrap_or_default(); - // NB: the below check can be underflow but that doesn't matter - // because the checks in the next loop will fail in that case. + let pending_num_of_signers = >::get(&multisig).checked_sub(signers_len) + .ok_or(Error::::TooManySigners)?; ensure!( - >::get(&multisig) - signers_len >= >::get(&multisig), + pending_num_of_signers >= >::get(&multisig), Error::::NotEnoughSigners ); @@ -505,7 +503,7 @@ decl_module! { Self::unsafe_signer_removal(multisig.clone(), signer); } - >::mutate(&multisig, |x| *x -= signers_len); + >::insert(&multisig, pending_num_of_signers); } /// Changes the number of signatures required by a multisig. This must be called by the @@ -547,7 +545,7 @@ decl_module! { ) } - /// Adds a multisig as the primary key of the current did if the current did is the creator + /// Adds a multisig as the primary key of the current did if the current DID is the creator /// of the multisig. /// /// # Arguments @@ -678,6 +676,8 @@ decl_error! { MultisigMissingIdentity, /// Scheduling of a proposal fails FailedToSchedule, + /// More signers than required. + TooManySigners, } } diff --git a/pallets/permissions/Cargo.toml b/pallets/permissions/Cargo.toml index 08b621d231..6265a4f514 100644 --- a/pallets/permissions/Cargo.toml +++ b/pallets/permissions/Cargo.toml @@ -14,17 +14,17 @@ serde = { version = "1.0.104", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Only for benchmarking -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0", optional = true } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1", optional = true } [features] equalize = [] -default = ["std", "equalize", "runtime-benchmarks"] +default = ["std", "equalize"] no_std = [] only-staking = [] std = [ diff --git a/pallets/permissions/src/benchmarking.rs b/pallets/permissions/src/benchmarking.rs index 0f6c3bdb37..baa1effe47 100644 --- a/pallets/permissions/src/benchmarking.rs +++ b/pallets/permissions/src/benchmarking.rs @@ -1,9 +1,8 @@ use crate::*; -use polymesh_primitives::{DispatchableName, PalletName}; - use frame_benchmarking::benchmarks; use frame_support::ensure; +use polymesh_primitives::{DispatchableName, PalletName}; use sp_std::{iter, prelude::*}; const MAX_PALLET_NAME_LENGTH: u32 = 512; diff --git a/pallets/permissions/src/lib.rs b/pallets/permissions/src/lib.rs index 0a4d435193..28301ac43b 100644 --- a/pallets/permissions/src/lib.rs +++ b/pallets/permissions/src/lib.rs @@ -116,10 +116,14 @@ impl StoreCallMetadata { } } -impl SignedExtension for StoreCallMetadata { +impl SignedExtension for StoreCallMetadata +where + T: Trait + Send + Sync, + ::Call: GetCallMetadata, +{ const IDENTIFIER: &'static str = "StoreCallMetadata"; type AccountId = T::AccountId; - type Call = ::Call; + type Call = ::Call; type AdditionalSigned = (); type Pre = (); diff --git a/pallets/pips/Cargo.toml b/pallets/pips/Cargo.toml index ff8ab8034e..095dbf8836 100644 --- a/pallets/pips/Cargo.toml +++ b/pallets/pips/Cargo.toml @@ -8,6 +8,7 @@ edition = "2018" polymesh-common-utilities = { path = "../common", default-features = false } polymesh-primitives = { path = "../../primitives", default-features = false } polymesh-primitives-derive = { path = "../../primitives_derive", default-features = false } +polymesh-runtime-common = { path = "../runtime/common", default-features = false } pallet-group = { path = "../group", default-features = false } pallet-identity = { path = "../identity", default-features = false } @@ -20,20 +21,22 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false # Substrate codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-system = { package = "frame-system", git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { package = "frame-system", git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Benchmarking -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } +rand = { version = "0.8.2", default-features = false, optional = true } +rand_chacha = { version = "0.3.0", default-features = false, optional = true } pallet-committee = { path = "../committee", default-features = false, optional = true } [features] @@ -41,6 +44,7 @@ equalize = [] default = ["std", "equalize"] no_std = [] only-staking = [] +running-ci = [] std = [ "codec/std", "frame-support/std", @@ -52,6 +56,7 @@ std = [ "pallet-treasury/std", "polymesh-common-utilities/std", "polymesh-primitives/std", + "polymesh-runtime-common/std", "serde/std", "serde_derive", "sp-api/std", @@ -63,5 +68,7 @@ std = [ ] runtime-benchmarks = [ "frame-benchmarking", + "rand", + "rand_chacha", "pallet-committee", ] diff --git a/pallets/pips/src/benchmarking.rs b/pallets/pips/src/benchmarking.rs index 2ed46d99d1..a8d9be2de7 100644 --- a/pallets/pips/src/benchmarking.rs +++ b/pallets/pips/src/benchmarking.rs @@ -13,32 +13,50 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] use crate::*; -use pallet_identity::{self as identity}; -use polymesh_common_utilities::{ - benchs::{User, UserBuilder}, - MaybeBlock, SystematicIssuers, GC_DID, -}; - use frame_benchmarking::benchmarks; use frame_support::{ dispatch::{DispatchError, DispatchResult}, + ensure, traits::UnfilteredDispatchable, }; use frame_system::RawOrigin; +use polymesh_common_utilities::{ + benchs::{user, User}, + MaybeBlock, SystematicIssuers, GC_DID, +}; +use rand::{seq::SliceRandom, SeedableRng}; +use rand_chacha::ChaCha20Rng; use sp_std::{ convert::{TryFrom, TryInto}, + iter, prelude::*, }; -const DESCRIPTION_LEN: usize = 1_000; -const URL_LEN: usize = 500; -const PROPOSAL_PADDING_LEN: usize = 10_000; -const VOTERS_A_NUM: usize = 200; -const VOTERS_B_NUM: usize = 200; -const PROPOSALS_NUM: usize = 100; +#[cfg(feature = "running-ci")] +mod limits { + pub const DESCRIPTION_LEN: usize = 10; + pub const URL_LEN: usize = 50; + pub const PROPOSAL_PADDING_LEN: usize = 100; + pub const VOTERS_A_NUM: usize = 10; + pub const VOTERS_B_NUM: usize = 10; + pub const PROPOSALS_NUM: usize = 5; +} + +#[cfg(not(feature = "running-ci"))] +mod limits { + pub const DESCRIPTION_LEN: usize = 1_000; + pub const URL_LEN: usize = 500; + pub const PROPOSAL_PADDING_LEN: usize = 10_000; + pub const VOTERS_A_NUM: usize = 200; + pub const VOTERS_B_NUM: usize = 200; + pub const PROPOSALS_NUM: usize = 100; +} + +use limits::*; + +pub const MAX_SKIPPED_COUNT: u8 = 255; /// Makes a proposal. fn make_proposal() -> (Box, Url, PipDescription) { @@ -61,10 +79,7 @@ fn make_voters( origin, did, .. - } = UserBuilder::::default() - .generate_did() - .seed(i as u32) - .build(prefix); + } = user::(prefix, i as u32); (account, origin, did.unwrap()) }) .collect() @@ -78,7 +93,7 @@ fn cast_votes( ) -> DispatchResult { for (_, origin, did) in voters { identity::CurrentDid::put(did); - Module::::vote(origin.clone().into(), id, aye_or_nay, 1.into())?; + Module::::vote(origin.clone().into(), id, aye_or_nay, 1u32.into())?; } Ok(()) } @@ -88,6 +103,7 @@ fn pips_and_votes_setup( approve_only: bool, ) -> Result<(RawOrigin, IdentityId), DispatchError> { Module::::set_active_pip_limit(RawOrigin::Root.into(), PROPOSALS_NUM as u32)?; + Module::::set_min_proposal_deposit(RawOrigin::Root.into(), 0u32.into())?; let (voters_a_num, voters_b_num) = if approve_only { (VOTERS_A_NUM + VOTERS_B_NUM, 0) } else { @@ -95,8 +111,8 @@ fn pips_and_votes_setup( }; let hi_voters = make_voters::(voters_a_num, "hi"); let bye_voters = make_voters::(voters_b_num, "bye"); - let User { origin, did, .. } = UserBuilder::::default().generate_did().build("initial"); - let did = did.expect("no did in pips_and_votes_setup"); + let User { origin, did, .. } = user::("initial", 0); + let did = did.ok_or("no did in pips_and_votes_setup")?; for i in 0..PROPOSALS_NUM { let (proposal, url, description) = make_proposal::(); // Pick a proposer, diversifying like a poor man. @@ -109,7 +125,7 @@ fn pips_and_votes_setup( Module::::propose( proposer_origin.into(), proposal, - 42.into(), + 42u32.into(), Some(url.clone()), Some(description.clone()), )?; @@ -121,24 +137,43 @@ fn pips_and_votes_setup( Ok((origin, did)) } -fn enact_call() -> Call { +fn enact_call(num_approves: usize, num_rejects: usize, num_skips: usize) -> Call { + let seed = [42; 32]; + let mut rng = ChaCha20Rng::from_seed(seed); + let mut snapshot_results: Vec<_> = iter::repeat(SnapshotResult::Approve) + .take(num_approves) + .chain(iter::repeat(SnapshotResult::Reject).take(num_rejects)) + .chain(iter::repeat(SnapshotResult::Skip).take(num_skips)) + .collect(); + snapshot_results.shuffle(&mut rng); Call::::enact_snapshot_results( Module::::snapshot_queue() .iter() - .map(|s| { - let id = s.id; - let action = if id % 2 == 0 { - SnapshotResult::Approve - } else { - SnapshotResult::Reject - }; - (id, action) - }) .rev() + .map(|s| s.id) + .zip(snapshot_results.into_iter()) .collect(), ) } +fn propose_verify(url: Url, description: PipDescription) -> DispatchResult { + let meta = Module::::proposal_metadata(0).unwrap(); + ensure!(0 == meta.id, "incorrect meta.id"); + ensure!(Some(url) == meta.url, "incorrect meta.url"); + ensure!( + Some(description) == meta.description, + "incorrect meta.description" + ); + Ok(()) +} + +fn execute_verify(state: ProposalState, err: &'static str) -> DispatchResult { + if Proposals::::contains_key(&0) { + ensure!(state == Module::::proposals(&0).unwrap().state, err); + } + Ok(()) +} + benchmarks! { _ {} @@ -146,31 +181,31 @@ benchmarks! { let origin = RawOrigin::Root; }: _(origin, true) verify { - assert_eq!(true, PruneHistoricalPips::get()); + ensure!(PruneHistoricalPips::get(), "set_prune_historical_pips didn't work"); } set_min_proposal_deposit { let origin = RawOrigin::Root; - let deposit = 42.into(); + let deposit = 42u32.into(); }: _(origin, deposit) verify { - assert_eq!(deposit, MinimumProposalDeposit::::get()); + ensure!(deposit == MinimumProposalDeposit::::get(), "incorrect MinimumProposalDeposit"); } set_default_enactment_period { let origin = RawOrigin::Root; - let period = 42.into(); + let period = 42u32.into(); }: _(origin, period) verify { - assert_eq!(period, DefaultEnactmentPeriod::::get()); + ensure!(period == DefaultEnactmentPeriod::::get(), "incorrect DefaultEnactmentPeriod"); } set_pending_pip_expiry { let origin = RawOrigin::Root; - let maybe_block = MaybeBlock::Some(42.into()); + let maybe_block = MaybeBlock::Some(42u32.into()); }: _(origin, maybe_block) verify { - assert_eq!(maybe_block, PendingPipExpiry::::get()); + ensure!(maybe_block == PendingPipExpiry::::get(), "incorrect PendingPipExpiry"); } set_max_pip_skip_count { @@ -178,7 +213,7 @@ benchmarks! { let count = 42.try_into().unwrap(); }: _(origin, count) verify { - assert_eq!(count, MaxPipSkipCount::get()); + ensure!(count == MaxPipSkipCount::get(), "incorrect MaxPipSkipCount"); } set_active_pip_limit { @@ -186,50 +221,46 @@ benchmarks! { let pip_limit = 42; }: _(origin, pip_limit) verify { - assert_eq!(pip_limit, ActivePipLimit::get()); + ensure!(pip_limit == ActivePipLimit::get(), "incorrect ActivePipLimit"); } propose_from_community { - let User { account, origin, did, .. } = - UserBuilder::::default().generate_did().build("proposer"); - identity::CurrentDid::put(did.unwrap()); + let user = user::("proposer", 0); + identity::CurrentDid::put(user.did()); let (proposal, url, description) = make_proposal::(); - }: propose(origin, proposal, 42.into(), Some(url.clone()), Some(description.clone())) + let some_url = Some(url.clone()); + let some_desc = Some(description.clone()); + let origin = user.origin(); + }: propose(origin, proposal, 42u32.into(), some_url, some_desc) verify { - let meta = Module::::proposal_metadata(0).unwrap(); - assert_eq!(0, meta.id); - assert_eq!(Some(url), meta.url); - assert_eq!(Some(description), meta.description); + propose_verify::(url, description)?; } // `propose` from a committee origin. propose_from_committee { - let User { account, origin, did, .. } = - UserBuilder::::default().generate_did().build("proposer"); - identity::CurrentDid::put(did.unwrap()); + let user = user::("proposer", 0); + identity::CurrentDid::put(user.did()); let (proposal, url, description) = make_proposal::(); let origin = T::UpgradeCommitteeVMO::successful_origin(); - Module::::set_min_proposal_deposit(RawOrigin::Root.into(), 0.into())?; - let call = Call::::propose(proposal, 0.into(), Some(url.clone()), Some(description.clone())); + Module::::set_min_proposal_deposit(RawOrigin::Root.into(), 0u32.into())?; + let some_url = Some(url.clone()); + let some_desc = Some(description.clone()); + let call = Call::::propose(proposal, 0u32.into(), some_url, some_desc); }: { call.dispatch_bypass_filter(origin)?; } verify { - let meta = Module::::proposal_metadata(0).unwrap(); - assert_eq!(0, meta.id); - assert_eq!(Some(url), meta.url); - assert_eq!(Some(description), meta.description); + propose_verify::(url, description)?; } vote { - let User { account, origin, did, .. } = - UserBuilder::::default().generate_did().build("proposer"); - identity::CurrentDid::put(did.unwrap()); + let proposer = user::("proposer", 0); + identity::CurrentDid::put(proposer.did()); let (proposal, url, description) = make_proposal::(); Module::::propose( - origin.into(), + proposer.origin().into(), proposal, - 42.into(), + 42u32.into(), Some(url), Some(description) )?; @@ -239,15 +270,15 @@ benchmarks! { cast_votes::(0, aye_voters.as_slice(), true)?; cast_votes::(0, nay_voters.as_slice(), false)?; // Cast an opposite vote. - let User { account, origin, did, .. } = - UserBuilder::::default().generate_did().build("voter"); - identity::CurrentDid::put(did.unwrap()); - let voter_deposit = 43.into(); + let voter = user::("voter", 0); + identity::CurrentDid::put(voter.did()); + let voter_deposit = 43u32.into(); // Cast an opposite vote. - Module::::vote(origin.clone().into(), 0, false, voter_deposit)?; + Module::::vote(voter.origin().into(), 0, false, voter_deposit)?; + let origin = voter.origin(); }: _(origin, 0, true, voter_deposit) verify { - assert_eq!(voter_deposit, Deposits::::get(0, &account).amount); + ensure!(voter_deposit == Deposits::::get(0, &voter.account()).amount, "incorrect voter deposit"); } approve_committee_proposal { @@ -255,8 +286,8 @@ benchmarks! { let proposer_origin = T::UpgradeCommitteeVMO::successful_origin(); let proposer_did = SystematicIssuers::Committee.as_id(); identity::CurrentDid::put(proposer_did); - Module::::set_min_proposal_deposit(RawOrigin::Root.into(), 0.into())?; - let propose_call = Call::::propose(proposal, 0.into(), Some(url.clone()), Some(description.clone())); + Module::::set_min_proposal_deposit(RawOrigin::Root.into(), 0u32.into())?; + let propose_call = Call::::propose(proposal, 0u32.into(), Some(url.clone()), Some(description.clone())); propose_call.dispatch_bypass_filter(proposer_origin)?; let origin = T::VotingMajorityOrigin::successful_origin(); let call = Call::::approve_committee_proposal(0); @@ -264,46 +295,45 @@ benchmarks! { call.dispatch_bypass_filter(origin)?; } verify { - assert_eq!(true, PipToSchedule::::contains_key(&0)); + ensure!(PipToSchedule::::contains_key(&0), "approved committee proposal is not in the schedule"); } reject_proposal { - let User { account, origin, did, .. } = - UserBuilder::::default().generate_did().build("proposer"); - identity::CurrentDid::put(did.unwrap()); + Module::::set_prune_historical_pips(RawOrigin::Root.into(), true)?; + let user = user::("proposer", 0); + identity::CurrentDid::put(user.did()); let (proposal, url, description) = make_proposal::(); - let deposit = 42.into(); + let deposit = 42u32.into(); Module::::propose( - origin.into(), + user.origin().into(), proposal, deposit, Some(url), Some(description) )?; - assert_eq!(deposit, Deposits::::get(&0, &account).amount); + ensure!(deposit == Deposits::::get(&0, &user.account()).amount, "incorrect deposit in reject_proposal"); let vmo_origin = T::VotingMajorityOrigin::successful_origin(); let call = Call::::reject_proposal(0); }: { call.dispatch_bypass_filter(vmo_origin)?; } verify { - assert_eq!(false, Deposits::::contains_key(&0, &account)); + ensure!(!Deposits::::contains_key(&0, &user.account()), "deposit of the rejected proposal is present"); } prune_proposal { - let User { account, origin, did, .. } = - UserBuilder::::default().generate_did().build("proposer"); - identity::CurrentDid::put(did.unwrap()); + Module::::set_prune_historical_pips(RawOrigin::Root.into(), false)?; + let user = user::("proposer", 0); + identity::CurrentDid::put(user.did()); let (proposal, url, description) = make_proposal::(); Module::::propose( - origin.into(), + user.origin().into(), proposal, - 42.into(), + 42u32.into(), Some(url), Some(description) )?; let vmo_origin = T::VotingMajorityOrigin::successful_origin(); - Module::::set_prune_historical_pips(RawOrigin::Root.into(), false)?; let reject_call = Call::::reject_proposal(0); reject_call.dispatch_bypass_filter(vmo_origin.clone())?; let call = Call::::prune_proposal(0); @@ -311,88 +341,108 @@ benchmarks! { call.dispatch_bypass_filter(vmo_origin)?; } verify { - assert_eq!(false, Proposals::::contains_key(&0)); - assert_eq!(false, ProposalMetadata::::contains_key(&0)); + ensure!(!Proposals::::contains_key(&0), "pruned proposal is present"); + ensure!(!ProposalMetadata::::contains_key(&0), "pruned proposal metadata is present"); } reschedule_execution { - let User { account, origin, did, .. } = - UserBuilder::::default().generate_did().build("proposer"); - let did = did.expect("missing did in reschedule_execution"); - identity::CurrentDid::put(did); + let user = user::("proposer", 0); + identity::CurrentDid::put(user.did()); let (proposal, url, description) = make_proposal::(); Module::::propose( - origin.clone().into(), + user.origin().into(), proposal, - 42.into(), + 42u32.into(), Some(url.clone()), Some(description.clone()) )?; - T::GovernanceCommittee::bench_set_release_coordinator(did); - Module::::snapshot(origin.clone().into())?; + T::GovernanceCommittee::bench_set_release_coordinator(user.did()); + Module::::snapshot(user.origin().into())?; let vmo_origin = T::VotingMajorityOrigin::successful_origin(); let enact_call = Call::::enact_snapshot_results(vec![(0, SnapshotResult::Approve)]); enact_call.dispatch_bypass_filter(vmo_origin)?; - let future_block = frame_system::Module::::block_number() + 100.into(); + let future_block = frame_system::Module::::block_number() + 100u32.into(); + let origin = user.origin(); }: _(origin, 0, Some(future_block)) verify { - assert_eq!(true, PipToSchedule::::contains_key(&0)); + ensure!(PipToSchedule::::contains_key(&0), "rescheduled proposal is missing in the schedule"); } clear_snapshot { - let User { account, origin, did, .. } = - UserBuilder::::default().generate_did().build("proposer"); - let did = did.expect("missing did in clear_snapshot"); - identity::CurrentDid::put(did); + let user = user::("proposer", 0); + identity::CurrentDid::put(user.did()); let (proposal, url, description) = make_proposal::(); Module::::propose( - origin.clone().into(), + user.origin().into(), proposal, - 42.into(), + 42u32.into(), Some(url.clone()), Some(description.clone()) )?; - T::GovernanceCommittee::bench_set_release_coordinator(did); - Module::::snapshot(origin.clone().into())?; - assert!(SnapshotMeta::::get().is_some()); + T::GovernanceCommittee::bench_set_release_coordinator(user.did()); + Module::::snapshot(user.origin().into())?; + ensure!(SnapshotMeta::::get().is_some(), "missing a snapshot before clear_snapshot"); + let origin = user.origin(); }: _(origin) verify { - assert!(SnapshotMeta::::get().is_none()); + ensure!(SnapshotMeta::::get().is_none(), "snapshot was not cleared by clear_snapshot"); } - // TODO reduce fn complexity snapshot { - // let origin0 = snapshot_setup::()?; - }: {} // _(origin0) + let (origin0, did0) = pips_and_votes_setup::(true)?; + identity::CurrentDid::put(did0); + T::GovernanceCommittee::bench_set_release_coordinator(did0); + }: _(origin0) verify { - // assert!(SnapshotMeta::::get().is_some()); + ensure!(SnapshotMeta::::get().is_some(), "snapshot finished incorrectly"); } - // TODO reduce fn complexity enact_snapshot_results { - // let origin0 = snapshot_setup::()?; - // Module::::snapshot(origin0.into())?; - // let enact_origin = T::VotingMajorityOrigin::successful_origin(); - // let enact_call = enact_call::(); + // The number of Approve results. + let a in 0..PROPOSALS_NUM as u32 / 3; + // The number of Reject results. + let r in 0..PROPOSALS_NUM as u32 / 3; + // The number of Skip results. + let s in 0..PROPOSALS_NUM as u32 / 3; + + Module::::set_max_pip_skip_count(RawOrigin::Root.into(), MAX_SKIPPED_COUNT)?; + let (origin0, did0) = pips_and_votes_setup::(true)?; + + // snapshot + identity::CurrentDid::put(did0); + T::GovernanceCommittee::bench_set_release_coordinator(did0); + Module::::snapshot(origin0.into())?; + + // enact + let enact_origin = T::VotingMajorityOrigin::successful_origin(); + let enact_call = enact_call::(a as usize, r as usize, s as usize); }: { - // enact_call.dispatch_bypass_filter(enact_origin)?; + enact_call.dispatch_bypass_filter(enact_origin)?; } verify { - // assert_eq!(true, PipToSchedule::::contains_key(&0)); + ensure!( + Module::::snapshot_queue().len() == PROPOSALS_NUM - (a + r + s) as usize, + "incorrect snapshot queue after enact_snapshot_results" + ); } execute_scheduled_pip { // set up + Module::::set_prune_historical_pips(RawOrigin::Root.into(), true)?; let (origin0, did0) = pips_and_votes_setup::(true)?; // snapshot identity::CurrentDid::put(did0); T::GovernanceCommittee::bench_set_release_coordinator(did0); Module::::snapshot(origin0.into())?; + ensure!( + Module::::snapshot_queue().len() == PROPOSALS_NUM as usize, + "wrong snapshot queue length" + ); // enact let enact_origin = T::VotingMajorityOrigin::successful_origin(); - let enact_call = enact_call::(); + let enact_call = enact_call::(PROPOSALS_NUM, 0, 0); enact_call.dispatch_bypass_filter(enact_origin)?; // execute @@ -400,17 +450,26 @@ benchmarks! { let origin = RawOrigin::Root; }: _(origin, 0) verify { - if Proposals::::contains_key(&0) { - assert_eq!(ProposalState::Failed, Module::::proposals(&0).unwrap().state); - } + execute_verify::(ProposalState::Failed, "incorrect proposal state after execution")?; } expire_scheduled_pip { - pips_and_votes_setup::(true)?; - identity::CurrentDid::kill(); + // set up + Module::::set_prune_historical_pips(RawOrigin::Root.into(), true)?; + let (origin0, did0) = pips_and_votes_setup::(true)?; + + // snapshot + identity::CurrentDid::put(did0); + T::GovernanceCommittee::bench_set_release_coordinator(did0); + Module::::snapshot(origin0.into())?; + + ensure!( + ProposalState::Pending == Module::::proposals(&0).unwrap().state, + "incorrect proposal state before expiration" + ); let origin = RawOrigin::Root; }: _(origin, GC_DID, 0) verify { - assert_eq!(ProposalState::Expired, Module::::proposals(&0).unwrap().state); + execute_verify::(ProposalState::Expired, "incorrect proposal state after expiration")?; } } diff --git a/pallets/pips/src/lib.rs b/pallets/pips/src/lib.rs index 4b457cf8e6..af5143cf55 100644 --- a/pallets/pips/src/lib.rs +++ b/pallets/pips/src/lib.rs @@ -119,6 +119,7 @@ use polymesh_common_utilities::{ }; use polymesh_primitives::IdentityId; use polymesh_primitives_derive::VecU8StrongTyped; +use polymesh_runtime_common::PipsEnactSnapshotMaximumWeight; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sp_core::H256; @@ -146,7 +147,7 @@ pub trait WeightInfo { fn reschedule_execution() -> Weight; fn clear_snapshot() -> Weight; fn snapshot() -> Weight; - fn enact_snapshot_results() -> Weight; + fn enact_snapshot_results(a: u32, r: u32, s: u32) -> Weight; fn execute_scheduled_pip() -> Weight; fn expire_scheduled_pip() -> Weight; } @@ -945,7 +946,7 @@ decl_module! { Self::is_proposal_state(id, ProposalState::Scheduled)?; // 2. New value should be valid block number. - let next_block = >::block_number() + 1.into(); + let next_block = >::block_number() + 1u32.into(); let new_until = until.unwrap_or(next_block); ensure!(new_until >= next_block, Error::::InvalidFutureBlockNumber); @@ -1021,7 +1022,22 @@ decl_module! { /// results[i].0 ≠ SnapshotQueue[SnapshotQueue.len() - i].id /// ``` /// This is protects against clearing queue while GC is voting. - #[weight = ::WeightInfo::enact_snapshot_results()] + #[weight = { + use SnapshotResult::*; + + let mut approves = 0; + let mut rejects = 0; + let mut skips = 0; + for r in results.iter().map(|result| result.1) { + match r { + Approve => approves += 1, + Reject => rejects += 1, + Skip => skips += 1, + } + } + let weight = ::WeightInfo::enact_snapshot_results(approves, rejects, skips); + weight.min(PipsEnactSnapshotMaximumWeight::get()) + }] pub fn enact_snapshot_results(origin, results: Vec<(PipId, SnapshotResult)>) -> DispatchResult { T::VotingMajorityOrigin::ensure_origin(origin)?; @@ -1032,7 +1048,7 @@ decl_module! { // Default after-first-push capacity is 4, we bump this slightly. // Rationale: GC are humans sitting together and reaching conensus. // This is time consuming, so considering 20 PIPs in total might take few hours. - let speculative_capacity = queue.len().max(10); + let speculative_capacity = queue.len().min(results.len()).min(10); let mut to_reject = Vec::with_capacity(speculative_capacity); let mut to_approve = Vec::with_capacity(speculative_capacity); @@ -1091,7 +1107,7 @@ decl_module! { /// Internal dispatchable that handles execution of a PIP. #[weight = ::WeightInfo::execute_scheduled_pip()] - fn execute_scheduled_pip(origin, id: PipId) -> DispatchResultWithPostInfo { + pub fn execute_scheduled_pip(origin, id: PipId) -> DispatchResultWithPostInfo { ensure_root(origin)?; >::remove(id); Self::execute_proposal(id) @@ -1099,7 +1115,7 @@ decl_module! { /// Internal dispatchable that handles expiration of a PIP. #[weight = ::WeightInfo::expire_scheduled_pip()] - fn expire_scheduled_pip(origin, did: IdentityId, id: PipId) { + pub fn expire_scheduled_pip(origin, did: IdentityId, id: PipId) { ensure_root(origin)?; if Self::is_proposal_state(id, ProposalState::Pending).is_ok() { Self::maybe_unsnapshot_pip(id, ProposalState::Pending); @@ -1161,7 +1177,7 @@ impl Module { /// i.e., once run, refunding again will refund nothing. fn refund_proposal(did: IdentityId, id: PipId) { let total_refund = - >::iter_prefix_values(id).fold(0.into(), |acc, depo_info| { + >::iter_prefix_values(id).fold(0u32.into(), |acc, depo_info| { Self::reduce_lock(&depo_info.owner, depo_info.amount).unwrap(); depo_info.amount.saturating_add(acc) }); @@ -1232,6 +1248,8 @@ impl Module { fn schedule_pip_for_execution(did: IdentityId, id: PipId, maybe_at: Option) { let at = maybe_at.unwrap_or_else(|| { let period = Self::default_enactment_period(); + // The enactment period is at least 1 block. This is de to the fact that it's only + // possible to schedule calls for future blocks. let corrected_period = if period > Zero::zero() { period } else { @@ -1325,6 +1343,7 @@ impl Module { /// Decrement active proposal count if `state` signifies it is active. fn decrement_count_if_active(state: ProposalState) { if Self::is_active(state) { + // The performance impact of a saturating sub is negligible and caution is good. ActivePipCount::mutate(|count| *count = count.saturating_sub(1)); } } @@ -1490,20 +1509,18 @@ impl Module { fn adjust_live_queue(id: PipId, old: SnapshottedPip>) { let new = Self::aggregate_result(id); >::mutate(|queue| { - let old_pos = queue.binary_search_by(|res| compare_spip(res, &old)); - let new_pos = queue.binary_search_by(|res| compare_spip(res, &new)); - match (old_pos, new_pos) { - // First time adding to queue, so insert. - (Err(_), Ok(pos) | Err(pos)) => queue.insert(pos, new), - // Already in queue. Swap positions. - (Ok(old_pos), Err(new_pos)) => { - // Cannot underflow by definition of binary search finding an element. - let new_pos = new_pos.min(queue.len() - 1); - move_element(queue, old_pos, new_pos); - queue[new_pos] = new; - } - // We have `old_res == new_res`. Queue state is already good. - (Ok(_), Ok(_)) => {} + // Remove the old element. + // + // Under normal conditions, we can assume its in the list and findable, + // as the list is sorted, updated, and old is taken before modification. + // However, we still prefer to be defensive here, and same below. + if let Ok(old_pos) = queue.binary_search_by(|res| compare_spip(res, &old)) { + queue.remove(old_pos); + } + + // Insert the new element. + if let Err(new_pos) = queue.binary_search_by(|res| compare_spip(res, &new)) { + queue.insert(new_pos, new); } }); } @@ -1556,23 +1573,6 @@ impl Module { } } -/// Move `slice[old]` to `slice[new]`, shifting other elements as necessary. -/// -/// For example, given `let arr = [1, 2, 3, 4, 5];`, -/// then `move_element(&mut arr, 1, 3);` would result in `[1, 3, 4, 2, 5]` -/// whereas `move_element(&mut arr, 3, 1)` would yield `[1, 4, 2, 3, 5]`. -fn move_element(slice: &mut [T], old: usize, new: usize) { - let elem = slice[old]; - if old < new { - // Left shift elements after `old` by one element. - slice.copy_within(old + 1..=new, old); - } else { - // Right shift elements from `new` by one element. - slice.copy_within(new..old, new + 1); - } - slice[new] = elem; -} - #[cfg(test)] mod test { #[test] diff --git a/pallets/portfolio/Cargo.toml b/pallets/portfolio/Cargo.toml index a09c0e96fa..f58aec68dc 100644 --- a/pallets/portfolio/Cargo.toml +++ b/pallets/portfolio/Cargo.toml @@ -19,13 +19,13 @@ serde = { version = "1.0.104", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Only in STD -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0", optional = true } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1", optional = true } [features] equalize = [] diff --git a/pallets/portfolio/src/benchmarking.rs b/pallets/portfolio/src/benchmarking.rs index 69fbc58154..bd23c428a9 100644 --- a/pallets/portfolio/src/benchmarking.rs +++ b/pallets/portfolio/src/benchmarking.rs @@ -13,35 +13,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] use crate::*; - -use polymesh_common_utilities::benchs::UserBuilder; -use polymesh_primitives::PortfolioName; - use frame_benchmarking::benchmarks; +use polymesh_common_utilities::benchs::{generate_ticker, UserBuilder}; +use polymesh_primitives::PortfolioName; use sp_std::{convert::TryFrom, prelude::*}; -/// Given a number, this function generates a ticker with -/// A-Z, least number of characters in Lexicographic order -fn generate_ticker(n: u64) -> Ticker { - fn calc_base26(n: u64, base_26: &mut Vec) { - if n >= 26 { - // Subtracting 1 is not required and shouldn't be done for a proper base_26 conversion - // However, without this hack, B will be the first char after a bump in number of chars. - // i.e. the sequence will go A,B...Z,BA,BB...ZZ,BAA. We want the sequence to start with A. - // Subtracting 1 here means we are doing 1 indexing rather than 0. - // i.e. A = 1, B = 2 instead of A = 0, B = 1 - calc_base26((n / 26) - 1, base_26); - } - let character = n % 26 + 65; - base_26.push(character as u8); - } - let mut base_26 = Vec::new(); - calc_base26(n, &mut base_26); - Ticker::try_from(base_26.as_slice()).unwrap() -} - benchmarks! { _ {} @@ -72,18 +49,18 @@ benchmarks! { move_portfolio_funds { // Number of assets being moved - let i in 1 .. 500; - let mut items = Vec::with_capacity(i as usize); + let a in 1 .. 500; + let mut items = Vec::with_capacity(a as usize); let target = UserBuilder::::default().generate_did().build("target"); - let first_ticker = generate_ticker(0u64); - let amount = T::Balance::from(10); + let first_ticker = Ticker::try_from(generate_ticker(0u64).as_slice()).unwrap(); + let amount = T::Balance::from(10u32); let portfolio_name = PortfolioName(vec![65u8; 5]); let next_portfolio_num = NextPortfolioNumber::get(&target.did()); let default_portfolio = PortfolioId::default_portfolio(target.did()); let user_portfolio = PortfolioId::user_portfolio(target.did(), next_portfolio_num.clone()); - for x in 0..i as u64 { - let ticker = generate_ticker(x); + for x in 0..a as u64 { + let ticker = Ticker::try_from(generate_ticker(x).as_slice()).unwrap(); items.push(MovePortfolioItem { ticker, amount: amount, @@ -94,10 +71,10 @@ benchmarks! { Module::::create_portfolio(target.origin.clone().into(), portfolio_name.clone())?; assert_eq!(>::get(&default_portfolio, &first_ticker), amount); - assert_eq!(>::get(&user_portfolio, &first_ticker), 0.into()); + assert_eq!(>::get(&user_portfolio, &first_ticker), 0u32.into()); }: _(target.origin, default_portfolio, user_portfolio, items) verify { - assert_eq!(>::get(&default_portfolio, &first_ticker), 0.into()); + assert_eq!(>::get(&default_portfolio, &first_ticker), 0u32.into()); assert_eq!(>::get(&user_portfolio, &first_ticker), amount); } diff --git a/pallets/portfolio/src/lib.rs b/pallets/portfolio/src/lib.rs index a9b56d4179..289e65cd4b 100644 --- a/pallets/portfolio/src/lib.rs +++ b/pallets/portfolio/src/lib.rs @@ -35,8 +35,6 @@ //! - `default_portfolio_balance`: Returns the ticker balance of the identity's default portfolio. //! - `user_portfolio_balance`: Returns the ticker balance of an identity's user portfolio. //! - `set_default_portfolio_balance`: Sets the ticker balance of the identity's default portfolio. -//! - `rpc_get_portfolios`: An RPC function that lists all user-defined portfolio number-name pairs. -//! - `rpc_get_portfolio_assets`: Ensures that there is no portfolio with the desired name yet. //! - `unchecked_transfer_portfolio_balance`: Transfers funds from one portfolio to another. //! - `ensure_portfolio_custody`: Makes sure that the given identity has custodian access over the portfolio. //! - `ensure_portfolio_transfer_validity`: Makes sure that a transfer between two portfolios is valid. @@ -240,6 +238,9 @@ decl_module! { /// # Errors /// * `PortfolioDoesNotExist` if `num` doesn't reference a valid portfolio. /// * `PortfolioNotEmpty` if the portfolio still holds any asset + /// + /// # Permissions + /// * Portfolio #[weight = ::WeightInfo::delete_portfolio()] pub fn delete_portfolio(origin, num: PortfolioNumber) { let PermissionedCallOriginData { @@ -268,6 +269,9 @@ decl_module! { /// * `DifferentIdentityPortfolios` if the sender and receiver portfolios belong to different identities /// * `UnauthorizedCustodian` if the caller is not the custodian of the from portfolio /// * `InsufficientPortfolioBalance` if the sender does not have enough free balance + /// + /// # Permissions + /// * Portfolio #[weight = ::WeightInfo::move_portfolio_funds(items.len() as u32)] pub fn move_portfolio_funds( origin, @@ -316,6 +320,9 @@ decl_module! { /// /// # Errors /// * `PortfolioDoesNotExist` if `num` doesn't reference a valid portfolio. + /// + /// # Permissions + /// * Portfolio #[weight = ::WeightInfo::rename_portfolio(to_name.len() as u32)] pub fn rename_portfolio( origin, @@ -372,18 +379,6 @@ impl Module { NextPortfolioNumber::mutate(did, |num| mem::replace(num, PortfolioNumber(num.0 + 1))) } - /// An RPC function that lists all user-defined portfolio number-name pairs. - pub fn rpc_get_portfolios(did: IdentityId) -> Vec<(PortfolioNumber, PortfolioName)> { - Portfolios::iter_prefix(&did).collect() - } - - /// An RPC function that lists all token-balance pairs of a portfolio. - pub fn rpc_get_portfolio_assets( - portfolio_id: PortfolioId, - ) -> Vec<(Ticker, ::Balance)> { - >::iter_prefix(&portfolio_id).collect() - } - /// Ensures that there is no portfolio with the desired `name` yet. fn ensure_name_unique(did: &IdentityId, name: &PortfolioName) -> DispatchResult { let name_uniq = Portfolios::iter_prefix(&did).all(|n| &n.1 != name); diff --git a/pallets/protocol-fee/Cargo.toml b/pallets/protocol-fee/Cargo.toml index 986b6caee0..a7f48d4919 100644 --- a/pallets/protocol-fee/Cargo.toml +++ b/pallets/protocol-fee/Cargo.toml @@ -14,15 +14,15 @@ serde = { version = "1.0.104", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # benchmark-only -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } [features] default = ["std"] diff --git a/pallets/protocol-fee/rpc/Cargo.toml b/pallets/protocol-fee/rpc/Cargo.toml index 044ebd30e0..b2cb3db83a 100644 --- a/pallets/protocol-fee/rpc/Cargo.toml +++ b/pallets/protocol-fee/rpc/Cargo.toml @@ -16,6 +16,6 @@ jsonrpc-derive = "15.0.0" # Substrate codec = { package = "parity-scale-codec", version = "1.2.0" } -sp-runtime = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } -sp-blockchain = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0"} -sp-api = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0"} +sp-runtime = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } +sp-blockchain = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1"} +sp-api = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1"} diff --git a/pallets/protocol-fee/rpc/runtime-api/Cargo.toml b/pallets/protocol-fee/rpc/runtime-api/Cargo.toml index 7ef5172a19..87b336e62e 100644 --- a/pallets/protocol-fee/rpc/runtime-api/Cargo.toml +++ b/pallets/protocol-fee/rpc/runtime-api/Cargo.toml @@ -12,9 +12,9 @@ serde = { version = "1.0.104", optional = true, features = ["derive"] } # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-api = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0"} -sp-runtime = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0"} -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-api = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1"} +sp-runtime = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1"} +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } [dev-dependencies] serde_json = "1.0.48" diff --git a/pallets/protocol-fee/src/benchmarking.rs b/pallets/protocol-fee/src/benchmarking.rs index ca8ecf3108..4a1d6e2222 100644 --- a/pallets/protocol-fee/src/benchmarking.rs +++ b/pallets/protocol-fee/src/benchmarking.rs @@ -13,7 +13,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] use crate::*; use frame_benchmarking::benchmarks; use frame_system::RawOrigin; diff --git a/pallets/runtime/build_tool/Cargo.toml b/pallets/runtime/build_tool/Cargo.toml new file mode 100644 index 0000000000..d50e818129 --- /dev/null +++ b/pallets/runtime/build_tool/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "polymesh-build-tool" +version = "0.1.0" +authors = ["miguel "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +wasm-builder-runner = { package = "substrate-wasm-builder-runner", git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1"} + +[features] +default = ["std"] +std = [] diff --git a/pallets/runtime/build_tool/src/lib.rs b/pallets/runtime/build_tool/src/lib.rs new file mode 100644 index 0000000000..dd888fad2d --- /dev/null +++ b/pallets/runtime/build_tool/src/lib.rs @@ -0,0 +1,13 @@ +use wasm_builder_runner::WasmBuilder; + +const BUILDER_REPO: &str = "https://github.com/PolymathNetwork/substrate-wasm-builder.git"; +const BUILDER_REV: &str = "b0303c15b662dd768bfe808e3ed47ec65305fe2a"; + +pub fn build() { + WasmBuilder::new() + .with_current_project() + .with_wasm_builder_from_git(BUILDER_REPO, BUILDER_REV) + .export_heap_base() + .import_memory() + .build() +} diff --git a/pallets/runtime/common/Cargo.toml b/pallets/runtime/common/Cargo.toml index 0fd1273ac6..3d3d37610d 100644 --- a/pallets/runtime/common/Cargo.toml +++ b/pallets/runtime/common/Cargo.toml @@ -7,12 +7,11 @@ edition = "2018" [dependencies] polymesh-common-utilities = { path = "../../common", default-features = false } polymesh-primitives = { path = "../../../primitives", default-features = false } -polymesh-primitives-derive = { path = "../../../primitives_derive", default-features = false } pallet-asset = { path = "../../asset", default-features = false } pallet-balances = { path = "../../balances", default-features = false } pallet-compliance-manager = { path = "../../compliance-manager", default-features = false } -pallet-contracts = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", default-features = false } +pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", default-features = false } pallet-identity = { path = "../../identity", default-features = false } pallet-multisig = { path = "../../multisig", default-features = false} pallet-portfolio = { path = "../../portfolio", default-features = false } @@ -23,18 +22,22 @@ pallet-group-rpc-runtime-api = { path = "../../group/rpc/runtime-api", default-f # General serde = { version = "1.0.104", default-features = false } rand = { version = "0.7.3", default-features = false } +smallvec = "1.4.0" # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-authorship = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } + +# Only benchmarking +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } [features] equalize = [] @@ -62,3 +65,7 @@ std = [ "sp-runtime/std", "sp-std/std", ] +runtime-benchmarks = [ + "frame-benchmarking", + "polymesh-common-utilities/runtime-benchmarks", +] diff --git a/pallets/runtime/common/src/lib.rs b/pallets/runtime/common/src/lib.rs index ce6b91e0e0..96a6cb77a5 100644 --- a/pallets/runtime/common/src/lib.rs +++ b/pallets/runtime/common/src/lib.rs @@ -23,17 +23,22 @@ pub mod impls; pub use cdd_check::CddChecker; pub use sp_runtime::{Perbill, Permill}; +pub use frame_support::weights::{ + constants::{WEIGHT_PER_MICROS, WEIGHT_PER_MILLIS, WEIGHT_PER_NANOS, WEIGHT_PER_SECOND}, + GetDispatchInfo, Weight, +}; use frame_support::{ parameter_types, traits::Currency, weights::{ - constants::{WEIGHT_PER_MICROS, WEIGHT_PER_MILLIS, WEIGHT_PER_SECOND}, - RuntimeDbWeight, Weight, + RuntimeDbWeight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, }; use frame_system::{self as system}; use pallet_balances as balances; -use polymesh_primitives::{BlockNumber, IdentityId, Moment}; +use polymesh_common_utilities::constants::currency::*; +use polymesh_primitives::{Balance, BlockNumber, IdentityId, Moment}; +use smallvec::smallvec; pub use impls::{Author, CurrencyToVoteHandler}; @@ -43,21 +48,55 @@ pub type NegativeImbalance = parameter_types! { pub const BlockHashCount: BlockNumber = 250; /// We allow for 2 seconds of compute with a 6 second average block time. + /// + /// If this is updated, `PipsEnactSnapshotMaximumWeight` needs to be updated accordingly. pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; + /// Portion of the block available to normal class of dispatches. + /// + /// If this is updated, `PipsEnactSnapshotMaximumWeight` needs to be updated accordingly. pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); + /// Blocks can be of upto 10 MB in size. pub const MaximumBlockLength: u32 = 10 * 1024 * 1024; - /// 20 ms is needed to create a block + /// 20 ms is needed to create a block. pub const BlockExecutionWeight: Weight = 20 * WEIGHT_PER_MILLIS; - // 0.8 ms is needed to process an empty extrinsic - pub const ExtrinsicBaseWeight: Weight = 800 * WEIGHT_PER_MICROS; - /// When the read/writes are cached, they take 25, 100 microseconds - /// but when they are uncached, they take 250, 450 microseconds. - /// Most read/writes are cached in production - /// so we are taking a defensive middle number here. + /// 0.65 ms is needed to process an empty extrinsic. + pub const ExtrinsicBaseWeight: Weight = 650 * WEIGHT_PER_MICROS; + /// When the read/writes are cached/buffered, they take 25/100 microseconds on NVMe disks. + /// When they are uncached, they take 250/450 microseconds on NVMe disks. + /// Most read will be cached and writes will be buffered in production. + /// We are taking a number slightly higher than what cached suggest to allow for some extra breathing room. pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { - read: 100 * WEIGHT_PER_MICROS, // ~100 µs @ 100,000 items + read: 50 * WEIGHT_PER_MICROS, // ~100 µs @ 100,000 items write: 200 * WEIGHT_PER_MICROS, // ~200 µs @ 100,000 items }; + /// This implies a 100 POLYX fee per MB of transaction length + pub const TransactionByteFee: Balance = 10 * MILLICENTS; + /// We want the noop transaction to cost 0.03 POLYX + pub const PolyXBaseFee: Balance = 3 * CENTS; + /// The maximum weight of the pips extrinsic `enact_snapshot_results` which equals to + /// `MaximumBlockWeight * AvailableBlockRatio`. + pub const PipsEnactSnapshotMaximumWeight: Weight = WEIGHT_PER_SECOND * 2 * 75 / 100; +} + +/// Converts Weight to Fee +pub struct WeightToFee; +impl WeightToFeePolynomial for WeightToFee { + type Balance = Balance; + /// We want a 0.03 POLYX fee per ExtrinsicBaseWeight. + /// 650_000_000 weight = 30_000 fee => 21_666 weight = 1 fee. + /// Hence, 1 fee = 0 + 1/21_666 weight. + /// This implies, coeff_integer = 0 and coeff_frac = 1/21_666. + fn polynomial() -> WeightToFeeCoefficients { + smallvec![WeightToFeeCoefficient { + degree: 1, + coeff_frac: Perbill::from_rational_approximation( + PolyXBaseFee::get().into(), + ExtrinsicBaseWeight::get() as u128 + ), + coeff_integer: 0u128, // Coefficient is zero. + negative: false, + }] + } } use pallet_group_rpc_runtime_api::Member; diff --git a/pallets/runtime/develop/Cargo.toml b/pallets/runtime/develop/Cargo.toml index 0e51c7807d..80583278bb 100644 --- a/pallets/runtime/develop/Cargo.toml +++ b/pallets/runtime/develop/Cargo.toml @@ -13,6 +13,7 @@ polymesh-common-utilities = { path = "../../common", default-features = false } polymesh-runtime-common = { path = "../common", default-features = false } polymesh-primitives = { path = "../../../primitives", default-features = false } polymesh-weights = { path = "../../weights", default-features = false } +polymesh-extensions = { path = "../extensions", default-features = false } # Our pallets pallet-asset = { path = "../../asset", default-features = false } @@ -33,7 +34,7 @@ pallet-protocol-fee = { path = "../../protocol-fee", default-features = false } pallet-sto = { path = "../../sto", default-features = false } pallet-settlement = { path = "../../settlement", default-features = false } pallet-staking = { path = "../../staking", default-features = false } -pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-staking-reward-curve = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } pallet-statistics = { path = "../../statistics", default-features = false } pallet-transaction-payment = { path = "../../transaction-payment", default-features = false } pallet-treasury = { path = "../../treasury", default-features = false } @@ -43,59 +44,58 @@ pallet-sudo = { path = "../../sudo", default-features = false } # Others serde = { version = "1.0.104", default-features = false } -smallvec = "1.4.0" # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-staking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-consensus-babe = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-authority-discovery = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-inherents = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-offchain = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-staking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-consensus-babe = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-transaction-pool = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-block-builder = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # -pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-contracts = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-contracts-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-executive = { package = "frame-executive", git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-finality-tracker = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-grandpa = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-indices = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-offences = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-babe = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-scheduler = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-authorship = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-contracts-primitives = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-executive = { package = "frame-executive", git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-finality-tracker = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-grandpa = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-indices = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-offences = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-babe = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-randomness-collective-flip = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-scheduler = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # RPC -frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system-rpc-runtime-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } pallet-group-rpc-runtime-api = { path = "../../group/rpc/runtime-api", default-features = false } pallet-protocol-fee-rpc-runtime-api = { path = "../../protocol-fee/rpc/runtime-api", default-features = false } -pallet-contracts-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-contracts-rpc-runtime-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } pallet-staking-rpc-runtime-api = { path = "../../staking/rpc/runtime-api", default-features = false } node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } # Used for runtime benchmarking -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } -frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", default-features = false, optional = true } +frame-system-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", default-features = false, optional = true } hex-literal = { version = "0.3.1", optional = true } [build-dependencies] -wasm-builder-runner = { package = "substrate-wasm-builder-runner", git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0"} +polymesh-build-tool = { path = "../build_tool", default-features = false } [features] default = ["std", "equalize"] @@ -174,12 +174,17 @@ std = [ "sp-transaction-pool/std", "sp-version/std", "polymesh-contracts/std", + "polymesh-extensions/std", ] runtime-benchmarks = [ "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system-benchmarking", "frame-system/runtime-benchmarks", + "pallet-babe/runtime-benchmarks", + "pallet-indices/runtime-benchmarks", + "pallet-grandpa/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", "hex-literal", "pallet-asset/runtime-benchmarks", "pallet-balances/runtime-benchmarks", @@ -196,13 +201,21 @@ runtime-benchmarks = [ "pallet-portfolio/runtime-benchmarks", "pallet-protocol-fee/runtime-benchmarks", "pallet-settlement/runtime-benchmarks", + "pallet-sto/runtime-benchmarks", "pallet-staking/runtime-benchmarks", "pallet-statistics/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", + "pallet-staking/runtime-benchmarks", "polymesh-common-utilities/runtime-benchmarks", "polymesh-contracts/runtime-benchmarks", "polymesh-primitives/runtime-benchmarks", + "polymesh-runtime-common/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] +running-ci = [ + "pallet-statistics/running-ci", + "pallet-pips/running-ci", + "pallet-identity/running-ci", +] diff --git a/pallets/runtime/develop/build.rs b/pallets/runtime/develop/build.rs index 53a1759734..3225c322cd 100644 --- a/pallets/runtime/develop/build.rs +++ b/pallets/runtime/develop/build.rs @@ -1,10 +1,3 @@ -use wasm_builder_runner::WasmBuilder; - fn main() { - WasmBuilder::new() - .with_current_project() - .with_wasm_builder_from_path("../../../utils/wasm-builder") - .export_heap_base() - .import_memory() - .build() + polymesh_build_tool::build() } diff --git a/pallets/runtime/develop/src/benchmarks/mod.rs b/pallets/runtime/develop/src/benchmarks/mod.rs new file mode 100644 index 0000000000..b19bb6dd36 --- /dev/null +++ b/pallets/runtime/develop/src/benchmarks/mod.rs @@ -0,0 +1 @@ +pub mod pallet_session; diff --git a/pallets/runtime/develop/src/benchmarks/pallet_session.rs b/pallets/runtime/develop/src/benchmarks/pallet_session.rs new file mode 100644 index 0000000000..1140e14993 --- /dev/null +++ b/pallets/runtime/develop/src/benchmarks/pallet_session.rs @@ -0,0 +1,111 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Benchmarks for the Session Pallet. +// This is separated into its own crate due to cyclic dependency issues. + +// Modified by Polymath Inc - 4th January 2021 +// - It uses our Staking pallet. + +#![cfg_attr(not(feature = "std"), no_std)] + +use core::convert::TryInto; +use frame_benchmarking::benchmarks; +use frame_support::{ + storage::StorageMap, + traits::{Currency, OnInitialize}, +}; +use frame_system::RawOrigin; +use pallet_session::{Module as Session, *}; +use pallet_staking::{ + benchmarking::create_validator_with_nominators_with_balance, MAX_NOMINATIONS, +}; +use sp_std::prelude::*; +use sp_std::vec; + +use polymesh_common_utilities::constants::currency::POLY; + +pub struct Module(pallet_session::Module); +pub trait Trait: + pallet_session::Trait + pallet_session::historical::Trait + pallet_staking::Trait +{ +} + +impl OnInitialize for Module { + fn on_initialize(n: T::BlockNumber) -> frame_support::weights::Weight { + pallet_session::Module::::on_initialize(n) + } +} + +struct ValidatorInfo { + controller: T::AccountId, + keys: T::Keys, + proof: Vec, +} + +impl ValidatorInfo { + pub fn build(nominators: u32) -> Result, &'static str> + where + <::Currency as Currency< + ::AccountId, + >>::Balance: From, + { + let balance: u32 = (4_000 * POLY).try_into().unwrap(); + let stash = create_validator_with_nominators_with_balance::( + nominators, + MAX_NOMINATIONS as u32, + balance, + false, + )?; + let controller = pallet_staking::Module::::bonded(&stash).ok_or("not stash")?; + let keys = T::Keys::default(); + let proof: Vec = vec![0, 1, 2, 3]; + + // Whitelist controller account from further DB operations. + let controller_key = frame_system::Account::::hashed_key_for(&controller); + frame_benchmarking::benchmarking::add_to_whitelist(controller_key.into()); + + Ok(Self { + controller, + keys, + proof, + }) + } +} + +benchmarks! { + where_clause { + where <::Currency as Currency<::AccountId>>::Balance: From + } + + _ {} + + set_keys { + let n = MAX_NOMINATIONS as u32; + let validator = ValidatorInfo::::build(n)?; + + }: _(RawOrigin::Signed(validator.controller), validator.keys, validator.proof) + + purge_keys { + let n = MAX_NOMINATIONS as u32; + let validator = ValidatorInfo::::build(n)?; + let controller = RawOrigin::Signed(validator.controller.clone()); + + Session::::set_keys(controller.clone().into(), validator.keys, validator.proof)?; + + }: _(controller) +} diff --git a/pallets/runtime/develop/src/lib.rs b/pallets/runtime/develop/src/lib.rs index 05b8d61393..2f039fe9ed 100644 --- a/pallets/runtime/develop/src/lib.rs +++ b/pallets/runtime/develop/src/lib.rs @@ -8,6 +8,9 @@ pub mod runtime; pub use fee_details::CddHandler; pub mod constants; +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarks; + #[cfg(feature = "std")] pub use pallet_staking::StakerStatus; @@ -17,8 +20,8 @@ pub use runtime::{native_version, WASM_BINARY}; pub use runtime::{ api, Asset, Authorship, Balances, BalancesCall, BaseContracts, Bridge, Call, CheckedExtrinsic, - Contracts, MinimumPeriod, ProtocolFee, Runtime, RuntimeApi, SessionKeys, SignedExtra, System, - SystemCall, TargetBlockFullness, TransactionPayment, UncheckedExtrinsic, + Contracts, MinimumPeriod, ProtocolFee, Runtime, RuntimeApi, SessionKeys, System, SystemCall, + TransactionPayment, UncheckedExtrinsic, }; #[cfg(feature = "std")] diff --git a/pallets/runtime/develop/src/runtime.rs b/pallets/runtime/develop/src/runtime.rs index 7df04432b4..fd9547b6f8 100644 --- a/pallets/runtime/develop/src/runtime.rs +++ b/pallets/runtime/develop/src/runtime.rs @@ -1,10 +1,7 @@ #![allow(clippy::not_unsafe_ptr_arg_deref)] -use crate::{ - constants::{fee::*, time::*}, - fee_details::CddHandler, -}; +use crate::{constants::time::*, fee_details::CddHandler}; use codec::Encode; -use pallet_asset::{self as asset, checkpoint}; +use pallet_asset::{self as asset, checkpoint as pallet_checkpoint}; use pallet_balances as balances; use pallet_bridge as bridge; use pallet_committee as committee; @@ -41,12 +38,13 @@ use polymesh_runtime_common::{ impls::{Author, CurrencyToVoteHandler}, merge_active_and_inactive, AvailableBlockRatio, BlockExecutionWeight, BlockHashCount, ExtrinsicBaseWeight, MaximumBlockLength, MaximumBlockWeight, NegativeImbalance, RocksDbWeight, + TransactionByteFee, WeightToFee, }; use frame_support::{ construct_runtime, debug, parameter_types, traits::{KeyOwnerProofSystem, Randomness, SplitTwoWays}, - weights::{Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial}, + weights::Weight, }; use frame_system::EnsureRoot; use pallet_contracts_rpc_runtime_api::ContractExecResult; @@ -60,7 +58,7 @@ use sp_api::impl_runtime_apis; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_core::{ crypto::KeyTypeId, - u32_trait::{_1, _2, _4}, + u32_trait::{_1, _4}, OpaqueMetadata, }; use sp_inherents::{CheckInherentsResult, InherentData}; @@ -92,8 +90,6 @@ pub use pallet_timestamp::Call as TimestampCall; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; -use smallvec::smallvec; - // Make the WASM binary available. #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); @@ -107,10 +103,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 2013, + spec_version: 2014, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 5, + transaction_version: 6, }; /// Native version. @@ -193,7 +189,7 @@ parameter_types! { } impl pallet_babe::Trait for Runtime { - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_babe::WeightInfo; type EpochDuration = EpochDuration; type ExpectedBlockTime = ExpectedBlockTime; type EpochChangeTrigger = pallet_babe::ExternalTrigger; @@ -223,7 +219,7 @@ impl pallet_indices::Trait for Runtime { type Currency = Balances; type Deposit = IndexDeposit; type Event = Event; - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_indices::WeightInfo; } parameter_types! { @@ -241,26 +237,6 @@ pub type DealWithFees = SplitTwoWays< Author, // 1 part (20%) goes to the block author. >; -pub struct WeightToFee; -impl WeightToFeePolynomial for WeightToFee { - type Balance = Balance; - - fn polynomial() -> WeightToFeeCoefficients { - smallvec![WeightToFeeCoefficient { - degree: 1, - coeff_frac: Perbill::from_percent(3), // use only 3% of the exact weight value. - coeff_integer: 0u128, // Coefficient is zero. - negative: false, - }] - } -} - -parameter_types! { - pub const TransactionByteFee: Balance = 100 * MILLICENTS; - // for a sane configuration, this should always be less than `AvailableBlockRatio`. - pub const TargetBlockFullness: Perbill = TARGET_BLOCK_FULLNESS; -} - impl pallet_transaction_payment::Trait for Runtime { type Currency = Balances; type OnTransactionPayment = DealWithFees; @@ -344,7 +320,7 @@ impl pallet_session::Trait for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_session::WeightInfo; } impl pallet_session::historical::Trait for Runtime { @@ -376,13 +352,14 @@ parameter_types! { pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000); pub const MaxVariableInflationTotalIssuance: Balance = 1_000_000_000 * POLY; pub const FixedYearlyReward: Balance = 200_000_000 * POLY; + pub const MinimumBond: Balance = 1 * POLY; } impl pallet_staking::Trait for Runtime { type Currency = Balances; type UnixTime = Timestamp; type CurrencyToVote = CurrencyToVoteHandler; - type RewardRemainder = Treasury; + type RewardRemainder = (); type Event = Event; type Slash = Treasury; // send the slashed funds to the treasury. type Reward = (); // rewards are minted from the void @@ -399,7 +376,7 @@ impl pallet_staking::Trait for Runtime { type MinSolutionScoreBump = MinSolutionScoreBump; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type UnsignedPriority = StakingUnsignedPriority; - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_staking::WeightInfo; type RequiredAddOrigin = EnsureRoot; type RequiredRemoveOrigin = EnsureRoot; type RequiredComplianceOrigin = EnsureRoot; @@ -409,23 +386,21 @@ impl pallet_staking::Trait for Runtime { type MaxValidatorPerIdentity = MaxValidatorPerIdentity; type MaxVariableInflationTotalIssuance = MaxVariableInflationTotalIssuance; type FixedYearlyReward = FixedYearlyReward; + type MinimumBond = MinimumBond; type PalletsOrigin = OriginCaller; } -parameter_types! { - pub const MotionDuration: BlockNumber = 0; -} - /// Voting majority origin for `Instance`. -type VMO = committee::EnsureProportionAtLeast<_1, _2, AccountId, Instance>; +type VMO = committee::EnsureThresholdMet; type GovernanceCommittee = committee::Instance1; impl committee::Trait for Runtime { type Origin = Origin; type Proposal = Call; type CommitteeOrigin = VMO; + type VoteThresholdOrigin = Self::CommitteeOrigin; type Event = Event; - type MotionDuration = MotionDuration; + type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; } /// PolymeshCommittee as an instance of group impl group::Trait for Runtime { @@ -447,8 +422,9 @@ macro_rules! committee_config { type Proposal = Call; // Can act upon itself. type CommitteeOrigin = VMO; + type VoteThresholdOrigin = Self::CommitteeOrigin; type Event = Event; - type MotionDuration = MotionDuration; + type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; } impl group::Trait for Runtime { type Event = Event; @@ -536,7 +512,7 @@ where frame_system::CheckGenesis::::new(), frame_system::CheckEra::::from(generic::Era::mortal(period, current_block)), frame_system::CheckNonce::::from(nonce), - frame_system::CheckWeight::::new(), + polymesh_extensions::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(tip), pallet_permissions::StoreCallMetadata::::new(), ); @@ -558,14 +534,8 @@ impl treasury::Trait for Runtime { type WeightInfo = polymesh_weights::pallet_treasury::WeightInfo; } -parameter_types! { - pub const MaxScheduledInstructionLegsPerBlock: u32 = 500; - pub const MaxLegsInInstruction: u32 = 10; -} - impl settlement::Trait for Runtime { type Event = Event; - type MaxLegsInInstruction = MaxLegsInInstruction; type Scheduler = Scheduler; type SchedulerCall = Call; type WeightInfo = polymesh_weights::pallet_settlement::WeightInfo; @@ -573,6 +543,7 @@ impl settlement::Trait for Runtime { impl sto::Trait for Runtime { type Event = Event; + type WeightInfo = polymesh_weights::pallet_sto::WeightInfo; } parameter_types! { @@ -603,7 +574,7 @@ impl pallet_im_online::Trait for Runtime { } impl pallet_grandpa::Trait for Runtime { - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_grandpa::WeightInfo; type Event = Event; type Call = Call; @@ -672,12 +643,14 @@ impl asset::Trait for Runtime { type UnixTime = pallet_timestamp::Module; type AssetNameMaxLength = AssetNameMaxLength; type FundingRoundNameMaxLength = FundingRoundNameMaxLength; + type AssetFn = Asset; type AllowedGasLimit = AllowedGasLimit; type WeightInfo = polymesh_weights::pallet_asset::WeightInfo; + type CPWeightInfo = polymesh_weights::pallet_checkpoint::WeightInfo; } parameter_types! { - pub const MaxConditionComplexity: u32 = 150; + pub const MaxConditionComplexity: u32 = 50; } impl compliance_manager::Trait for Runtime { @@ -764,7 +737,6 @@ impl confidential::Trait for Runtime { } impl PermissionChecker for Runtime { - type Call = Call; type Checker = Identity; } @@ -794,7 +766,7 @@ impl pallet_scheduler::Trait for Runtime { type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = MaxScheduledPerBlock; - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_scheduler::WeightInfo; } construct_runtime!( @@ -804,33 +776,39 @@ construct_runtime!( UncheckedExtrinsic = UncheckedExtrinsic { System: frame_system::{Module, Call, Config, Storage, Event} = 0, - // Must be before session. Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned} = 1, - Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent} = 2, Indices: pallet_indices::{Module, Call, Storage, Config, Event} = 3, + + // Balance: Genesis config dependencies: System. Balances: balances::{Module, Call, Storage, Config, Event} = 4, + + // TransactionPayment: Genesis config dependencies: Balance. TransactionPayment: pallet_transaction_payment::{Module, Storage} = 5, - // Initialise identity earlier as other configs depend on it + // Identity: Genesis config deps: Timestamp. Identity: identity::{Module, Call, Storage, Event, Config} = 6, - - // Consensus frame_support. Authorship: pallet_authorship::{Module, Call, Storage, Inherent} = 7, + + // CddServiceProviders: Genesis config deps: Identity + CddServiceProviders: group::::{Module, Call, Storage, Event, Config} = 38, + + // Staking: Genesis config deps: Balances, Indices, Identity, Babe, Timestamp, CddServiceProviders. Staking: pallet_staking::{Module, Call, Config, Storage, Event, ValidateUnsigned} = 8, Offences: pallet_offences::{Module, Call, Storage, Event} = 9, + + // Session: Genesis config deps: System. Session: pallet_session::{Module, Call, Storage, Event, Config} = 10, FinalityTracker: pallet_finality_tracker::{Module, Call, Inherent} = 11, Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event} = 12, ImOnline: pallet_im_online::{Module, Call, Storage, Event, ValidateUnsigned, Config} = 13, AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config} = 14, RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage} = 15, - Historical: pallet_session_historical::{Module} = 16, + // Sudo. Usable initially. // RELEASE: remove this for release build. Sudo: pallet_sudo::{Module, Call, Config, Storage, Event} = 17, - MultiSig: multisig::{Module, Call, Config, Storage, Event} = 18, // Contracts @@ -840,22 +818,30 @@ construct_runtime!( // Polymesh Governance Committees Treasury: treasury::{Module, Call, Event} = 21, PolymeshCommittee: committee::::{Module, Call, Storage, Origin, Event, Config} = 22, + + // CommitteeMembership: Genesis config deps: PolymeshCommittee, Identity. CommitteeMembership: group::::{Module, Call, Storage, Event, Config} = 23, Pips: pallet_pips::{Module, Call, Storage, Event, Config} = 24, - TechnicalCommittee: committee::::{Module, Call, Storage, Origin, Event, Config} = 25, - TechnicalCommitteeMembership: group::::{Module, Call, Storage, Event, Config} = 26, + // TechnicalCommitteeMembership: Genesis config deps: TechnicalCommittee, Identity + TechnicalCommitteeMembership: group::::{Module, Call, Storage, Event, Config} = 26, UpgradeCommittee: committee::::{Module, Call, Storage, Origin, Event, Config} = 27, + + // UpgradeCommitteeMembership: Genesis config deps: UpgradeCommittee UpgradeCommitteeMembership: group::::{Module, Call, Storage, Event, Config} = 28, //Polymesh + //////////// + + // Asset: Genesis config deps: Timestamp, Asset: asset::{Module, Call, Storage, Config, Event} = 29, + + // Bridge: Genesis config deps: Multisig, Identity, Bridge: bridge::{Module, Call, Storage, Config, Event} = 31, ComplianceManager: compliance_manager::{Module, Call, Storage, Event} = 32, Settlement: settlement::{Module, Call, Storage, Event, Config} = 36, Sto: sto::{Module, Call, Storage, Event} = 37, - CddServiceProviders: group::::{Module, Call, Storage, Event, Config} = 38, Statistics: pallet_statistics::{Module, Call, Storage, Event} = 39, ProtocolFee: protocol_fee::{Module, Call, Storage, Event, Config} = 40, Utility: utility::{Module, Call, Storage, Event} = 41, @@ -866,7 +852,7 @@ construct_runtime!( CorporateAction: pallet_corporate_actions::{Module, Call, Storage, Event, Config} = 46, CorporateBallot: pallet_corporate_ballot::{Module, Call, Storage, Event} = 47, CapitalDistribution: pallet_capital_distribution::{Module, Call, Storage, Event} = 48, - Checkpoint: checkpoint::{Module, Call, Storage, Event, Config} = 49, + Checkpoint: pallet_checkpoint::{Module, Call, Storage, Event, Config} = 49, } ); @@ -887,7 +873,7 @@ pub type SignedExtra = ( frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, - frame_system::CheckWeight, + polymesh_extensions::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, pallet_permissions::StoreCallMetadata, ); @@ -1246,20 +1232,6 @@ impl_runtime_apis! { } } - impl node_rpc_runtime_api::portfolio::PortfolioApi for Runtime { - #[inline] - fn get_portfolios(did: IdentityId) -> node_rpc_runtime_api::portfolio::GetPortfoliosResult { - Ok(Portfolio::rpc_get_portfolios(did)) - } - - #[inline] - fn get_portfolio_assets(portfolio_id: PortfolioId) -> - node_rpc_runtime_api::portfolio::GetPortfolioAssetsResult - { - Ok(Portfolio::rpc_get_portfolio_assets(portfolio_id)) - } - } - #[cfg(feature = "runtime-benchmarks")] impl frame_benchmarking::Benchmark for Runtime { fn dispatch_benchmark( @@ -1267,8 +1239,10 @@ impl_runtime_apis! { ) -> Result, sp_runtime::RuntimeString> { use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey}; use frame_system_benchmarking::Module as SystemBench; + use crate::benchmarks::pallet_session::Module as SessionBench; impl frame_system_benchmarking::Trait for Runtime {} + impl crate::benchmarks::pallet_session::Trait for Runtime {} let whitelist: Vec = vec![ // Block Number @@ -1298,18 +1272,27 @@ impl_runtime_apis! { add_benchmark!(params, batches, frame_system, SystemBench::); add_benchmark!(params, batches, pallet_timestamp, Timestamp); add_benchmark!(params, batches, pallet_settlement, Settlement); + add_benchmark!(params, batches, pallet_sto, Sto); + add_benchmark!(params, batches, pallet_checkpoint, Checkpoint); add_benchmark!(params, batches, pallet_compliance_manager, ComplianceManager); add_benchmark!(params, batches, pallet_corporate_actions, CorporateAction); add_benchmark!(params, batches, pallet_corporate_ballot, CorporateBallot); add_benchmark!(params, batches, pallet_capital_distribution, CapitalDistribution); add_benchmark!(params, batches, polymesh_contracts, Contracts); add_benchmark!(params, batches, pallet_utility, Utility); + add_benchmark!(params, batches, pallet_committee, PolymeshCommittee); add_benchmark!(params, batches, pallet_confidential, Confidential); add_benchmark!(params, batches, pallet_treasury, Treasury); add_benchmark!(params, batches, pallet_im_online, ImOnline); add_benchmark!(params, batches, pallet_group, CddServiceProviders); add_benchmark!(params, batches, pallet_statistics, Statistics); add_benchmark!(params, batches, pallet_permissions, Permissions); + add_benchmark!(params, batches, pallet_babe, Babe); + add_benchmark!(params, batches, pallet_indices, Indices); + add_benchmark!(params, batches, pallet_session, SessionBench::); + add_benchmark!(params, batches, pallet_grandpa, Grandpa); + add_benchmark!(params, batches, pallet_scheduler, Scheduler); + add_benchmark!(params, batches, pallet_staking, Staking); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) diff --git a/pallets/runtime/extensions/Cargo.toml b/pallets/runtime/extensions/Cargo.toml new file mode 100644 index 0000000000..287b7a092a --- /dev/null +++ b/pallets/runtime/extensions/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "polymesh-extensions" +version = "0.1.0" +authors = ["Polymath"] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +polymesh-primitives = { path = "../../../primitives", default-features = false } +polymesh-common-utilities = { path = "../../common", default-features = false } + +pallet-transaction-payment = { path = "../../transaction-payment", default-features = false } +pallet-permissions = { path = "../../permissions", default-features = false } + +# Substrate +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } + +[features] +default = ["std"] +std = [ + "polymesh-primitives/std", + "polymesh-common-utilities/std", + "pallet-transaction-payment/std", + "pallet-permissions/std", + "frame-system/std", + "frame-support/std", + "sp-runtime/std", + "sp-std/std", +] + diff --git a/pallets/runtime/extensions/src/check_weight.rs b/pallets/runtime/extensions/src/check_weight.rs new file mode 100644 index 0000000000..4d5b8aae5d --- /dev/null +++ b/pallets/runtime/extensions/src/check_weight.rs @@ -0,0 +1,738 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Modified by Polymath Inc - 2nd February 2021 +// - Priority of a transaction is always zero. + +use codec::{Decode, Encode}; +use frame_support::{ + traits::Get, + weights::{DispatchClass, DispatchInfo, PostDispatchInfo}, + StorageValue, +}; +use frame_system::{weights::ExtrinsicsWeight, AllExtrinsicsLen, BlockWeight, Module, Trait}; +use sp_runtime::{ + traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf, Printable, SignedExtension}, + transaction_validity::{ + InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction, + }, + DispatchResult, Perbill, +}; + +/// Block resource (weight) limit check. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Default)] +pub struct CheckWeight(sp_std::marker::PhantomData); + +impl CheckWeight +where + T::Call: Dispatchable, +{ + /// Get the quota ratio of each dispatch class type. This indicates that all operational and mandatory + /// dispatches can use the full capacity of any resource, while user-triggered ones can consume + /// a portion. + fn get_dispatch_limit_ratio(class: DispatchClass) -> Perbill { + match class { + DispatchClass::Operational | DispatchClass::Mandatory => { + ::one() + } + DispatchClass::Normal => T::AvailableBlockRatio::get(), + } + } + + /// Checks if the current extrinsic does not exceed `MaximumExtrinsicWeight` limit. + fn check_extrinsic_weight( + info: &DispatchInfoOf, + ) -> Result<(), TransactionValidityError> { + match info.class { + // Mandatory transactions are included in a block unconditionally, so + // we don't verify weight. + DispatchClass::Mandatory => Ok(()), + // Normal transactions must not exceed `MaximumExtrinsicWeight`. + DispatchClass::Normal => { + let maximum_weight = T::MaximumExtrinsicWeight::get(); + let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); + if extrinsic_weight > maximum_weight { + Err(InvalidTransaction::ExhaustsResources.into()) + } else { + Ok(()) + } + } + // For operational transactions we make sure it doesn't exceed + // the space alloted for `Operational` class. + DispatchClass::Operational => { + let maximum_weight = T::MaximumBlockWeight::get(); + let operational_limit = + Self::get_dispatch_limit_ratio(DispatchClass::Operational) * maximum_weight; + let operational_limit = + operational_limit.saturating_sub(T::BlockExecutionWeight::get()); + let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); + if extrinsic_weight > operational_limit { + Err(InvalidTransaction::ExhaustsResources.into()) + } else { + Ok(()) + } + } + } + } + + /// Checks if the current extrinsic can fit into the block with respect to block weight limits. + /// + /// Upon successes, it returns the new block weight as a `Result`. + fn check_block_weight( + info: &DispatchInfoOf, + ) -> Result { + let maximum_weight = T::MaximumBlockWeight::get(); + let mut all_weight = Module::::block_weight(); + match info.class { + // If we have a dispatch that must be included in the block, it ignores all the limits. + DispatchClass::Mandatory => { + let extrinsic_weight = info.weight.saturating_add(T::ExtrinsicBaseWeight::get()); + all_weight.add(extrinsic_weight, DispatchClass::Mandatory); + Ok(all_weight) + } + // If we have a normal dispatch, we follow all the normal rules and limits. + DispatchClass::Normal => { + let normal_limit = + Self::get_dispatch_limit_ratio(DispatchClass::Normal) * maximum_weight; + let extrinsic_weight = info + .weight + .checked_add(T::ExtrinsicBaseWeight::get()) + .ok_or(InvalidTransaction::ExhaustsResources)?; + all_weight + .checked_add(extrinsic_weight, DispatchClass::Normal) + .map_err(|_| InvalidTransaction::ExhaustsResources)?; + if all_weight.get(DispatchClass::Normal) > normal_limit { + Err(InvalidTransaction::ExhaustsResources.into()) + } else { + Ok(all_weight) + } + } + // If we have an operational dispatch, allow it if we have not used our full + // "operational space" (independent of existing fullness). + DispatchClass::Operational => { + let operational_limit = + Self::get_dispatch_limit_ratio(DispatchClass::Operational) * maximum_weight; + let normal_limit = + Self::get_dispatch_limit_ratio(DispatchClass::Normal) * maximum_weight; + let operational_space = operational_limit.saturating_sub(normal_limit); + + let extrinsic_weight = info + .weight + .checked_add(T::ExtrinsicBaseWeight::get()) + .ok_or(InvalidTransaction::ExhaustsResources)?; + all_weight + .checked_add(extrinsic_weight, DispatchClass::Operational) + .map_err(|_| InvalidTransaction::ExhaustsResources)?; + + // If it would fit in normally, its okay + if all_weight.total() <= maximum_weight || + // If we have not used our operational space + all_weight.get(DispatchClass::Operational) <= operational_space + { + Ok(all_weight) + } else { + Err(InvalidTransaction::ExhaustsResources.into()) + } + } + } + } + + /// Checks if the current extrinsic can fit into the block with respect to block length limits. + /// + /// Upon successes, it returns the new block length as a `Result`. + fn check_block_length( + info: &DispatchInfoOf, + len: usize, + ) -> Result { + let current_len = Module::::all_extrinsics_len(); + let maximum_len = T::MaximumBlockLength::get(); + let limit = Self::get_dispatch_limit_ratio(info.class) * maximum_len; + let added_len = len as u32; + let next_len = current_len.saturating_add(added_len); + if next_len > limit { + Err(InvalidTransaction::ExhaustsResources.into()) + } else { + Ok(next_len) + } + } + + /// Creates new `SignedExtension` to check weight of the extrinsic. + pub fn new() -> Self { + Self(Default::default()) + } + + /// Do the pre-dispatch checks. This can be applied to both signed and unsigned. + /// + /// It checks and notes the new weight and length. + fn do_pre_dispatch( + info: &DispatchInfoOf, + len: usize, + ) -> Result<(), TransactionValidityError> { + let next_len = Self::check_block_length(info, len)?; + let next_weight = Self::check_block_weight(info)?; + Self::check_extrinsic_weight(info)?; + + AllExtrinsicsLen::put(next_len); + BlockWeight::put(next_weight); + Ok(()) + } + + /// Do the validate checks. This can be applied to both signed and unsigned transactions. + /// + /// It only checks that the block weight and length do not exceed their limits. + /// NOTE The returned transaction priority is 0 on success. + fn do_validate(info: &DispatchInfoOf, len: usize) -> TransactionValidity { + // ignore the next length. If they return `Ok`, then it is below the limit. + let _ = Self::check_block_length(info, len)?; + // during validation we skip block limit check. Since the `validate_transaction` + // call runs on an empty block anyway, by this we prevent `on_initialize` weight + // consumption from causing false negatives. + Self::check_extrinsic_weight(info)?; + + Ok(ValidTransaction::default()) + } +} + +impl SignedExtension for CheckWeight +where + T::Call: Dispatchable, +{ + type AccountId = T::AccountId; + type Call = T::Call; + type AdditionalSigned = (); + type Pre = (); + const IDENTIFIER: &'static str = "CheckWeight"; + + fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { + Ok(()) + } + + fn pre_dispatch( + self, + _who: &Self::AccountId, + _call: &Self::Call, + info: &DispatchInfoOf, + len: usize, + ) -> Result<(), TransactionValidityError> { + if info.class == DispatchClass::Mandatory { + Err(InvalidTransaction::MandatoryDispatch)? + } + Self::do_pre_dispatch(info, len) + } + + fn validate( + &self, + _who: &Self::AccountId, + _call: &Self::Call, + info: &DispatchInfoOf, + len: usize, + ) -> TransactionValidity { + if info.class == DispatchClass::Mandatory { + Err(InvalidTransaction::MandatoryDispatch)? + } + Self::do_validate(info, len) + } + + fn pre_dispatch_unsigned( + _call: &Self::Call, + info: &DispatchInfoOf, + len: usize, + ) -> Result<(), TransactionValidityError> { + Self::do_pre_dispatch(info, len) + } + + fn validate_unsigned( + _call: &Self::Call, + info: &DispatchInfoOf, + len: usize, + ) -> TransactionValidity { + Self::do_validate(info, len) + } + + fn post_dispatch( + _pre: Self::Pre, + info: &DispatchInfoOf, + post_info: &PostDispatchInfoOf, + _len: usize, + result: &DispatchResult, + ) -> Result<(), TransactionValidityError> { + // Since mandatory dispatched do not get validated for being overweight, we are sensitive + // to them actually being useful. Block producers are thus not allowed to include mandatory + // extrinsics that result in error. + if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) { + "Bad mandantory".print(); + e.print(); + + Err(InvalidTransaction::BadMandatory)? + } + + let unspent = post_info.calc_unspent(info); + if unspent > 0 { + BlockWeight::mutate(|current_weight| { + current_weight.sub(unspent, info.class); + }) + } + + Ok(()) + } +} + +impl sp_std::fmt::Debug for CheckWeight { + #[cfg(feature = "std")] + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + write!(f, "CheckWeight") + } + + #[cfg(not(feature = "std"))] + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::mock::{new_test_ext, System, Test, CALL}; + use crate::{AllExtrinsicsLen, BlockWeight}; + use frame_support::weights::{Pays, Weight}; + use frame_support::{assert_noop, assert_ok}; + use sp_std::marker::PhantomData; + + fn normal_weight_limit() -> Weight { + ::AvailableBlockRatio::get() * ::MaximumBlockWeight::get() + } + + fn normal_length_limit() -> u32 { + ::AvailableBlockRatio::get() * ::MaximumBlockLength::get() + } + + #[test] + fn mandatory_extrinsic_doesnt_care_about_limits() { + fn check(call: impl FnOnce(&DispatchInfo, usize)) { + new_test_ext().execute_with(|| { + let max = DispatchInfo { + weight: Weight::max_value(), + class: DispatchClass::Mandatory, + ..Default::default() + }; + let len = 0_usize; + + call(&max, len); + }); + } + + check(|max, len| { + assert_ok!(CheckWeight::::do_pre_dispatch(max, len)); + assert_eq!(System::block_weight().total(), Weight::max_value()); + assert!(System::block_weight().total() > ::MaximumBlockWeight::get()); + }); + check(|max, len| { + assert_ok!(CheckWeight::::do_validate(max, len)); + }); + } + + #[test] + fn normal_extrinsic_limited_by_maximum_extrinsic_weight() { + new_test_ext().execute_with(|| { + let max = DispatchInfo { + weight: ::MaximumExtrinsicWeight::get() + 1, + class: DispatchClass::Normal, + ..Default::default() + }; + let len = 0_usize; + + assert_noop!( + CheckWeight::::do_validate(&max, len), + InvalidTransaction::ExhaustsResources + ); + }); + } + + #[test] + fn operational_extrinsic_limited_by_operational_space_limit() { + new_test_ext().execute_with(|| { + let operational_limit = + CheckWeight::::get_dispatch_limit_ratio(DispatchClass::Operational) + * ::MaximumBlockWeight::get(); + let base_weight = ::ExtrinsicBaseWeight::get(); + let block_base = ::BlockExecutionWeight::get(); + + let weight = operational_limit - base_weight - block_base; + let okay = DispatchInfo { + weight, + class: DispatchClass::Operational, + ..Default::default() + }; + let max = DispatchInfo { + weight: weight + 1, + class: DispatchClass::Operational, + ..Default::default() + }; + let len = 0_usize; + + assert_eq!( + CheckWeight::::do_validate(&okay, len), + Ok(ValidTransaction::default()) + ); + assert_noop!( + CheckWeight::::do_validate(&max, len), + InvalidTransaction::ExhaustsResources + ); + }); + } + + #[test] + fn register_extra_weight_unchecked_doesnt_care_about_limits() { + new_test_ext().execute_with(|| { + System::register_extra_weight_unchecked(Weight::max_value(), DispatchClass::Normal); + assert_eq!(System::block_weight().total(), Weight::max_value()); + assert!(System::block_weight().total() > ::MaximumBlockWeight::get()); + }); + } + + #[test] + fn full_block_with_normal_and_operational() { + new_test_ext().execute_with(|| { + // Max block is 1024 + // Max normal is 768 (75%) + // 10 is taken for block execution weight + // So normal extrinsic can be 758 weight (-5 for base extrinsic weight) + // And Operational can be 256 to produce a full block (-5 for base) + let max_normal = DispatchInfo { + weight: 753, + ..Default::default() + }; + let rest_operational = DispatchInfo { + weight: 251, + class: DispatchClass::Operational, + ..Default::default() + }; + + let len = 0_usize; + + assert_ok!(CheckWeight::::do_pre_dispatch(&max_normal, len)); + assert_eq!(System::block_weight().total(), 768); + assert_ok!(CheckWeight::::do_pre_dispatch(&rest_operational, len)); + assert_eq!(::MaximumBlockWeight::get(), 1024); + assert_eq!( + System::block_weight().total(), + ::MaximumBlockWeight::get() + ); + // Checking single extrinsic should not take current block weight into account. + assert_eq!( + CheckWeight::::check_extrinsic_weight(&rest_operational), + Ok(()) + ); + }); + } + + #[test] + fn dispatch_order_does_not_effect_weight_logic() { + new_test_ext().execute_with(|| { + // We switch the order of `full_block_with_normal_and_operational` + let max_normal = DispatchInfo { + weight: 753, + ..Default::default() + }; + let rest_operational = DispatchInfo { + weight: 251, + class: DispatchClass::Operational, + ..Default::default() + }; + + let len = 0_usize; + + assert_ok!(CheckWeight::::do_pre_dispatch(&rest_operational, len)); + // Extra 15 here from block execution + base extrinsic weight + assert_eq!(System::block_weight().total(), 266); + assert_ok!(CheckWeight::::do_pre_dispatch(&max_normal, len)); + assert_eq!(::MaximumBlockWeight::get(), 1024); + assert_eq!( + System::block_weight().total(), + ::MaximumBlockWeight::get() + ); + }); + } + + #[test] + fn operational_works_on_full_block() { + new_test_ext().execute_with(|| { + // An on_initialize takes up the whole block! (Every time!) + System::register_extra_weight_unchecked(Weight::max_value(), DispatchClass::Mandatory); + let dispatch_normal = DispatchInfo { + weight: 251, + class: DispatchClass::Normal, + ..Default::default() + }; + let dispatch_operational = DispatchInfo { + weight: 251, + class: DispatchClass::Operational, + ..Default::default() + }; + let len = 0_usize; + + assert_noop!( + CheckWeight::::do_pre_dispatch(&dispatch_normal, len), + InvalidTransaction::ExhaustsResources + ); + // Thank goodness we can still do an operational transaction to possibly save the blockchain. + assert_ok!(CheckWeight::::do_pre_dispatch( + &dispatch_operational, + len + )); + // Not too much though + assert_noop!( + CheckWeight::::do_pre_dispatch(&dispatch_operational, len), + InvalidTransaction::ExhaustsResources + ); + // Even with full block, validity of single transaction should be correct. + assert_eq!( + CheckWeight::::check_extrinsic_weight(&dispatch_operational), + Ok(()) + ); + }); + } + + #[test] + fn signed_ext_check_weight_works_operational_tx() { + new_test_ext().execute_with(|| { + let normal = DispatchInfo { + weight: 100, + ..Default::default() + }; + let op = DispatchInfo { + weight: 100, + class: DispatchClass::Operational, + pays_fee: Pays::Yes, + }; + let len = 0_usize; + let normal_limit = normal_weight_limit(); + + // given almost full block + BlockWeight::mutate(|current_weight| { + current_weight.put(normal_limit, DispatchClass::Normal) + }); + // will not fit. + assert!(CheckWeight::(PhantomData) + .pre_dispatch(&1, CALL, &normal, len) + .is_err()); + // will fit. + assert!(CheckWeight::(PhantomData) + .pre_dispatch(&1, CALL, &op, len) + .is_ok()); + + // likewise for length limit. + let len = 100_usize; + AllExtrinsicsLen::put(normal_length_limit()); + assert!(CheckWeight::(PhantomData) + .pre_dispatch(&1, CALL, &normal, len) + .is_err()); + assert!(CheckWeight::(PhantomData) + .pre_dispatch(&1, CALL, &op, len) + .is_ok()); + }) + } + + #[test] + fn signed_ext_check_weight_works() { + new_test_ext().execute_with(|| { + let normal = DispatchInfo { + weight: 100, + class: DispatchClass::Normal, + pays_fee: Pays::Yes, + }; + let op = DispatchInfo { + weight: 100, + class: DispatchClass::Operational, + pays_fee: Pays::Yes, + }; + let len = 0_usize; + + let priority = CheckWeight::(PhantomData) + .validate(&1, CALL, &normal, len) + .unwrap() + .priority; + assert_eq!(priority, 0); + + let priority = CheckWeight::(PhantomData) + .validate(&1, CALL, &op, len) + .unwrap() + .priority; + assert_eq!(priority, 0); + }) + } + + #[test] + fn signed_ext_check_weight_block_size_works() { + new_test_ext().execute_with(|| { + let normal = DispatchInfo::default(); + let normal_limit = normal_weight_limit() as usize; + let reset_check_weight = |tx, s, f| { + AllExtrinsicsLen::put(0); + let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, tx, s); + if f { + assert!(r.is_err()) + } else { + assert!(r.is_ok()) + } + }; + + reset_check_weight(&normal, normal_limit - 1, false); + reset_check_weight(&normal, normal_limit, false); + reset_check_weight(&normal, normal_limit + 1, true); + + // Operational ones don't have this limit. + let op = DispatchInfo { + weight: 0, + class: DispatchClass::Operational, + pays_fee: Pays::Yes, + }; + reset_check_weight(&op, normal_limit, false); + reset_check_weight(&op, normal_limit + 100, false); + reset_check_weight(&op, 1024, false); + reset_check_weight(&op, 1025, true); + }) + } + + #[test] + fn signed_ext_check_weight_works_normal_tx() { + new_test_ext().execute_with(|| { + let normal_limit = normal_weight_limit(); + let small = DispatchInfo { + weight: 100, + ..Default::default() + }; + let medium = DispatchInfo { + weight: normal_limit - ::ExtrinsicBaseWeight::get(), + ..Default::default() + }; + let big = DispatchInfo { + weight: normal_limit - ::ExtrinsicBaseWeight::get() + 1, + ..Default::default() + }; + let len = 0_usize; + + let reset_check_weight = |i, f, s| { + BlockWeight::mutate(|current_weight| current_weight.put(s, DispatchClass::Normal)); + let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, i, len); + if f { + assert!(r.is_err()) + } else { + assert!(r.is_ok()) + } + }; + + reset_check_weight(&small, false, 0); + reset_check_weight(&medium, false, 0); + reset_check_weight(&big, true, 1); + }) + } + + #[test] + fn signed_ext_check_weight_refund_works() { + new_test_ext().execute_with(|| { + // This is half of the max block weight + let info = DispatchInfo { + weight: 512, + ..Default::default() + }; + let post_info = PostDispatchInfo { + actual_weight: Some(128), + pays_fee: Default::default(), + }; + let len = 0_usize; + + // We allow 75% for normal transaction, so we put 25% - extrinsic base weight + BlockWeight::mutate(|current_weight| { + current_weight.put( + 256 - ::ExtrinsicBaseWeight::get(), + DispatchClass::Normal, + ) + }); + + let pre = CheckWeight::(PhantomData) + .pre_dispatch(&1, CALL, &info, len) + .unwrap(); + assert_eq!(BlockWeight::get().total(), info.weight + 256); + + assert!( + CheckWeight::::post_dispatch(pre, &info, &post_info, len, &Ok(())).is_ok() + ); + assert_eq!( + BlockWeight::get().total(), + post_info.actual_weight.unwrap() + 256, + ); + }) + } + + #[test] + fn signed_ext_check_weight_actual_weight_higher_than_max_is_capped() { + new_test_ext().execute_with(|| { + let info = DispatchInfo { + weight: 512, + ..Default::default() + }; + let post_info = PostDispatchInfo { + actual_weight: Some(700), + pays_fee: Default::default(), + }; + let len = 0_usize; + + BlockWeight::mutate(|current_weight| current_weight.put(128, DispatchClass::Normal)); + + let pre = CheckWeight::(PhantomData) + .pre_dispatch(&1, CALL, &info, len) + .unwrap(); + assert_eq!( + BlockWeight::get().total(), + info.weight + 128 + ::ExtrinsicBaseWeight::get(), + ); + + assert!( + CheckWeight::::post_dispatch(pre, &info, &post_info, len, &Ok(())).is_ok() + ); + assert_eq!( + BlockWeight::get().total(), + info.weight + 128 + ::ExtrinsicBaseWeight::get(), + ); + }) + } + + #[test] + fn zero_weight_extrinsic_still_has_base_weight() { + new_test_ext().execute_with(|| { + let free = DispatchInfo { + weight: 0, + ..Default::default() + }; + let len = 0_usize; + + // Initial weight from `BlockExecutionWeight` + assert_eq!( + System::block_weight().total(), + ::BlockExecutionWeight::get() + ); + let r = CheckWeight::(PhantomData).pre_dispatch(&1, CALL, &free, len); + assert!(r.is_ok()); + assert_eq!( + System::block_weight().total(), + ::ExtrinsicBaseWeight::get() + + ::BlockExecutionWeight::get() + ); + }) + } +} diff --git a/pallets/runtime/extensions/src/lib.rs b/pallets/runtime/extensions/src/lib.rs new file mode 100644 index 0000000000..7f806fbc83 --- /dev/null +++ b/pallets/runtime/extensions/src/lib.rs @@ -0,0 +1,4 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +mod check_weight; +pub use check_weight::CheckWeight; diff --git a/pallets/runtime/testnet/Cargo.toml b/pallets/runtime/testnet/Cargo.toml index 4f21781c91..e5150bbdff 100644 --- a/pallets/runtime/testnet/Cargo.toml +++ b/pallets/runtime/testnet/Cargo.toml @@ -13,6 +13,7 @@ polymesh-common-utilities = { path = "../../common", default-features = false } polymesh-runtime-common = { path = "../common", default-features = false} polymesh-primitives = { path = "../../../primitives", default-features = false } polymesh-weights = { path = "../../weights", default-features = false } +polymesh-extensions = { path = "../extensions", default-features = false } # Our pallets pallet-asset = { path = "../../asset", default-features = false } @@ -22,8 +23,8 @@ pallet-bridge = { path = "../../bridge", default-features = false } pallet-committee = { path = "../../committee", default-features = false } pallet-compliance-manager = { path = "../../compliance-manager", default-features = false } pallet-confidential = { path = "../../confidential", default-features = false } -pallet-contracts = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-contracts-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0"} +pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-contracts-primitives = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1"} pallet-corporate-actions = { path = "../../corporate-actions", default-features = false } pallet-group = { path = "../../group", default-features = false } pallet-group-rpc-runtime-api = { path = "../../group/rpc/runtime-api", default-features = false } @@ -36,7 +37,7 @@ pallet-portfolio = { path = "../../portfolio", default-features = false } pallet-protocol-fee = { path = "../../protocol-fee", default-features = false } pallet-settlement = { path = "../../settlement", default-features = false } pallet-staking = { path = "../../staking", default-features = false } -pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-staking-reward-curve = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } pallet-statistics = { path = "../../statistics", default-features = false } pallet-transaction-payment = { path = "../../transaction-payment", default-features = false } pallet-treasury = { path = "../../treasury", default-features = false } @@ -48,7 +49,7 @@ pallet-sudo = { path = "../../sudo", default-features = false } node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } pallet-staking-rpc-runtime-api = { package = "pallet-staking-rpc-runtime-api", path = "../../staking/rpc/runtime-api", default-features = false } pallet-protocol-fee-rpc-runtime-api = { package = "pallet-protocol-fee-rpc-runtime-api", path = "../../protocol-fee/rpc/runtime-api", default-features = false } -pallet-contracts-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-contracts-rpc-runtime-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Others @@ -58,46 +59,47 @@ serde_derive = { version = "1.0.104", optional = true } # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-staking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-consensus-babe = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-authority-discovery = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-inherents = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-offchain = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-staking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-consensus-babe = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-transaction-pool = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-block-builder = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-executive = { package = "frame-executive", git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-finality-tracker = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-grandpa = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-indices = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-offences = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-babe = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-scheduler = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-authorship = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-executive = { package = "frame-executive", git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-finality-tracker = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-grandpa = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-indices = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-offences = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-babe = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-randomness-collective-flip = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-scheduler = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system-rpc-runtime-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } smallvec = "1.4.0" [build-dependencies] -wasm-builder-runner = { package = "substrate-wasm-builder-runner", git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0"} +polymesh-build-tool = { path = "../build_tool", default-features = false } [features] default = ["std", "equalize"] equalize = [] +migration-dry-run = [] no_std = [ "pallet-confidential/no_std", "pallet-confidential/u64_backend", diff --git a/pallets/runtime/testnet/build.rs b/pallets/runtime/testnet/build.rs index 53a1759734..3225c322cd 100644 --- a/pallets/runtime/testnet/build.rs +++ b/pallets/runtime/testnet/build.rs @@ -1,10 +1,3 @@ -use wasm_builder_runner::WasmBuilder; - fn main() { - WasmBuilder::new() - .with_current_project() - .with_wasm_builder_from_path("../../../utils/wasm-builder") - .export_heap_base() - .import_memory() - .build() + polymesh_build_tool::build() } diff --git a/pallets/runtime/testnet/src/lib.rs b/pallets/runtime/testnet/src/lib.rs index de96edd112..a8211d598f 100644 --- a/pallets/runtime/testnet/src/lib.rs +++ b/pallets/runtime/testnet/src/lib.rs @@ -15,10 +15,13 @@ pub use pallet_im_online::OfflineSlashingParams; #[cfg(feature = "std")] pub use runtime::{native_version, WASM_BINARY}; +#[cfg(feature = "migration-dry-run")] +pub use runtime::DryRunRuntimeUpgrade; + pub use runtime::{ api, Asset, Authorship, Balances, BalancesCall, BaseContracts, Bridge, Call, CheckedExtrinsic, - Contracts, MinimumPeriod, ProtocolFee, Runtime, RuntimeApi, SessionKeys, SignedExtra, System, - SystemCall, TargetBlockFullness, TransactionPayment, UncheckedExtrinsic, + Contracts, MinimumPeriod, ProtocolFee, Runtime, RuntimeApi, SessionKeys, System, SystemCall, + TransactionPayment, UncheckedExtrinsic, }; #[cfg(feature = "std")] diff --git a/pallets/runtime/testnet/src/runtime.rs b/pallets/runtime/testnet/src/runtime.rs index 7be9d07e2f..b22303a9f1 100644 --- a/pallets/runtime/testnet/src/runtime.rs +++ b/pallets/runtime/testnet/src/runtime.rs @@ -1,16 +1,17 @@ #![allow(clippy::not_unsafe_ptr_arg_deref)] -use crate::{ - constants::{fee::*, time::*}, - fee_details::CddHandler, -}; +use crate::{constants::time::*, fee_details::CddHandler}; use codec::Encode; + +#[cfg(feature = "migration-dry-run")] +use frame_support::traits::OnRuntimeUpgrade; + use frame_support::{ construct_runtime, debug, parameter_types, traits::{KeyOwnerProofSystem, Randomness, SplitTwoWays}, - weights::{Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial}, + weights::Weight, }; use frame_system::EnsureRoot; -use pallet_asset::{self as asset, checkpoint}; +use pallet_asset::{self as asset, checkpoint as pallet_checkpoint}; use pallet_balances as balances; use pallet_bridge as bridge; use pallet_committee as committee; @@ -53,12 +54,14 @@ use polymesh_runtime_common::{ impls::{Author, CurrencyToVoteHandler}, merge_active_and_inactive, AvailableBlockRatio, BlockExecutionWeight, BlockHashCount, ExtrinsicBaseWeight, MaximumBlockLength, MaximumBlockWeight, NegativeImbalance, RocksDbWeight, + TransactionByteFee, WeightToFee, }; + use sp_api::impl_runtime_apis; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_core::{ crypto::KeyTypeId, - u32_trait::{_1, _2, _3, _4}, + u32_trait::{_1, _4}, OpaqueMetadata, }; use sp_inherents::{CheckInherentsResult, InherentData}; @@ -89,8 +92,6 @@ pub use pallet_timestamp::Call as TimestampCall; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; -use smallvec::smallvec; - // Make the WASM binary available. #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); @@ -104,10 +105,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 2013, + spec_version: 2014, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 5, + transaction_version: 6, }; /// Native version. @@ -190,7 +191,7 @@ parameter_types! { } impl pallet_babe::Trait for Runtime { - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_babe::WeightInfo; type EpochDuration = EpochDuration; type ExpectedBlockTime = ExpectedBlockTime; type EpochChangeTrigger = pallet_babe::ExternalTrigger; @@ -220,7 +221,7 @@ impl pallet_indices::Trait for Runtime { type Event = Event; type Currency = Balances; type Deposit = IndexDeposit; - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_indices::WeightInfo; } parameter_types! { @@ -238,32 +239,12 @@ pub type DealWithFees = SplitTwoWays< Author, // 1 part (20%) goes to the block author. >; -pub struct WeightToFee; -impl WeightToFeePolynomial for WeightToFee { - type Balance = Balance; - - fn polynomial() -> WeightToFeeCoefficients { - smallvec![WeightToFeeCoefficient { - degree: 1, - coeff_frac: Perbill::from_percent(3), // use only 3% of the exact weight value. - coeff_integer: 0u128, // Coefficient is zero. - negative: false, - }] - } -} - impl CommonTrait for Runtime { type Balance = Balance; type AssetSubTraitTarget = Asset; type BlockRewardsReserve = balances::Module; } -parameter_types! { - pub const TransactionByteFee: Balance = 100 * MILLICENTS; - // for a sane configuration, this should always be less than `AvailableBlockRatio`. - pub const TargetBlockFullness: Perbill = TARGET_BLOCK_FULLNESS; -} - impl pallet_transaction_payment::Trait for Runtime { type Currency = Balances; type OnTransactionPayment = DealWithFees; @@ -341,7 +322,7 @@ impl pallet_session::Trait for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_session::WeightInfo; } impl pallet_session::historical::Trait for Runtime { @@ -373,13 +354,14 @@ parameter_types! { pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000); pub const MaxVariableInflationTotalIssuance: Balance = 1_000_000_000 * POLY; pub const FixedYearlyReward: Balance = 200_000_000 * POLY; + pub const MinimumBond: Balance = 1 * POLY; } impl pallet_staking::Trait for Runtime { type Currency = Balances; type UnixTime = Timestamp; type CurrencyToVote = CurrencyToVoteHandler; - type RewardRemainder = Treasury; + type RewardRemainder = (); type Event = Event; type Slash = Treasury; // send the slashed funds to the treasury. type Reward = (); // rewards are minted from the void @@ -406,23 +388,21 @@ impl pallet_staking::Trait for Runtime { type MaxValidatorPerIdentity = MaxValidatorPerIdentity; type MaxVariableInflationTotalIssuance = MaxVariableInflationTotalIssuance; type FixedYearlyReward = FixedYearlyReward; - type WeightInfo = (); -} - -parameter_types! { - pub const MotionDuration: BlockNumber = 0; + type MinimumBond = MinimumBond; + type WeightInfo = polymesh_weights::pallet_staking::WeightInfo; } /// Voting majority origin for `Instance`. -type VMO = committee::EnsureProportionAtLeast<_2, _3, AccountId, Instance>; +type VMO = committee::EnsureThresholdMet; type GovernanceCommittee = committee::Instance1; impl committee::Trait for Runtime { type Origin = Origin; type Proposal = Call; type CommitteeOrigin = VMO; + type VoteThresholdOrigin = Self::CommitteeOrigin; type Event = Event; - type MotionDuration = MotionDuration; + type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; } /// PolymeshCommittee as an instance of group @@ -445,8 +425,9 @@ macro_rules! committee_config { type Proposal = Call; // Can act upon itself. type CommitteeOrigin = VMO; + type VoteThresholdOrigin = Self::CommitteeOrigin; type Event = Event; - type MotionDuration = MotionDuration; + type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; } impl group::Trait for Runtime { type Event = Event; @@ -533,7 +514,7 @@ where frame_system::CheckGenesis::::new(), frame_system::CheckEra::::from(generic::Era::mortal(period, current_block)), frame_system::CheckNonce::::from(nonce), - frame_system::CheckWeight::::new(), + polymesh_extensions::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(tip), pallet_permissions::StoreCallMetadata::::new(), ); @@ -568,14 +549,8 @@ impl treasury::Trait for Runtime { type WeightInfo = polymesh_weights::pallet_treasury::WeightInfo; } -parameter_types! { - pub const MaxScheduledInstructionLegsPerBlock: u32 = 500; - pub const MaxLegsInInstruction: u32 = 10; -} - impl settlement::Trait for Runtime { type Event = Event; - type MaxLegsInInstruction = MaxLegsInInstruction; type Scheduler = Scheduler; type SchedulerCall = Call; type WeightInfo = polymesh_weights::pallet_settlement::WeightInfo; @@ -583,6 +558,7 @@ impl settlement::Trait for Runtime { impl sto::Trait for Runtime { type Event = Event; + type WeightInfo = polymesh_weights::pallet_sto::WeightInfo; } parameter_types! { @@ -613,7 +589,7 @@ impl pallet_im_online::Trait for Runtime { } impl pallet_grandpa::Trait for Runtime { - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_grandpa::WeightInfo; type Event = Event; type Call = Call; @@ -682,8 +658,10 @@ impl asset::Trait for Runtime { type UnixTime = pallet_timestamp::Module; type AssetNameMaxLength = AssetNameMaxLength; type FundingRoundNameMaxLength = FundingRoundNameMaxLength; + type AssetFn = Asset; type AllowedGasLimit = AllowedGasLimit; type WeightInfo = polymesh_weights::pallet_asset::WeightInfo; + type CPWeightInfo = polymesh_weights::pallet_checkpoint::WeightInfo; } parameter_types! { @@ -767,7 +745,6 @@ impl pallet_utility::Trait for Runtime { } impl PermissionChecker for Runtime { - type Call = Call; type Checker = Identity; } @@ -784,9 +761,11 @@ impl pallet_scheduler::Trait for Runtime { type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = MaxScheduledPerBlock; - type WeightInfo = (); + type WeightInfo = polymesh_weights::pallet_scheduler::WeightInfo; } +pub type AllModulesExported = AllModules; + construct_runtime!( pub enum Runtime where Block = Block, @@ -794,33 +773,39 @@ construct_runtime!( UncheckedExtrinsic = UncheckedExtrinsic { System: frame_system::{Module, Call, Config, Storage, Event} = 0, - // Must be before session. Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned} = 1, - Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent} = 2, Indices: pallet_indices::{Module, Call, Storage, Config, Event} = 3, + + // Balance: Genesis config dependencies: System. Balances: balances::{Module, Call, Storage, Config, Event} = 4, + + // TransactionPayment: Genesis config dependencies: Balance. TransactionPayment: pallet_transaction_payment::{Module, Storage} = 5, - // Initialise identity earlier as other configs depend on it + // Identity: Genesis config deps: Timestamp. Identity: identity::{Module, Call, Storage, Event, Config} = 6, - - // Consensus frame_support. Authorship: pallet_authorship::{Module, Call, Storage, Inherent} = 7, + + // CddServiceProviders: Genesis config deps: Identity + CddServiceProviders: group::::{Module, Call, Storage, Event, Config} = 38, + + // Staking: Genesis config deps: Balances, Indices, Identity, Babe, Timestamp, CddServiceProviders. Staking: pallet_staking::{Module, Call, Config, Storage, Event, ValidateUnsigned} = 8, Offences: pallet_offences::{Module, Call, Storage, Event} = 9, + + // Session: Genesis config deps: System. Session: pallet_session::{Module, Call, Storage, Event, Config} = 10, FinalityTracker: pallet_finality_tracker::{Module, Call, Inherent} = 11, Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event} = 12, ImOnline: pallet_im_online::{Module, Call, Storage, Event, ValidateUnsigned, Config} = 13, AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config} = 14, RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage} = 15, - Historical: pallet_session_historical::{Module} = 16, + // Sudo. Usable initially. // RELEASE: remove this for release build. Sudo: pallet_sudo::{Module, Call, Config, Storage, Event} = 17, - MultiSig: multisig::{Module, Call, Config, Storage, Event} = 18, // Contracts @@ -830,22 +815,30 @@ construct_runtime!( // Polymesh Governance Committees Treasury: treasury::{Module, Call, Event} = 21, PolymeshCommittee: committee::::{Module, Call, Storage, Origin, Event, Config} = 22, + + // CommitteeMembership: Genesis config deps: PolymeshCommittee, Identity. CommitteeMembership: group::::{Module, Call, Storage, Event, Config} = 23, Pips: pallet_pips::{Module, Call, Storage, Event, Config} = 24, - TechnicalCommittee: committee::::{Module, Call, Storage, Origin, Event, Config} = 25, - TechnicalCommitteeMembership: group::::{Module, Call, Storage, Event, Config} = 26, + // TechnicalCommitteeMembership: Genesis config deps: TechnicalCommittee, Identity + TechnicalCommitteeMembership: group::::{Module, Call, Storage, Event, Config} = 26, UpgradeCommittee: committee::::{Module, Call, Storage, Origin, Event, Config} = 27, + + // UpgradeCommitteeMembership: Genesis config deps: UpgradeCommittee UpgradeCommitteeMembership: group::::{Module, Call, Storage, Event, Config} = 28, //Polymesh + //////////// + + // Asset: Genesis config deps: Timestamp, Asset: asset::{Module, Call, Storage, Config, Event} = 29, + + // Bridge: Genesis config deps: Multisig, Identity, Bridge: bridge::{Module, Call, Storage, Config, Event} = 31, ComplianceManager: compliance_manager::{Module, Call, Storage, Event} = 32, Settlement: settlement::{Module, Call, Storage, Event, Config} = 36, Sto: sto::{Module, Call, Storage, Event} = 37, - CddServiceProviders: group::::{Module, Call, Storage, Event, Config} = 38, Statistics: pallet_statistics::{Module, Call, Storage, Event} = 39, ProtocolFee: protocol_fee::{Module, Call, Storage, Event, Config} = 40, Utility: utility::{Module, Call, Storage, Event} = 41, @@ -855,7 +848,7 @@ construct_runtime!( CorporateAction: pallet_corporate_actions::{Module, Call, Storage, Event, Config} = 46, CorporateBallot: pallet_corporate_ballot::{Module, Call, Storage, Event} = 47, CapitalDistribution: pallet_capital_distribution::{Module, Call, Storage, Event} = 48, - Checkpoint: checkpoint::{Module, Call, Storage, Event, Config} = 49, + Checkpoint: pallet_checkpoint::{Module, Call, Storage, Event, Config} = 49, } ); @@ -876,7 +869,7 @@ pub type SignedExtra = ( frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, - frame_system::CheckWeight, + polymesh_extensions::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, pallet_permissions::StoreCallMetadata, ); @@ -1236,18 +1229,19 @@ impl_runtime_apis! { CommitteeMembership::inactive_members()) } } +} - impl node_rpc_runtime_api::portfolio::PortfolioApi for Runtime { - #[inline] - fn get_portfolios(did: IdentityId) -> node_rpc_runtime_api::portfolio::GetPortfoliosResult { - Ok(Portfolio::rpc_get_portfolios(did)) - } +/// Trait for testing storage migrations. +/// NB: Since this is defined outside the `impl_runtime_apis` macro, it is not callable in WASM. +#[cfg(feature = "migration-dry-run")] +pub trait DryRunRuntimeUpgrade { + /// dry-run runtime upgrades, returning the total weight consumed. + fn dry_run_runtime_upgrade() -> u64; +} - #[inline] - fn get_portfolio_assets(portfolio_id: PortfolioId) -> - node_rpc_runtime_api::portfolio::GetPortfolioAssetsResult - { - Ok(Portfolio::rpc_get_portfolio_assets(portfolio_id)) - } +#[cfg(feature = "migration-dry-run")] +impl DryRunRuntimeUpgrade for Runtime { + fn dry_run_runtime_upgrade() -> Weight { + ::on_runtime_upgrade() } } diff --git a/pallets/runtime/tests/Cargo.toml b/pallets/runtime/tests/Cargo.toml index f3d5390eee..b0fb199838 100644 --- a/pallets/runtime/tests/Cargo.toml +++ b/pallets/runtime/tests/Cargo.toml @@ -7,8 +7,8 @@ edition = "2018" [dependencies] polymesh-common-utilities = { path = "../../common", default-features = false } polymesh-primitives = { path = "../../../primitives", default-features = false } -polymesh-primitives-derive = { path = "../../../primitives_derive", default-features = false } polymesh-runtime-common = { path = "../common", default-features = false } +polymesh-extensions = { path = "../extensions", default-features = false } pallet-asset = { path = "../../asset", default-features = false } pallet-balances = { path = "../../balances", default-features = false } @@ -17,7 +17,7 @@ pallet-bridge = { path = "../../bridge", default-features = false } pallet-committee = { path = "../../committee", default-features = false } pallet-compliance-manager = { path = "../../compliance-manager", default-features = false } pallet-confidential = { path = "../../confidential", default-features = false } -pallet-contracts = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", default-features = false } +pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", default-features = false } pallet-corporate-actions = { path = "../../corporate-actions", default-features = false } pallet-group = { path = "../../group", default-features = false } pallet-identity = { path = "../../identity", default-features = false, features = ["no_cdd"] } @@ -28,18 +28,19 @@ pallet-portfolio = { path = "../../portfolio", default-features = false } pallet-protocol-fee = { path = "../../protocol-fee", default-features = false } pallet-settlement = { path = "../../settlement", default-features = false } pallet-staking = { path = "../../staking", default-features = false } -pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-staking-reward-curve = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } pallet-statistics = { path = "../../statistics", default-features = false } pallet-transaction-payment = { path = "../../transaction-payment", default-features = false } pallet-treasury = { path = "../../treasury", default-features = false } pallet-utility = { path = "../../utility", default-features = false } +pallet-sudo = { path = "../../sudo", default-features = false } polymesh-contracts = { path = "../../contracts", default-features = false } # RPC pallet-group-rpc-runtime-api = { path = "../../group/rpc/runtime-api", default-features = false } # Crypto -confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "v2.2.0" } +confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "v2.2.2" } # Runtime polymesh-runtime-develop = { path = "../develop" } @@ -57,29 +58,29 @@ serde_json = '1.0.48' # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-staking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-npos-elections = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0"} -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-staking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-npos-elections = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1"} +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0", features = ["historical"] } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate/", default-features = false, tag = "v2.0.0" } -pallet-babe = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-scheduler = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-authorship = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1", features = ["historical"] } +pallet-randomness-collective-flip = { git = "https://github.com/PolymathNetwork/substrate/", default-features = false, tag = "v2.0.1-1" } +pallet-babe = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-scheduler = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } ink_primitives = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } -test_client = { package = "substrate-test-runtime-client", git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } -substrate-test-utils = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +test_client = { package = "substrate-test-runtime-client", git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } +substrate-test-utils = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } polymesh-weights = { path = "../../weights", default-features = false } [dev-dependencies] @@ -122,6 +123,7 @@ std = [ "pallet-timestamp/std", "pallet-transaction-payment/std", "pallet-treasury/std", + "pallet-sudo/std", "polymesh-common-utilities/std", "polymesh-primitives/std", "polymesh-runtime-common/std", diff --git a/pallets/runtime/tests/src/asset_test.rs b/pallets/runtime/tests/src/asset_test.rs index df614c4f67..d58dc9bb1b 100644 --- a/pallets/runtime/tests/src/asset_test.rs +++ b/pallets/runtime/tests/src/asset_test.rs @@ -5,7 +5,7 @@ use crate::{ storage::{ add_secondary_key, make_account_without_cdd, provide_scope_claim, provide_scope_claim_to_multiple_parties, register_keyring_account, - register_keyring_account_without_cdd, root, AccountId, Checkpoint, TestStorage, + register_keyring_account_without_cdd, root, AccountId, Checkpoint, TestStorage, User, }, }; use chrono::prelude::Utc; @@ -18,9 +18,10 @@ use ink_primitives::hash as FunctionSelectorHasher; use pallet_asset::checkpoint::ScheduleSpec; use pallet_asset::ethereum; use pallet_asset::{ - self as asset, AssetOwnershipRelation, ClassicTickerImport, ClassicTickerRegistration, - ClassicTickers, ScopeIdOf, SecurityToken, TickerRegistration, TickerRegistrationConfig, - Tickers, + self as asset, + checkpoint::{ScheduleId, StoredSchedule}, + AssetOwnershipRelation, ClassicTickerImport, ClassicTickerRegistration, ClassicTickers, + ScopeIdOf, SecurityToken, TickerRegistration, TickerRegistrationConfig, Tickers, }; use pallet_balances as balances; use pallet_compliance_manager as compliance_manager; @@ -28,18 +29,17 @@ use pallet_contracts::ContractAddressFor; use pallet_identity as identity; use pallet_statistics as statistics; use polymesh_common_utilities::{ - asset::{AssetType, FundingRoundName}, - constants::*, - protocol_fee::ProtocolOp, - traits::balances::Memo, - traits::CddAndFeeDetails as _, + constants::*, protocol_fee::ProtocolOp, traits::balances::Memo, traits::CddAndFeeDetails as _, SystematicIssuers, }; use polymesh_contracts::NonceBasedAddressDeterminer; use polymesh_primitives::{ - calendar::{CalendarPeriod, CalendarUnit, CheckpointId, FixedOrVariableCalendarUnit}, - AssetIdentifier, AuthorizationData, Document, DocumentId, IdentityId, InvestorUid, PortfolioId, - Signatory, SmartExtension, SmartExtensionType, Ticker, + asset::{AssetType, FundingRoundName}, + calendar::{ + CalendarPeriod, CalendarUnit, CheckpointId, CheckpointSchedule, FixedOrVariableCalendarUnit, + }, + AssetIdentifier, AuthorizationData, Document, DocumentId, IdentityId, InvestorUid, Moment, + PortfolioId, Signatory, SmartExtension, SmartExtensionType, Ticker, }; use rand::Rng; use sp_io::hashing::keccak_256; @@ -346,6 +346,15 @@ fn issuers_can_redeem_tokens() { }) } +fn default_transfer(from: IdentityId, to: IdentityId, ticker: Ticker, val: u128) { + assert_ok!(Asset::unsafe_transfer( + PortfolioId::default_portfolio(from), + PortfolioId::default_portfolio(to), + &ticker, + val + )); +} + #[test] fn checkpoints_fuzz_test() { println!("Starting"); @@ -403,12 +412,7 @@ fn checkpoints_fuzz_test() { } owner_balance[j] -= 1; bob_balance[j] += 1; - assert_ok!(Asset::unsafe_transfer( - PortfolioId::default_portfolio(owner_did), - PortfolioId::default_portfolio(bob_did), - &ticker, - 1 - )); + default_transfer(owner_did, bob_did, ticker, 1); } assert_ok!(Checkpoint::create_checkpoint(owner_signed.clone(), ticker)); let bal_at = |id, did| Asset::get_balance_at(ticker, did, CheckpointId(id)); @@ -2444,10 +2448,15 @@ fn classic_ticker_claim_works() { assert_eq!(alice_did, Tickers::::get(ticker).owner); assert!(matches!( &*System::events(), - [.., frame_system::EventRecord { - event: super::storage::EventTest::asset(pallet_asset::RawEvent::ClassicTickerClaimed(..)), - .. - }] + [ + .., + frame_system::EventRecord { + event: super::storage::EventTest::asset( + pallet_asset::RawEvent::ClassicTickerClaimed(..) + ), + .. + } + ] )); } @@ -2456,7 +2465,8 @@ fn classic_ticker_claim_works() { let asset = name.try_into().unwrap(); let ticker = ticker(name); let signer = Origin::signed(acc); - let ret = Asset::create_asset(signer, asset, ticker, 1, true, <_>::default(), vec![], None); + let ret = + Asset::create_asset(signer, asset, ticker, 1, true, <_>::default(), vec![], None); assert_balance(acc, bal_after, 0); ret }; @@ -2473,9 +2483,15 @@ fn classic_ticker_claim_works() { // Now `DELTA` has expired as well. Bob registers it, so its not classic anymore and fee is charged. let (bob_acc, _) = focus_user(AccountKeyring::Bob, 0); assert!(ClassicTickers::get(&ticker("DELTA")).is_some()); - assert_ok!(Asset::register_ticker(Origin::signed(bob_acc), ticker("DELTA"))); + assert_ok!(Asset::register_ticker( + Origin::signed(bob_acc), + ticker("DELTA") + )); assert_eq!(ClassicTickers::get(&ticker("DELTA")), None); - assert_noop!(create(bob_acc, "DELTA", 0), FeeError::InsufficientAccountBalance); + assert_noop!( + create(bob_acc, "DELTA", 0), + FeeError::InsufficientAccountBalance + ); // Repeat for `EPSILON`, but directly `create_asset` instead. let (charlie_acc, charlie_did) = focus_user(AccountKeyring::Charlie, 2 * fee); @@ -2494,7 +2510,10 @@ fn classic_ticker_claim_works() { AuthorizationData::TransferTicker(zeta), None, ); - assert_ok!(Asset::accept_ticker_transfer(Origin::signed(charlie_acc), auth_id_alice)); + assert_ok!(Asset::accept_ticker_transfer( + Origin::signed(charlie_acc), + auth_id_alice + )); assert_eq!(ClassicTickers::get(&zeta), None); assert_ok!(create(charlie_acc, "ZETA", 0 * fee)); assert_eq!(ClassicTickers::get(&zeta), None); @@ -2690,6 +2709,7 @@ fn next_checkpoint_is_updated_we() { let schedule = ScheduleSpec { start: Some(start), period, + remaining: 0, }; assert_ok!(Checkpoint::set_schedules_max_complexity( root(), @@ -2698,8 +2718,8 @@ fn next_checkpoint_is_updated_we() { assert_ok!(Checkpoint::create_schedule(alice_signed, ticker, schedule)); let id = CheckpointId(1); assert_eq!(id, Checkpoint::checkpoint_id_sequence(&ticker)); - assert_eq!(start, Checkpoint::timestamps(id)); - assert_eq!(total_supply, Checkpoint::total_supply_at(&(ticker, id))); + assert_eq!(start, Checkpoint::timestamps(ticker, id)); + assert_eq!(total_supply, Checkpoint::total_supply_at(ticker, id)); assert_eq!(total_supply, Asset::get_balance_at(ticker, alice_did, id)); assert_eq!(0, Asset::get_balance_at(ticker, bob_did, id)); let checkpoint2 = start + period_ms; @@ -2708,12 +2728,7 @@ fn next_checkpoint_is_updated_we() { let transfer = |at| { Timestamp::set_timestamp(at); - assert_ok!(Asset::unsafe_transfer( - PortfolioId::default_portfolio(alice_did), - PortfolioId::default_portfolio(bob_did), - &ticker, - total_supply / 2, - )); + default_transfer(alice_did, bob_did, ticker, total_supply / 2); }; // Make a transaction before the next timestamp. @@ -2728,7 +2743,7 @@ fn next_checkpoint_is_updated_we() { let id = CheckpointId(2); assert_eq!(vec![start + 2 * period_ms], checkpoint_ats(ticker)); assert_eq!(id, Checkpoint::checkpoint_id_sequence(&ticker)); - assert_eq!(start + period_ms, Checkpoint::timestamps(id)); + assert_eq!(start + period_ms, Checkpoint::timestamps(ticker, id)); assert_eq!( total_supply / 2, Asset::get_balance_at(ticker, alice_did, id) @@ -2770,6 +2785,7 @@ fn non_recurring_schedule_works_we() { let schedule = ScheduleSpec { start: Some(start), period, + remaining: 0, }; assert_ok!(Checkpoint::set_schedules_max_complexity( root(), @@ -2778,8 +2794,8 @@ fn non_recurring_schedule_works_we() { assert_ok!(Checkpoint::create_schedule(alice_signed, ticker, schedule)); let id = CheckpointId(1); assert_eq!(id, Checkpoint::checkpoint_id_sequence(&ticker)); - assert_eq!(start, Checkpoint::timestamps(id)); - assert_eq!(total_supply, Checkpoint::total_supply_at(&(ticker, id))); + assert_eq!(start, Checkpoint::timestamps(ticker, id)); + assert_eq!(total_supply, Checkpoint::total_supply_at(ticker, id)); assert_eq!(total_supply, Asset::get_balance_at(ticker, alice_did, id)); assert_eq!(0, Asset::get_balance_at(ticker, bob_did, id)); // The schedule will not recur. @@ -2799,3 +2815,143 @@ fn next_checkpoints(ticker: Ticker, start: u64) -> Vec> { .map(|s| s.schedule.next_checkpoint(start)) .collect() } + +#[test] +fn schedule_remaining_works() { + ExtBuilder::default().build().execute_with(|| { + let start = 1_000; + Timestamp::set_timestamp(start); + + let alice = User::new(AccountKeyring::Alice); + let bob = User::new(AccountKeyring::Bob); + + // Create the asset. + let token_name = b"NXT"; + let ticker = Ticker::try_from(&token_name[..]).unwrap(); + assert_ok!(Asset::create_asset( + alice.origin(), + token_name.into(), + ticker, + 1_000_000, + true, + AssetType::default(), + vec![], + None, + )); + + let transfer = |at: Moment| { + Timestamp::set_timestamp(at * 1_000); + default_transfer(alice.did, bob.did, ticker, 1); + }; + let collect_ts = |sh_id| { + Checkpoint::schedule_points(ticker, sh_id) + .into_iter() + .map(|cp| Checkpoint::timestamps(ticker, cp)) + .collect::>() + }; + + // No schedules yet. + assert_eq!(Checkpoint::schedules(ticker), vec![]); + + // For simplicity, we use 1s = 1_000ms periods. + let period = CalendarPeriod { + unit: CalendarUnit::Second, + amount: 1, + }; + + // Allow such a schedule to be added on-chain. Otherwise, we'll have errors. + assert_ok!(Checkpoint::set_schedules_max_complexity( + root(), + period.complexity() + )); + + // Create a schedule with one remaining and where `start == now`. + let mut spec = ScheduleSpec { + start: Some(start), + period, + remaining: 1, + }; + let schedule = CheckpointSchedule { start, period }; + assert_ok!(Checkpoint::create_schedule(alice.origin(), ticker, spec)); + + // We had `remaining == 1` and `start == now`, + // so since a CP was created, hence `remaining => 0`, + // the schedule was immediately evicted. + assert_eq!(Checkpoint::schedules(ticker), vec![]); + assert_eq!(collect_ts(ScheduleId(1)), vec![start]); + + // This time, we set `remaining == 5`, but we still have `start == now`, + // thus one CP is immediately created, so `remaining => 4`. + spec.remaining = 5; + let id2 = ScheduleId(2); + let assert_ts = |ticks| { + assert_eq!( + collect_ts(id2), + (1..=ticks).map(|x| x * 1_000).collect::>() + ); + }; + let assert_sh = |at: Moment, remaining| { + assert_eq!( + Checkpoint::schedules(ticker), + vec![StoredSchedule { + id: id2, + schedule, + at: 1_000 * at, + remaining, + }] + ); + }; + assert_ok!(Checkpoint::create_schedule(alice.origin(), ticker, spec)); + assert_sh(2, 4); + assert_ts(1); + + // Transfer and move through the 2nd to 4th recurrences. + for i in 2..5 { + transfer(i); + assert_sh(i + 1, spec.remaining - i as u32); + assert_ts(i); + } + + // Transfer and move to the 5th (last) recurrence. + // We've to the point where there are no ticks left. + transfer(5); + assert_eq!(Checkpoint::schedules(ticker), vec![]); + assert_ts(5); + }); +} + +#[test] +fn mesh_1531_ts_collission_regression_test() { + ExtBuilder::default().build().execute_with(|| { + // Create the assets. + let owner = User::new(AccountKeyring::Alice); + let asset = |name: &[u8]| { + let ticker = Ticker::try_from(&name[..]).unwrap(); + assert_ok!(Asset::create_asset( + owner.origin(), + name.into(), + ticker, + 1_000_000, + true, + AssetType::default(), + vec![], + None, + )); + ticker + }; + let alpha = asset(b"ALPHA"); + let beta = asset(b"BETA"); + + // First CP is made at 1s. + let cp = CheckpointId(1); + Timestamp::set_timestamp(1_000); + assert_ok!(Checkpoint::create_checkpoint(owner.origin(), alpha)); + assert_eq!(Checkpoint::timestamps(alpha, cp), 1_000); + + // Second CP is for beta, using same ID. + Timestamp::set_timestamp(2_000); + assert_ok!(Checkpoint::create_checkpoint(owner.origin(), beta)); + assert_eq!(Checkpoint::timestamps(alpha, cp), 1_000); + assert_eq!(Checkpoint::timestamps(beta, cp), 2_000); + }); +} diff --git a/pallets/runtime/tests/src/committee_test.rs b/pallets/runtime/tests/src/committee_test.rs index 7304b275af..f68785addb 100644 --- a/pallets/runtime/tests/src/committee_test.rs +++ b/pallets/runtime/tests/src/committee_test.rs @@ -223,7 +223,6 @@ fn motions_revoting_works_we() { index: 0, ayes: vec![alice_did], nays: vec![], - end: System::block_number(), expiry: <_>::default(), }) ); @@ -238,7 +237,6 @@ fn motions_revoting_works_we() { index: 0, ayes: vec![], nays: vec![alice_did], - end: System::block_number(), expiry: <_>::default(), }) ); @@ -282,7 +280,7 @@ fn changing_vote_threshold_works() { /// Constructs an origin for the governance council voting majority. pub fn gc_vmo() -> Origin { - pallet_committee::Origin::::Members(0, 0).into() + pallet_committee::Origin::::Endorsed(<_>::default()).into() } fn changing_vote_threshold_works_we() { @@ -355,7 +353,6 @@ fn rage_quit_we() { index: 0, ayes: vec![bob_did], nays: vec![charlie_did], - end: System::block_number(), expiry: <_>::default(), }) ); @@ -368,7 +365,6 @@ fn rage_quit_we() { index: 0, ayes: vec![], nays: vec![charlie_did], - end: System::block_number(), expiry: <_>::default(), }) ); @@ -381,7 +377,6 @@ fn rage_quit_we() { index: 0, ayes: vec![], nays: vec![], - end: System::block_number(), expiry: <_>::default(), }) ); @@ -398,7 +393,6 @@ fn rage_quit_we() { index: 0, ayes: vec![], nays: vec![bob_did], - end: System::block_number(), expiry: <_>::default(), }) ); @@ -409,7 +403,6 @@ fn rage_quit_we() { index: 0, ayes: vec![alice_did], nays: vec![bob_did], - end: System::block_number(), expiry: <_>::default(), }) ); @@ -581,7 +574,6 @@ fn mesh_1065_regression_test() { index: 0, ayes, nays: vec![], - end: System::block_number(), expiry: <_>::default(), }) ); diff --git a/pallets/runtime/tests/src/compliance_manager_test.rs b/pallets/runtime/tests/src/compliance_manager_test.rs index 5d1cea5f0b..28d02a1581 100644 --- a/pallets/runtime/tests/src/compliance_manager_test.rs +++ b/pallets/runtime/tests/src/compliance_manager_test.rs @@ -17,13 +17,11 @@ use pallet_group as group; use pallet_identity as identity; use polymesh_common_utilities::{ constants::{ERC1400_TRANSFER_FAILURE, ERC1400_TRANSFER_SUCCESS}, - traits::{ - asset::{AssetName, AssetType}, - compliance_manager::Trait as ComplianceManagerTrait, - }, + traits::compliance_manager::Trait as ComplianceManagerTrait, Context, }; use polymesh_primitives::{ + asset::{AssetName, AssetType}, AuthorizationData, Claim, ClaimType, Condition, ConditionType, CountryCode, IdentityId, PortfolioId, Scope, Signatory, TargetIdentity, Ticker, TrustedFor, TrustedIssuer, }; diff --git a/pallets/runtime/tests/src/confidential_test.rs b/pallets/runtime/tests/src/confidential_test.rs index 1bdcaafcce..a8ccf10963 100644 --- a/pallets/runtime/tests/src/confidential_test.rs +++ b/pallets/runtime/tests/src/confidential_test.rs @@ -8,10 +8,10 @@ use pallet_asset::{self as asset, SecurityToken}; use pallet_compliance_manager as compliance_manager; use pallet_confidential as confidential; use pallet_identity as identity; -use polymesh_common_utilities::{asset::AssetType, constants::ERC1400_TRANSFER_SUCCESS}; +use polymesh_common_utilities::constants::ERC1400_TRANSFER_SUCCESS; use polymesh_primitives::{ - AssetIdentifier, Claim, IdentityId, InvestorUid, InvestorZKProofData, PortfolioId, Scope, - Ticker, + asset::AssetType, AssetIdentifier, Claim, IdentityId, InvestorUid, InvestorZKProofData, + PortfolioId, Scope, Ticker, }; use core::convert::TryFrom; diff --git a/pallets/runtime/tests/src/corporate_actions_test.rs b/pallets/runtime/tests/src/corporate_actions_test.rs index 4717a4d8df..2b7e86b675 100644 --- a/pallets/runtime/tests/src/corporate_actions_test.rs +++ b/pallets/runtime/tests/src/corporate_actions_test.rs @@ -20,8 +20,9 @@ use pallet_corporate_actions::{ TargetTreatment::{Exclude, Include}, Tax, }; -use polymesh_common_utilities::asset::{AssetName, Trait as _}; +use polymesh_common_utilities::asset::AssetFnTrait; use polymesh_primitives::{ + asset::AssetName, calendar::{CheckpointId, CheckpointSchedule}, AuthorizationData, Document, DocumentId, IdentityId, Moment, PortfolioId, PortfolioNumber, Signatory, Ticker, @@ -548,18 +549,18 @@ fn initiate_corporate_action_record_date() { assert_eq!(date, rd.date); match rd.checkpoint { - CACheckpoint::Scheduled(id) => assert_eq!(schedule_id, id), - CACheckpoint::Existing(_) => panic!(), + CACheckpoint::Scheduled(id, 0) => assert_eq!(schedule_id, id), + _ => panic!(), } Timestamp::set_timestamp(date); transfer(&ticker, owner, foo); assert_eq!( - Checkpoint::schedule_points((ticker, schedule_id)), + Checkpoint::schedule_points(ticker, schedule_id), vec![cp_id] ); - assert_eq!(date, Checkpoint::timestamps(cp_id)); + assert_eq!(date, Checkpoint::timestamps(ticker, cp_id)); } }; @@ -885,6 +886,9 @@ fn change_record_date_works() { assert_ok!(change(id, date)); assert_eq!(expect, get_ca(id).unwrap().record_date); }; + let assert_refs = + |sh_id, count| assert_eq!(Checkpoint::schedule_ref_count(ticker, sh_id), count); + let assert_fresh = |sh_id| assert_eq!(Checkpoint::schedule_id_sequence(ticker), sh_id); // Change for a CA that doesn't exist, and ensure failure. let id = next_ca_id(ticker); @@ -898,7 +902,7 @@ fn change_record_date_works() { Some(RecordDate { date, checkpoint }) }; let rd_ts = |date, id| { - let checkpoint = CACheckpoint::Scheduled(id); + let checkpoint = CACheckpoint::Scheduled(id, 0); Some(RecordDate { date, checkpoint }) }; @@ -913,39 +917,63 @@ fn change_record_date_works() { // Trigger `NoSuchSchedule`. assert_noop!(change(id, spec_sh(ScheduleId(42))), CPError::NoSuchSchedule); - // Successfully use a schedule which exists. - let sh_id = next_schedule_id(ticker); - change_ok(id, spec_ts(1000), rd_ts(1000, sh_id)); - assert_eq!(Checkpoint::schedule_id_sequence(ticker), sh_id); - assert!(!Checkpoint::schedule_removable((ticker, sh_id))); + // Successfully use a schedule which exists (the same one as before). let mk_schedule = |at, id| { let period = <_>::default(); let schedule = CheckpointSchedule { start: at, period }; - StoredSchedule { at, id, schedule } + StoredSchedule { + at, + id, + schedule, + remaining: 0, + } }; - assert_eq!( - Checkpoint::schedules(ticker), - vec![mk_schedule(1000, sh_id)] - ); - change_ok(id, spec_sh(sh_id), rd_ts(1000, sh_id)); + let mut all_schedules = vec![]; + let mut change_ok_scheduled = || { + let sh_id = next_schedule_id(ticker); + change_ok(id, spec_ts(1000), rd_ts(1000, sh_id)); + assert_fresh(sh_id); + assert_refs(sh_id, 1); + all_schedules.push(mk_schedule(1000, sh_id)); + assert_eq!(Checkpoint::schedules(ticker), all_schedules); + change_ok(id, spec_sh(sh_id), rd_ts(1000, sh_id)); + sh_id + }; + let sh_id1 = change_ok_scheduled(); + assert_eq!(Checkpoint::schedule_ref_count(ticker, sh_id1), 1); + + // Then use a distinct existing ID. + let sh_id2 = change_ok_scheduled(); + assert_refs(sh_id1, 0); + assert_refs(sh_id2, 1); - // Use a removable schedule. Should fail. - let sh_id2 = next_schedule_id(ticker); + // Use a removable schedule. Should increment strong ref count. + let sh_id3 = next_schedule_id(ticker); assert_ok!(Checkpoint::create_schedule( owner.origin(), ticker, 2000.into() )); - assert_eq!(Checkpoint::schedule_id_sequence(ticker), sh_id2); - assert!(Checkpoint::schedule_removable((ticker, sh_id2))); + assert_fresh(sh_id3); + assert_refs(sh_id3, 0); assert_eq!( Checkpoint::schedules(ticker), - vec![mk_schedule(1000, sh_id), mk_schedule(2000, sh_id2)] - ); - assert_noop!( - change(id, spec_sh(sh_id2)), - Error::ExistingScheduleRemovable + vec![ + mk_schedule(1000, sh_id1), + mk_schedule(1000, sh_id2), + mk_schedule(2000, sh_id3) + ] ); + change_ok(id, spec_sh(sh_id3), rd_ts(2000, sh_id3)); + assert_refs(sh_id3, 1); + + // While at it, let's create a bunch of CAs and use the last schedule. + for _ in 0..10 { + let id = next_ca_id(ticker); + ca(CAKind::IssuerNotice, Some(1000)); + change_ok(id, spec_sh(sh_id3), rd_ts(2000, sh_id3)); + } + assert_refs(sh_id3, 11); // No need to test `RecordDateSpec::Scheduled` branch beyond what we have here. // To do so would replicate tests in the checkpoint module. @@ -961,11 +989,7 @@ fn change_record_date_works() { assert_ok!(Ballot::attach_ballot(owner.origin(), id, time, meta, true)); let test_branch = |id, error: DispatchError| { let change_ok = |spec, expect| { - change_ok( - id, - dbg!(spec_ts(spec)), - dbg!(rd_ts(expect, dbg!(next_schedule_id(ticker)))), - ) + change_ok(id, spec_ts(spec), rd_ts(expect, next_schedule_id(ticker))) }; Timestamp::set_timestamp(3000); change_ok(4999, 4000); // floor(4999 / 1000) * 1000 == 4000 @@ -1000,6 +1024,56 @@ fn change_record_date_works() { }); } +#[test] +fn existing_schedule_ref_count() { + test(|ticker, [owner, ..]| { + set_schedule_complexity(); + + let sh_id = next_schedule_id(ticker); + let spec = Some(RecordDateSpec::ExistingSchedule(sh_id)); + let assert_refs = |count| assert_eq!(Checkpoint::schedule_ref_count(ticker, sh_id), count); + let remove_ca = |id| CA::remove_ca(owner.origin(), id); + let remove_sh = || Checkpoint::remove_schedule(owner.origin(), ticker, sh_id); + + // No schedule yet, but count is 0 by default. + assert_refs(0); + + // Schedule made, count still 0 as no CAs attached. + assert_ok!(Checkpoint::create_schedule( + owner.origin(), + ticker, + 1000.into() + )); + assert_refs(0); + + // Attach some CAs, bumping the count by that many. + let mut ids = (0..5) + .map(|_| { + let ca_id = next_ca_id(ticker); + assert_ok!(dated_ca(owner, ticker, CAKind::IssuerNotice, spec)); + ca_id + }) + .collect::>(); + assert_refs(5); + + // Remove all of them, except for one, with the count going back to 1. + let stashed_id = ids.pop().unwrap(); + for id in ids { + assert_ok!(remove_ca(id)); + } + assert_refs(1); + + // Trying to remove the checkpoint, but we're blocked from doing so. + assert_noop!(remove_sh(), CPError::ScheduleNotRemovable); + + // Remove the last one.. Ref count -> 0. + assert_ok!(remove_ca(stashed_id)); + + // Bow we're able to remove the schedule. + assert_ok!(remove_sh()); + }); +} + fn attach(owner: User, id: CAId, rcv: bool) -> DispatchResult { Ballot::attach_ballot(owner.origin(), id, T_RANGE, mk_meta(), rcv) } diff --git a/pallets/runtime/tests/src/ext_builder.rs b/pallets/runtime/tests/src/ext_builder.rs index 935f5e2730..bece15c3c7 100644 --- a/pallets/runtime/tests/src/ext_builder.rs +++ b/pallets/runtime/tests/src/ext_builder.rs @@ -87,8 +87,6 @@ pub struct ExtBuilder { network_fee_share: Perbill, /// Maximum number of transfer manager an asset can have. max_no_of_tm_allowed: u32, - /// Maximum number of legs a instruction can have. - max_no_of_legs: u32, /// The minimum duration for a checkpoint period, in seconds. min_checkpoint_duration: u64, adjust: Option>, @@ -100,7 +98,6 @@ thread_local! { pub static WEIGHT_TO_FEE: RefCell = RefCell::new(0); pub static NETWORK_FEE_SHARE: RefCell = RefCell::new(Perbill::from_percent(0)); pub static MAX_NO_OF_TM_ALLOWED: RefCell = RefCell::new(0); - pub static MAX_NO_OF_LEGS: RefCell = RefCell::new(0); // default value } impl ExtBuilder { @@ -181,12 +178,6 @@ impl ExtBuilder { self } - /// Set maximum no of legs an instruction can have. - pub fn set_max_legs_allowed(mut self, legs_count: u32) -> Self { - self.max_no_of_legs = legs_count; - self - } - pub fn set_protocol_base_fees(mut self, fees: MockProtocolBaseFees) -> Self { self.protocol_base_fees = fees; self @@ -215,7 +206,6 @@ impl ExtBuilder { WEIGHT_TO_FEE.with(|v| *v.borrow_mut() = self.weight_to_fee); NETWORK_FEE_SHARE.with(|v| *v.borrow_mut() = self.network_fee_share); MAX_NO_OF_TM_ALLOWED.with(|v| *v.borrow_mut() = self.max_no_of_tm_allowed); - MAX_NO_OF_LEGS.with(|v| *v.borrow_mut() = self.max_no_of_legs); } fn make_balances(&self) -> Vec<(Public, u128)> { diff --git a/pallets/runtime/tests/src/lib.rs b/pallets/runtime/tests/src/lib.rs index 180c2b55b5..1e189c712c 100644 --- a/pallets/runtime/tests/src/lib.rs +++ b/pallets/runtime/tests/src/lib.rs @@ -44,6 +44,8 @@ mod protocol_fee; #[cfg(test)] mod settlement_test; #[cfg(test)] +mod signed_extra; +#[cfg(test)] mod staking; #[cfg(test)] mod statistics_test; diff --git a/pallets/runtime/tests/src/pips_test.rs b/pallets/runtime/tests/src/pips_test.rs index d65010c23f..eef262cc2f 100644 --- a/pallets/runtime/tests/src/pips_test.rs +++ b/pallets/runtime/tests/src/pips_test.rs @@ -1,7 +1,9 @@ use super::{ assert_event_exists, committee_test::{gc_vmo, set_members}, - storage::{fast_forward_blocks, root, Call, EventTest, TestStorage, User}, + storage::{ + fast_forward_blocks, make_remark_proposal, root, Call, EventTest, TestStorage, User, + }, ExtBuilder, }; use frame_support::{ @@ -20,7 +22,7 @@ use pallet_pips::{ VotingResult, }; use pallet_treasury as treasury; -use polymesh_common_utilities::{pip::PipId, MaybeBlock}; +use polymesh_common_utilities::{pip::PipId, MaybeBlock, GC_DID}; use sp_core::sr25519::Public; use test_client::AccountKeyring; @@ -72,6 +74,13 @@ macro_rules! assert_no_pip { }}; } +fn spip(id: PipId, dir: bool, power: u128) -> SnapshottedPip { + SnapshottedPip { + id, + weight: (dir, power), + } +} + fn make_proposal(value: u64) -> Call { Call::Pips(pips::Call::set_min_proposal_deposit(value.into())) } @@ -110,11 +119,23 @@ fn standard_proposal( proposal(signer, proposer, make_proposal(42), deposit, None, None) } +fn remark_proposal(signer: &Origin, proposer: &Proposer, deposit: u128) -> DispatchResult { + proposal( + signer, + proposer, + make_remark_proposal(), + deposit, + None, + None, + ) +} + const THE_COMMITTEE: Proposer = Proposer::Committee(pallet_pips::Committee::Upgrade); fn committee_proposal(deposit: u128) -> DispatchResult { standard_proposal( - &pallet_committee::Origin::::Members(0, 0).into(), + &pallet_committee::Origin::::Endorsed(<_>::default()) + .into(), &THE_COMMITTEE, deposit, ) @@ -125,6 +146,11 @@ fn alice_proposal(deposit: u128) -> DispatchResult { standard_proposal(&Origin::signed(acc), &Proposer::Community(acc), deposit) } +fn alice_remark_proposal(deposit: u128) -> DispatchResult { + let acc = AccountKeyring::Alice.public(); + remark_proposal(&Origin::signed(acc), &Proposer::Community(acc), deposit) +} + fn consensus_call(call: pallet_pips::Call, signers: &[&Origin]) { let call = Box::new(Call::Pips(call)); for signer in signers.iter().copied().cloned() { @@ -168,9 +194,11 @@ fn updating_pips_variables_works() { assert_eq!(Pips::pending_pip_expiry(), MaybeBlock::None); assert_ok!(Pips::set_pending_pip_expiry(root(), MaybeBlock::Some(13))); - assert_last_event!( - Event::PendingPipExpiryChanged(_, MaybeBlock::None, MaybeBlock::Some(13)) - ); + assert_last_event!(Event::PendingPipExpiryChanged( + _, + MaybeBlock::None, + MaybeBlock::Some(13) + )); assert_eq!(Pips::pending_pip_expiry(), MaybeBlock::Some(13)); assert_eq!(Pips::max_pip_skip_count(), 1); @@ -426,7 +454,7 @@ fn proposal_details_are_correct() { let alice = User::new(AccountKeyring::Alice).balance(300); - let call = make_proposal(42); + let call = make_remark_proposal(); let proposal_url: Url = b"www.abc.com".into(); let proposal_desc: PipDescription = b"Test description".into(); @@ -1498,13 +1526,7 @@ fn snapshot_only_pending_hot_community() { assert_ok!(committee_proposal(0)); assert_ok!(Pips::snapshot(rc)); - assert_eq!( - Pips::snapshot_queue(), - vec![SnapshottedPip { - id: p, - weight: (true, 0) - }] - ); + assert_eq!(Pips::snapshot_queue(), vec![spip(p, true, 0)]); assert_ne!(Pips::snapshot_metadata(), None); }); } @@ -1539,32 +1561,15 @@ fn snapshot_works() { assert_eq!( Pips::snapshot_queue(), vec![ - SnapshottedPip { - id: 1, - weight: (false, 100) - }, - SnapshottedPip { - id: 5, - weight: (false, 50) - }, - SnapshottedPip { - id: 3, - weight: (true, 0) - }, - SnapshottedPip { - id: 2, - weight: (true, 0) - }, - SnapshottedPip { - id: 0, - weight: (true, 100) - }, - SnapshottedPip { - id: 4, - weight: (true, 150) - }, + spip(1, false, 100), + spip(5, false, 50), + spip(3, true, 0), + spip(2, true, 0), + spip(0, true, 100), + spip(4, true, 150), ] ); + let assert_snapshot = |id| { assert_eq!( Pips::snapshot_metadata(), @@ -1662,14 +1667,7 @@ fn enact_snapshot_results_works() { assert_ok!(Pips::set_prune_historical_pips(root(), false)); assert_ok!(Pips::set_min_proposal_deposit(root(), 0)); - let mk_queue = |ids: &[PipId]| { - ids.iter() - .map(|&id| SnapshottedPip { - id, - weight: (true, 0), - }) - .collect::>() - }; + let mk_queue = |ids: &[PipId]| ids.iter().map(|&id| spip(id, true, 0)).collect::>(); // Make 3 PIPs, snapshot, and enact results for all, emptying the queue. assert_ok!(alice_proposal(0)); @@ -1758,13 +1756,81 @@ fn propose_dupe_live_insert_panics() { assert_ok!(Pips::set_min_proposal_deposit(root(), 0)); // Manipulate storage to provoke panic in `insert_live_queue`. - let spip = SnapshottedPip { - id: 0, - weight: (true, 0), - }; - >::mutate(|queue| *queue = vec![spip]); + >::mutate(|queue| *queue = vec![spip(0, true, 0)]); // Triggers a panic, assertion never reached. assert_ok!(alice_proposal(0)); }); } + +#[test] +fn execute_scheduled_pip() { + ExtBuilder::default().build().execute_with(|| { + System::set_block_number(1); + assert_ok!(Pips::set_min_proposal_deposit(root(), 0)); + assert_ok!(Pips::set_prune_historical_pips(root(), true)); + let pip_id = Pips::pip_id_sequence(); + assert_ok!(alice_remark_proposal(0)); + let user = User::new(AccountKeyring::Alice); + set_members(vec![user.did]); + assert_ok!(Pips::snapshot(user.origin())); + assert_ok!(Pips::enact_snapshot_results( + gc_vmo(), + vec![(pip_id, SnapshotResult::Approve)], + )); + assert_state(pip_id, false, ProposalState::Scheduled); + assert_ok!(Pips::execute_scheduled_pip(root(), pip_id)); + assert_pruned(pip_id); + }); +} + +#[test] +fn expire_scheduled_pip() { + ExtBuilder::default().build().execute_with(|| { + System::set_block_number(1); + assert_ok!(Pips::set_min_proposal_deposit(root(), 0)); + assert_ok!(Pips::set_prune_historical_pips(root(), true)); + let pip_id = Pips::pip_id_sequence(); + assert_ok!(alice_remark_proposal(0)); + assert_state(pip_id, false, ProposalState::Pending); + assert_ok!(Pips::expire_scheduled_pip(root(), GC_DID, pip_id)); + assert_pruned(pip_id); + }); +} + +#[test] +fn live_queue_off_by_one_insertion_regression_test() { + ExtBuilder::default().monied(true).build().execute_with(|| { + System::set_block_number(1); + assert_ok!(Pips::set_min_proposal_deposit(root(), 0)); + + assert_ok!(alice_proposal(2)); + assert_ok!(alice_proposal(4)); + assert_eq!(Pips::live_queue(), vec![spip(0, true, 2), spip(1, true, 4)]); + + let user = User::new(AccountKeyring::Bob); + assert_ok!(Pips::vote(user.origin(), 0, true, 1)); + assert_eq!(Pips::live_queue(), vec![spip(0, true, 3), spip(1, true, 4)]); + }); +} + +#[test] +fn live_queue_off_by_one_insertion_regression_test2() { + ExtBuilder::default().monied(true).build().execute_with(|| { + System::set_block_number(1); + assert_ok!(Pips::set_min_proposal_deposit(root(), 0)); + assert_ok!(Pips::set_active_pip_limit(root(), 0)); + + let user = User::new(AccountKeyring::Bob); + + assert_ok!(alice_proposal(0)); // 0 + assert_ok!(alice_proposal(0)); // 1 + assert_ok!(alice_proposal(50)); // 2 + assert_ok!(Pips::vote(user.origin(), 0, false, 100)); + assert_ok!(Pips::vote(user.origin(), 2, false, 100)); + assert_eq!( + Pips::live_queue(), + vec![spip(0, false, 100), spip(2, false, 50), spip(1, true, 0)] + ); + }); +} diff --git a/pallets/runtime/tests/src/portfolio.rs b/pallets/runtime/tests/src/portfolio.rs index f5cbb6521e..dfdf7e4e3a 100644 --- a/pallets/runtime/tests/src/portfolio.rs +++ b/pallets/runtime/tests/src/portfolio.rs @@ -5,10 +5,10 @@ use super::{ use frame_support::{assert_err, assert_noop, assert_ok}; use pallet_asset::SecurityToken; use pallet_portfolio::MovePortfolioItem; -use polymesh_common_utilities::{asset::AssetType, portfolio::PortfolioSubTrait}; +use polymesh_common_utilities::portfolio::PortfolioSubTrait; use polymesh_primitives::{ - AuthorizationData, AuthorizationError, IdentityId, PortfolioId, PortfolioName, PortfolioNumber, - Signatory, Ticker, + asset::AssetType, AuthorizationData, AuthorizationError, IdentityId, PortfolioId, + PortfolioName, PortfolioNumber, Signatory, Ticker, }; use std::convert::TryFrom; use test_client::AccountKeyring; diff --git a/pallets/runtime/tests/src/settlement_test.rs b/pallets/runtime/tests/src/settlement_test.rs index eac1d28b20..e4cc708d9d 100644 --- a/pallets/runtime/tests/src/settlement_test.rs +++ b/pallets/runtime/tests/src/settlement_test.rs @@ -7,7 +7,9 @@ use super::{ ExtBuilder, }; use codec::Encode; -use frame_support::{assert_noop, assert_ok, traits::OnInitialize, StorageMap}; +use frame_support::{ + assert_noop, assert_ok, traits::OnInitialize, IterableStorageDoubleMap, StorageMap, +}; use pallet_asset as asset; use pallet_balances as balances; use pallet_compliance_manager as compliance_manager; @@ -18,10 +20,10 @@ use pallet_settlement::{ self as settlement, AffirmationStatus, Instruction, InstructionStatus, Leg, LegStatus, Receipt, ReceiptDetails, ReceiptMetadata, SettlementType, VenueDetails, VenueType, }; -use polymesh_common_utilities::{asset::AssetType, constants::ERC1400_TRANSFER_SUCCESS}; +use polymesh_common_utilities::constants::ERC1400_TRANSFER_SUCCESS; use polymesh_primitives::{ - AuthorizationData, Claim, Condition, ConditionType, IdentityId, PortfolioId, PortfolioName, - Signatory, Ticker, + asset::AssetType, AuthorizationData, Claim, Condition, ConditionType, IdentityId, PortfolioId, + PortfolioName, Signatory, Ticker, }; use rand::{prelude::*, thread_rng}; use sp_core::sr25519::Public; @@ -59,6 +61,29 @@ macro_rules! assert_instruction_execution { }; } +macro_rules! assert_affirm_instruction { + ($signer:expr, $instruction_counter:expr, $did:expr, $count:expr) => { + assert_ok!(Settlement::affirm_instruction( + $signer, + $instruction_counter, + default_portfolio_vec($did), + $count + )); + }; +} + +macro_rules! assert_affirm_instruction_with_one_leg { + ($signer:expr, $instruction_counter:expr, $did:expr) => { + assert_affirm_instruction!($signer, $instruction_counter, $did, 1); + }; +} + +macro_rules! assert_affirm_instruction_with_zero_leg { + ($signer:expr, $instruction_counter:expr, $did:expr) => { + assert_affirm_instruction!($signer, $instruction_counter, $did, 0); + }; +} + fn init(token_name: &[u8], ticker: Ticker, keyring: Public) -> u64 { create_token(token_name, ticker, keyring); let venue_counter = Settlement::venue_counter(); @@ -102,71 +127,67 @@ pub fn set_current_block_number(block: u64) { #[test] fn venue_registration() { - ExtBuilder::default() - .set_max_legs_allowed(500) - .build() - .execute_with(|| { - let alice_signed = Origin::signed(AccountKeyring::Alice.public()); - let alice_did = register_keyring_account(AccountKeyring::Alice).unwrap(); - let venue_counter = Settlement::venue_counter(); - assert_ok!(Settlement::create_venue( - alice_signed.clone(), - VenueDetails::default(), - vec![AccountKeyring::Alice.public(), AccountKeyring::Bob.public()], - VenueType::Exchange - )); - let venue_info = Settlement::venue_info(venue_counter).unwrap(); - assert_eq!(Settlement::venue_counter(), venue_counter + 1); - assert_eq!(Settlement::user_venues(alice_did), [venue_counter]); - assert_eq!(venue_info.creator, alice_did); - assert_eq!(venue_info.instructions.len(), 0); - assert_eq!(venue_info.details, VenueDetails::default()); - assert_eq!(venue_info.venue_type, VenueType::Exchange); - assert_eq!( - Settlement::venue_signers(venue_counter, AccountKeyring::Alice.public()), - true - ); - assert_eq!( - Settlement::venue_signers(venue_counter, AccountKeyring::Bob.public()), - true - ); - assert_eq!( - Settlement::venue_signers(venue_counter, AccountKeyring::Charlie.public()), - false - ); - - // Creating a second venue - assert_ok!(Settlement::create_venue( - alice_signed.clone(), - VenueDetails::default(), - vec![AccountKeyring::Alice.public(), AccountKeyring::Bob.public()], - VenueType::Exchange - )); - assert_eq!( - Settlement::user_venues(alice_did), - [venue_counter, venue_counter + 1] - ); - - // Editing venue details - assert_ok!(Settlement::update_venue( - alice_signed, - venue_counter, - Some([0x01].into()), - None - )); - let venue_info = Settlement::venue_info(venue_counter).unwrap(); - assert_eq!(venue_info.creator, alice_did); - assert_eq!(venue_info.instructions.len(), 0); - assert_eq!(venue_info.details, [0x01].into()); - assert_eq!(venue_info.venue_type, VenueType::Exchange); - }); + ExtBuilder::default().build().execute_with(|| { + let alice_signed = Origin::signed(AccountKeyring::Alice.public()); + let alice_did = register_keyring_account(AccountKeyring::Alice).unwrap(); + let venue_counter = Settlement::venue_counter(); + assert_ok!(Settlement::create_venue( + alice_signed.clone(), + VenueDetails::default(), + vec![AccountKeyring::Alice.public(), AccountKeyring::Bob.public()], + VenueType::Exchange + )); + let venue_info = Settlement::venue_info(venue_counter).unwrap(); + assert_eq!(Settlement::venue_counter(), venue_counter + 1); + assert_eq!(Settlement::user_venues(alice_did), [venue_counter]); + assert_eq!(venue_info.creator, alice_did); + assert_eq!(venue_info.instructions.len(), 0); + assert_eq!(venue_info.details, VenueDetails::default()); + assert_eq!(venue_info.venue_type, VenueType::Exchange); + assert_eq!( + Settlement::venue_signers(venue_counter, AccountKeyring::Alice.public()), + true + ); + assert_eq!( + Settlement::venue_signers(venue_counter, AccountKeyring::Bob.public()), + true + ); + assert_eq!( + Settlement::venue_signers(venue_counter, AccountKeyring::Charlie.public()), + false + ); + + // Creating a second venue + assert_ok!(Settlement::create_venue( + alice_signed.clone(), + VenueDetails::default(), + vec![AccountKeyring::Alice.public(), AccountKeyring::Bob.public()], + VenueType::Exchange + )); + assert_eq!( + Settlement::user_venues(alice_did), + [venue_counter, venue_counter + 1] + ); + + // Editing venue details + assert_ok!(Settlement::update_venue( + alice_signed, + venue_counter, + Some([0x01].into()), + None + )); + let venue_info = Settlement::venue_info(venue_counter).unwrap(); + assert_eq!(venue_info.creator, alice_did); + assert_eq!(venue_info.instructions.len(), 0); + assert_eq!(venue_info.details, [0x01].into()); + assert_eq!(venue_info.venue_type, VenueType::Exchange); + }); } #[test] fn basic_settlement() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -200,21 +221,22 @@ fn basic_settlement() { )); assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); - assert_ok!(Settlement::affirm_instruction( + + assert_affirm_instruction_with_one_leg!( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did) - )); + alice_did + ); assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); set_current_block_number(5); // Instruction get scheduled to next block. - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction_with_zero_leg!( bob_signed.clone(), instruction_counter, - default_portfolio_vec(bob_did) - )); + bob_did + ); // Advances the block no. to execute the instruction. let new_balance = alice_init_balance - amount; @@ -234,7 +256,6 @@ fn basic_settlement() { fn create_and_affirm_instruction() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -273,7 +294,7 @@ fn create_and_affirm_instruction() { // If affirmation fails, the instruction should be rolled back. // i.e. this tx should be a no-op. assert_noop!( - add_and_affirm_tx(user_portfolio_vec(alice_did, 1.into())), + add_and_affirm_tx(user_portfolio_vec(alice_did, 1u64.into())), Error::UnexpectedAffirmationStatus ); @@ -297,11 +318,12 @@ fn create_and_affirm_instruction() { AffirmationStatus::Pending ); set_current_block_number(5); - assert_ok!(Settlement::affirm_instruction( + + assert_affirm_instruction_with_zero_leg!( bob_signed.clone(), instruction_counter, - default_portfolio_vec(bob_did) - )); + bob_did + ); // Advances the block no. assert_instruction_execution!( @@ -319,55 +341,52 @@ fn create_and_affirm_instruction() { #[test] fn overdraft_failure() { - ExtBuilder::default() - .set_max_legs_allowed(500) - .build() - .execute_with(|| { - let alice_signed = Origin::signed(AccountKeyring::Alice.public()); - let alice_did = register_keyring_account(AccountKeyring::Alice).unwrap(); - let _bob_signed = Origin::signed(AccountKeyring::Bob.public()); - let bob_did = register_keyring_account(AccountKeyring::Bob).unwrap(); - let token_name = b"ACME"; - let ticker = Ticker::try_from(&token_name[..]).unwrap(); - let venue_counter = init(token_name, ticker, AccountKeyring::Alice.public()); - let instruction_counter = Settlement::instruction_counter(); - let alice_init_balance = Asset::balance_of(&ticker, alice_did); - let bob_init_balance = Asset::balance_of(&ticker, bob_did); - let amount = 100_000_000u128; - assert_ok!(Settlement::add_instruction( + ExtBuilder::default().build().execute_with(|| { + let alice_signed = Origin::signed(AccountKeyring::Alice.public()); + let alice_did = register_keyring_account(AccountKeyring::Alice).unwrap(); + let _bob_signed = Origin::signed(AccountKeyring::Bob.public()); + let bob_did = register_keyring_account(AccountKeyring::Bob).unwrap(); + let token_name = b"ACME"; + let ticker = Ticker::try_from(&token_name[..]).unwrap(); + let venue_counter = init(token_name, ticker, AccountKeyring::Alice.public()); + let instruction_counter = Settlement::instruction_counter(); + let alice_init_balance = Asset::balance_of(&ticker, alice_did); + let bob_init_balance = Asset::balance_of(&ticker, bob_did); + let amount = 100_000_000u128; + assert_ok!(Settlement::add_instruction( + alice_signed.clone(), + venue_counter, + SettlementType::SettleOnAffirmation, + None, + None, + vec![Leg { + from: PortfolioId::default_portfolio(alice_did), + to: PortfolioId::default_portfolio(bob_did), + asset: ticker, + amount: amount + }] + )); + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + assert_noop!( + Settlement::affirm_instruction( alice_signed.clone(), - venue_counter, - SettlementType::SettleOnAffirmation, - None, - None, - vec![Leg { - from: PortfolioId::default_portfolio(alice_did), - to: PortfolioId::default_portfolio(bob_did), - asset: ticker, - amount: amount - }] - )); - assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); - assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); - assert_noop!( - Settlement::affirm_instruction( - alice_signed.clone(), - instruction_counter, - default_portfolio_vec(alice_did) - ), - Error::FailedToLockTokens - ); + instruction_counter, + default_portfolio_vec(alice_did), + 1 + ), + Error::FailedToLockTokens + ); - assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); - assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); - }); + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + }); } #[test] fn token_swap() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -469,11 +488,11 @@ fn token_swap() { provide_scope_claim_to_multiple_parties(&[alice_did, bob_did], ticker, eve); provide_scope_claim_to_multiple_parties(&[alice_did, bob_did], ticker2, eve); - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction_with_one_leg!( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did) - )); + alice_did + ); assert_eq!( Settlement::instruction_affirms_pending(instruction_counter), @@ -528,7 +547,8 @@ fn token_swap() { assert_ok!(Settlement::withdraw_affirmation( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did) + default_portfolio_vec(alice_did), + 1 )); assert_eq!( @@ -575,12 +595,11 @@ fn token_swap() { Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), 0 ); - - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction_with_one_leg!( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did) - )); + alice_did + ); assert_eq!( Settlement::instruction_affirms_pending(instruction_counter), @@ -632,11 +651,12 @@ fn token_swap() { assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); set_current_block_number(500); - assert_ok!(Settlement::affirm_instruction( + + assert_affirm_instruction_with_one_leg!( bob_signed.clone(), instruction_counter, - default_portfolio_vec(bob_did) - )); + bob_did + ); assert_instruction_execution!( assert_eq, @@ -680,7 +700,6 @@ fn token_swap() { fn claiming_receipt() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -789,8 +808,9 @@ fn claiming_receipt() { asset: ticker, amount: amount, }; + let signature = OffChainSignature::from(AccountKeyring::Alice.sign(&msg.encode())); - assert_noop!( + let claim_receipt = |signature, metadata| { Settlement::claim_receipt( alice_signed.clone(), instruction_counter, @@ -798,20 +818,23 @@ fn claiming_receipt() { receipt_uid: 0, leg_id: 0, signer: AccountKeyring::Alice.public(), - signature: OffChainSignature::from( - AccountKeyring::Alice.sign(&msg.encode()) - ), - metadata: ReceiptMetadata::default() - } - ), + signature, + metadata, + }, + ) + }; + + assert_noop!( + claim_receipt(signature.clone(), ReceiptMetadata::default()), Error::LegNotPending ); set_current_block_number(4); - assert_ok!(Settlement::affirm_instruction( + + assert_affirm_instruction_with_one_leg!( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did) - )); + alice_did + ); assert_eq!( Settlement::instruction_affirms_pending(instruction_counter), @@ -870,37 +893,32 @@ fn claiming_receipt() { asset: ticker, amount: amount, }; + let signature2 = OffChainSignature::from(AccountKeyring::Alice.sign(&msg2.encode())); assert_noop!( - Settlement::claim_receipt( - alice_signed.clone(), - instruction_counter, - ReceiptDetails { - receipt_uid: 0, - leg_id: 0, - signer: AccountKeyring::Alice.public(), - signature: OffChainSignature::from( - AccountKeyring::Alice.sign(&msg2.encode()) - ), - metadata: ReceiptMetadata::default() - } - ), + claim_receipt(signature2, ReceiptMetadata::default()), Error::InvalidSignature ); let metadata = ReceiptMetadata::from(vec![42u8]); + + // Can not claim invalidated receipt + let change_receipt_validity = |validity| { + assert_ok!(Settlement::change_receipt_validity( + alice_signed.clone(), + 0, + validity + )); + }; + change_receipt_validity(false); + assert_noop!( + claim_receipt(signature.clone(), metadata.clone()), + Error::ReceiptAlreadyClaimed + ); + change_receipt_validity(true); + // Claiming, unclaiming and claiming receipt - assert_ok!(Settlement::claim_receipt( - alice_signed.clone(), - instruction_counter, - ReceiptDetails { - receipt_uid: 0, - leg_id: 0, - signer: AccountKeyring::Alice.public(), - signature: OffChainSignature::from(AccountKeyring::Alice.sign(&msg.encode())), - metadata: metadata.clone() - } - )); + assert_ok!(claim_receipt(signature, metadata.clone())); assert_eq!( Settlement::receipts_used(AccountKeyring::Alice.public(), 0), @@ -1079,11 +1097,12 @@ fn claiming_receipt() { assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); set_current_block_number(10); - assert_ok!(Settlement::affirm_instruction( + + assert_affirm_instruction_with_one_leg!( bob_signed.clone(), instruction_counter, - default_portfolio_vec(bob_did) - )); + bob_did + ); // Advances block. assert_instruction_execution!( @@ -1122,7 +1141,6 @@ fn claiming_receipt() { fn settle_on_block() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -1226,11 +1244,11 @@ fn settle_on_block() { provide_scope_claim_to_multiple_parties(&[alice_did, bob_did], ticker, eve); provide_scope_claim_to_multiple_parties(&[alice_did, bob_did], ticker2, eve); - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction_with_one_leg!( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did) - )); + alice_did + ); assert_eq!( Settlement::instruction_affirms_pending(instruction_counter), @@ -1282,11 +1300,12 @@ fn settle_on_block() { assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction_with_one_leg!( bob_signed.clone(), instruction_counter, - default_portfolio_vec(bob_did) - )); + bob_did + ); + assert_eq!( Settlement::instruction_affirms_pending(instruction_counter), 0 @@ -1383,8 +1402,256 @@ fn settle_on_block() { #[test] fn failed_execution() { + ExtBuilder::default().build().execute_with(|| { + let alice_signed = Origin::signed(AccountKeyring::Alice.public()); + let alice_did = register_keyring_account(AccountKeyring::Alice).unwrap(); + let bob_signed = Origin::signed(AccountKeyring::Bob.public()); + let bob_did = register_keyring_account(AccountKeyring::Bob).unwrap(); + let token_name = b"ACME"; + let ticker = Ticker::try_from(&token_name[..]).unwrap(); + let token_name2 = b"ACME2"; + let ticker2 = Ticker::try_from(&token_name2[..]).unwrap(); + let venue_counter = init(token_name, ticker, AccountKeyring::Alice.public()); + init(token_name2, ticker2, AccountKeyring::Bob.public()); + assert_ok!(ComplianceManager::reset_asset_compliance( + Origin::signed(AccountKeyring::Bob.public()), + ticker2, + )); + let block_number = System::block_number() + 1; + + let instruction_counter = Settlement::instruction_counter(); + let alice_init_balance = Asset::balance_of(&ticker, alice_did); + let bob_init_balance = Asset::balance_of(&ticker, bob_did); + let alice_init_balance2 = Asset::balance_of(&ticker2, alice_did); + let bob_init_balance2 = Asset::balance_of(&ticker2, bob_did); + + let amount = 100u128; + let legs = vec![ + Leg { + from: PortfolioId::default_portfolio(alice_did), + to: PortfolioId::default_portfolio(bob_did), + asset: ticker, + amount: amount, + }, + Leg { + from: PortfolioId::default_portfolio(bob_did), + to: PortfolioId::default_portfolio(alice_did), + asset: ticker2, + amount: amount, + }, + ]; + + assert_eq!(0, scheduler::Agenda::::get(block_number).len()); + assert_ok!(Settlement::add_instruction( + alice_signed.clone(), + venue_counter, + SettlementType::SettleOnBlock(block_number), + None, + None, + legs.clone() + )); + assert_eq!(1, scheduler::Agenda::::get(block_number).len()); + + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(alice_did), + instruction_counter + ), + AffirmationStatus::Pending + ); + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(bob_did), + instruction_counter + ), + AffirmationStatus::Pending + ); + + for i in 0..legs.len() { + assert_eq!( + Settlement::instruction_legs( + instruction_counter, + u64::try_from(i).unwrap_or_default() + ), + legs[i] + ); + } + + let instruction_details = Instruction { + instruction_id: instruction_counter, + venue_id: venue_counter, + status: InstructionStatus::Pending, + settlement_type: SettlementType::SettleOnBlock(block_number), + created_at: Some(Timestamp::get()), + trade_date: None, + value_date: None, + }; + assert_eq!( + Settlement::instruction_details(instruction_counter), + instruction_details + ); + assert_eq!( + Settlement::instruction_affirms_pending(instruction_counter), + 2 + ); + assert_eq!( + Settlement::venue_info(venue_counter).unwrap().instructions, + vec![instruction_counter] + ); + + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); + assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); + + assert_affirm_instruction_with_one_leg!( + alice_signed.clone(), + instruction_counter, + alice_did + ); + + assert_eq!( + Settlement::instruction_affirms_pending(instruction_counter), + 1 + ); + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(alice_did), + instruction_counter + ), + AffirmationStatus::Affirmed + ); + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(bob_did), + instruction_counter + ), + AffirmationStatus::Pending + ); + assert_eq!( + Settlement::affirms_received( + instruction_counter, + PortfolioId::default_portfolio(alice_did) + ), + AffirmationStatus::Affirmed + ); + assert_eq!( + Settlement::affirms_received( + instruction_counter, + PortfolioId::default_portfolio(bob_did) + ), + AffirmationStatus::Unknown + ); + assert_eq!( + Settlement::instruction_leg_status(instruction_counter, 0), + LegStatus::ExecutionPending + ); + assert_eq!( + Settlement::instruction_leg_status(instruction_counter, 1), + LegStatus::PendingTokenLock + ); + assert_eq!( + Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), + amount + ); + + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); + assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); + + assert_affirm_instruction_with_one_leg!(bob_signed.clone(), instruction_counter, bob_did); + + assert_eq!( + Settlement::instruction_affirms_pending(instruction_counter), + 0 + ); + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(alice_did), + instruction_counter + ), + AffirmationStatus::Affirmed + ); + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(bob_did), + instruction_counter + ), + AffirmationStatus::Affirmed + ); + assert_eq!( + Settlement::affirms_received( + instruction_counter, + PortfolioId::default_portfolio(alice_did) + ), + AffirmationStatus::Affirmed + ); + assert_eq!( + Settlement::affirms_received( + instruction_counter, + PortfolioId::default_portfolio(bob_did) + ), + AffirmationStatus::Affirmed + ); + assert_eq!( + Settlement::instruction_leg_status(instruction_counter, 0), + LegStatus::ExecutionPending + ); + assert_eq!( + Settlement::instruction_leg_status(instruction_counter, 1), + LegStatus::ExecutionPending + ); + assert_eq!( + Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), + amount + ); + assert_eq!( + Portfolio::locked_assets(PortfolioId::default_portfolio(bob_did), &ticker2), + amount + ); + + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); + assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); + + next_block(); + + // Instruction should've settled + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(alice_did), + instruction_counter + ), + AffirmationStatus::Unknown + ); + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(bob_did), + instruction_counter + ), + AffirmationStatus::Unknown + ); + assert_eq!( + Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), + 0 + ); + assert_eq!( + Portfolio::locked_assets(PortfolioId::default_portfolio(bob_did), &ticker2), + 0 + ); + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); + assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); + }); +} + +#[test] +fn venue_filtering() { ExtBuilder::default() - .set_max_legs_allowed(500) + .cdd_providers(vec![AccountKeyring::Eve.public()]) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -1393,275 +1660,20 @@ fn failed_execution() { let bob_did = register_keyring_account(AccountKeyring::Bob).unwrap(); let token_name = b"ACME"; let ticker = Ticker::try_from(&token_name[..]).unwrap(); - let token_name2 = b"ACME2"; - let ticker2 = Ticker::try_from(&token_name2[..]).unwrap(); let venue_counter = init(token_name, ticker, AccountKeyring::Alice.public()); - init(token_name2, ticker2, AccountKeyring::Bob.public()); - assert_ok!(ComplianceManager::reset_asset_compliance( - Origin::signed(AccountKeyring::Bob.public()), - ticker2, - )); let block_number = System::block_number() + 1; - let instruction_counter = Settlement::instruction_counter(); - let alice_init_balance = Asset::balance_of(&ticker, alice_did); - let bob_init_balance = Asset::balance_of(&ticker, bob_did); - let alice_init_balance2 = Asset::balance_of(&ticker2, alice_did); - let bob_init_balance2 = Asset::balance_of(&ticker2, bob_did); + let eve = AccountKeyring::Eve.public(); - let amount = 100u128; - let legs = vec![ - Leg { - from: PortfolioId::default_portfolio(alice_did), - to: PortfolioId::default_portfolio(bob_did), - asset: ticker, - amount: amount, - }, - Leg { - from: PortfolioId::default_portfolio(bob_did), - to: PortfolioId::default_portfolio(alice_did), - asset: ticker2, - amount: amount, - }, - ]; + // provide scope claim. + provide_scope_claim_to_multiple_parties(&[alice_did, bob_did], ticker, eve); - assert_eq!(0, scheduler::Agenda::::get(block_number).len()); - assert_ok!(Settlement::add_instruction( - alice_signed.clone(), - venue_counter, - SettlementType::SettleOnBlock(block_number), - None, - None, - legs.clone() - )); - assert_eq!(1, scheduler::Agenda::::get(block_number).len()); - - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(alice_did), - instruction_counter - ), - AffirmationStatus::Pending - ); - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(bob_did), - instruction_counter - ), - AffirmationStatus::Pending - ); - - for i in 0..legs.len() { - assert_eq!( - Settlement::instruction_legs( - instruction_counter, - u64::try_from(i).unwrap_or_default() - ), - legs[i] - ); - } - - let instruction_details = Instruction { - instruction_id: instruction_counter, - venue_id: venue_counter, - status: InstructionStatus::Pending, - settlement_type: SettlementType::SettleOnBlock(block_number), - created_at: Some(Timestamp::get()), - trade_date: None, - value_date: None, - }; - assert_eq!( - Settlement::instruction_details(instruction_counter), - instruction_details - ); - assert_eq!( - Settlement::instruction_affirms_pending(instruction_counter), - 2 - ); - assert_eq!( - Settlement::venue_info(venue_counter).unwrap().instructions, - vec![instruction_counter] - ); - - assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); - assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); - assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); - assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); - - assert_ok!(Settlement::affirm_instruction( - alice_signed.clone(), - instruction_counter, - default_portfolio_vec(alice_did) - )); - - assert_eq!( - Settlement::instruction_affirms_pending(instruction_counter), - 1 - ); - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(alice_did), - instruction_counter - ), - AffirmationStatus::Affirmed - ); - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(bob_did), - instruction_counter - ), - AffirmationStatus::Pending - ); - assert_eq!( - Settlement::affirms_received( - instruction_counter, - PortfolioId::default_portfolio(alice_did) - ), - AffirmationStatus::Affirmed - ); - assert_eq!( - Settlement::affirms_received( - instruction_counter, - PortfolioId::default_portfolio(bob_did) - ), - AffirmationStatus::Unknown - ); - assert_eq!( - Settlement::instruction_leg_status(instruction_counter, 0), - LegStatus::ExecutionPending - ); - assert_eq!( - Settlement::instruction_leg_status(instruction_counter, 1), - LegStatus::PendingTokenLock - ); - assert_eq!( - Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), - amount - ); - - assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); - assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); - assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); - assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); - - assert_ok!(Settlement::affirm_instruction( - bob_signed.clone(), - instruction_counter, - default_portfolio_vec(bob_did) - )); - assert_eq!( - Settlement::instruction_affirms_pending(instruction_counter), - 0 - ); - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(alice_did), - instruction_counter - ), - AffirmationStatus::Affirmed - ); - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(bob_did), - instruction_counter - ), - AffirmationStatus::Affirmed - ); - assert_eq!( - Settlement::affirms_received( - instruction_counter, - PortfolioId::default_portfolio(alice_did) - ), - AffirmationStatus::Affirmed - ); - assert_eq!( - Settlement::affirms_received( - instruction_counter, - PortfolioId::default_portfolio(bob_did) - ), - AffirmationStatus::Affirmed - ); - assert_eq!( - Settlement::instruction_leg_status(instruction_counter, 0), - LegStatus::ExecutionPending - ); - assert_eq!( - Settlement::instruction_leg_status(instruction_counter, 1), - LegStatus::ExecutionPending - ); - assert_eq!( - Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), - amount - ); - assert_eq!( - Portfolio::locked_assets(PortfolioId::default_portfolio(bob_did), &ticker2), - amount - ); - - assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); - assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); - assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); - assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); - - next_block(); - - // Instruction should've settled - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(alice_did), - instruction_counter - ), - AffirmationStatus::Unknown - ); - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(bob_did), - instruction_counter - ), - AffirmationStatus::Unknown - ); - assert_eq!( - Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), - 0 - ); - assert_eq!( - Portfolio::locked_assets(PortfolioId::default_portfolio(bob_did), &ticker2), - 0 - ); - assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); - assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); - assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); - assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); - }); -} - -#[test] -fn venue_filtering() { - ExtBuilder::default() - .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) - .build() - .execute_with(|| { - let alice_signed = Origin::signed(AccountKeyring::Alice.public()); - let alice_did = register_keyring_account(AccountKeyring::Alice).unwrap(); - let bob_signed = Origin::signed(AccountKeyring::Bob.public()); - let bob_did = register_keyring_account(AccountKeyring::Bob).unwrap(); - let token_name = b"ACME"; - let ticker = Ticker::try_from(&token_name[..]).unwrap(); - let venue_counter = init(token_name, ticker, AccountKeyring::Alice.public()); - let block_number = System::block_number() + 1; - let instruction_counter = Settlement::instruction_counter(); - let eve = AccountKeyring::Eve.public(); - - // provide scope claim. - provide_scope_claim_to_multiple_parties(&[alice_did, bob_did], ticker, eve); - - let legs = vec![Leg { - from: PortfolioId::default_portfolio(alice_did), - to: PortfolioId::default_portfolio(bob_did), - asset: ticker, - amount: 10, - }]; + let legs = vec![Leg { + from: PortfolioId::default_portfolio(alice_did), + to: PortfolioId::default_portfolio(bob_did), + asset: ticker, + amount: 10, + }]; assert_ok!(Settlement::add_instruction( alice_signed.clone(), venue_counter, @@ -1700,21 +1712,23 @@ fn venue_filtering() { legs.clone(), default_portfolio_vec(alice_did) )); - assert_ok!(Settlement::affirm_instruction( + + assert_affirm_instruction_with_one_leg!( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did) - )); - assert_ok!(Settlement::affirm_instruction( + alice_did + ); + assert_affirm_instruction_with_zero_leg!( bob_signed.clone(), instruction_counter, - default_portfolio_vec(bob_did) - )); - assert_ok!(Settlement::affirm_instruction( + bob_did + ); + assert_affirm_instruction_with_zero_leg!( bob_signed.clone(), instruction_counter + 1, - default_portfolio_vec(bob_did) - )); + bob_did + ); + next_block(); assert_eq!(Asset::balance_of(&ticker, bob_did), 10); assert_ok!(Settlement::disallow_venues( @@ -1732,7 +1746,6 @@ fn venue_filtering() { fn basic_fuzzing() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -1794,6 +1807,7 @@ fn basic_fuzzing() { let mut legs = Vec::with_capacity(100); let mut receipts = Vec::with_capacity(100); let mut receipt_legs = HashMap::with_capacity(100); + let mut legs_count: HashMap = HashMap::with_capacity(100); for i in 0..10 { for j in 0..4 { let mut final_i = 100_000; @@ -1832,6 +1846,12 @@ fn basic_fuzzing() { asset: tickers[i * 4 + j], amount: 1, }); + let count = if legs_count.contains_key(&dids[j]) { + *legs_count.get(&dids[j]).unwrap() + 1 + } else { + 1 + }; + legs_count.insert(dids[j], count); if legs.len() >= 100 { break; } @@ -1846,7 +1866,6 @@ fn basic_fuzzing() { break; } } - assert_ok!(Settlement::add_instruction( alice_signed.clone(), venue_counter, @@ -1858,25 +1877,24 @@ fn basic_fuzzing() { // Authorize instructions and do a few authorize/deny in between for (i, signer) in signers.clone().iter().enumerate() { + let leg_count = *legs_count.get(&dids[i]).unwrap_or(&0); for _ in 0..2 { if random() { - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction!( signer.clone(), instruction_counter, - default_portfolio_vec(dids[i]) - )); + dids[i], + leg_count + ); assert_ok!(Settlement::withdraw_affirmation( signer.clone(), instruction_counter, - default_portfolio_vec(dids[i]) + default_portfolio_vec(dids[i]), + leg_count )); } } - assert_ok!(Settlement::affirm_instruction( - signer.clone(), - instruction_counter, - default_portfolio_vec(dids[i]) - )); + assert_affirm_instruction!(signer.clone(), instruction_counter, dids[i], leg_count); } // Claim receipts and do a few claim/unclaims in between @@ -1931,7 +1949,8 @@ fn basic_fuzzing() { assert_ok!(Settlement::withdraw_affirmation( signers[i].clone(), instruction_counter, - default_portfolio_vec(dids[i]) + default_portfolio_vec(dids[i]), + *legs_count.get(&dids[i]).unwrap_or(&0) )); } @@ -1974,109 +1993,78 @@ fn basic_fuzzing() { #[test] fn claim_multiple_receipts_during_authorization() { - ExtBuilder::default() - .set_max_legs_allowed(500) - .build() - .execute_with(|| { - let alice_signed = Origin::signed(AccountKeyring::Alice.public()); - let alice_did = register_keyring_account(AccountKeyring::Alice).unwrap(); - let bob_signed = Origin::signed(AccountKeyring::Bob.public()); - let bob_did = register_keyring_account(AccountKeyring::Bob).unwrap(); - let token_name = b"ACME"; - let ticker = Ticker::try_from(&token_name[..]).unwrap(); - let token_name2 = b"ACME2"; - let ticker2 = Ticker::try_from(&token_name2[..]).unwrap(); - let venue_counter = init(token_name, ticker, AccountKeyring::Alice.public()); - init(token_name2, ticker2, AccountKeyring::Bob.public()); - - let instruction_counter = Settlement::instruction_counter(); - let alice_init_balance = Asset::balance_of(&ticker, alice_did); - let bob_init_balance = Asset::balance_of(&ticker, bob_did); - let alice_init_balance2 = Asset::balance_of(&ticker2, alice_did); - let bob_init_balance2 = Asset::balance_of(&ticker2, bob_did); - - let amount = 100u128; - let legs = vec![ - Leg { - from: PortfolioId::default_portfolio(alice_did), - to: PortfolioId::default_portfolio(bob_did), - asset: ticker, - amount: amount, - }, - Leg { - from: PortfolioId::default_portfolio(alice_did), - to: PortfolioId::default_portfolio(bob_did), - asset: ticker2, - amount: amount, - }, - ]; - - assert_ok!(Settlement::add_instruction( - alice_signed.clone(), - venue_counter, - SettlementType::SettleOnAffirmation, - None, - None, - legs.clone() - )); - - assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); - assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); - assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); - assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); - - let msg1 = Receipt { - receipt_uid: 0, + ExtBuilder::default().build().execute_with(|| { + let alice_signed = Origin::signed(AccountKeyring::Alice.public()); + let alice_did = register_keyring_account(AccountKeyring::Alice).unwrap(); + let bob_signed = Origin::signed(AccountKeyring::Bob.public()); + let bob_did = register_keyring_account(AccountKeyring::Bob).unwrap(); + let token_name = b"ACME"; + let ticker = Ticker::try_from(&token_name[..]).unwrap(); + let token_name2 = b"ACME2"; + let ticker2 = Ticker::try_from(&token_name2[..]).unwrap(); + let venue_counter = init(token_name, ticker, AccountKeyring::Alice.public()); + init(token_name2, ticker2, AccountKeyring::Bob.public()); + + let instruction_counter = Settlement::instruction_counter(); + let alice_init_balance = Asset::balance_of(&ticker, alice_did); + let bob_init_balance = Asset::balance_of(&ticker, bob_did); + let alice_init_balance2 = Asset::balance_of(&ticker2, alice_did); + let bob_init_balance2 = Asset::balance_of(&ticker2, bob_did); + + let amount = 100u128; + let legs = vec![ + Leg { from: PortfolioId::default_portfolio(alice_did), to: PortfolioId::default_portfolio(bob_did), asset: ticker, amount: amount, - }; - let msg2 = Receipt { - receipt_uid: 0, + }, + Leg { from: PortfolioId::default_portfolio(alice_did), to: PortfolioId::default_portfolio(bob_did), asset: ticker2, amount: amount, - }; - let msg3 = Receipt { - receipt_uid: 1, - from: PortfolioId::default_portfolio(alice_did), - to: PortfolioId::default_portfolio(bob_did), - asset: ticker2, - amount: amount, - }; + }, + ]; + + assert_ok!(Settlement::add_instruction( + alice_signed.clone(), + venue_counter, + SettlementType::SettleOnAffirmation, + None, + None, + legs.clone() + )); + + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); + assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); - assert_noop!( - Settlement::affirm_with_receipts( - alice_signed.clone(), - instruction_counter, - vec![ - ReceiptDetails { - receipt_uid: 0, - leg_id: 0, - signer: AccountKeyring::Alice.public(), - signature: OffChainSignature::from( - AccountKeyring::Alice.sign(&msg1.encode()) - ), - metadata: ReceiptMetadata::default() - }, - ReceiptDetails { - receipt_uid: 0, - leg_id: 0, - signer: AccountKeyring::Alice.public(), - signature: OffChainSignature::from( - AccountKeyring::Alice.sign(&msg2.encode()) - ), - metadata: ReceiptMetadata::default() - }, - ], - default_portfolio_vec(alice_did) - ), - Error::ReceiptAlreadyClaimed - ); + let msg1 = Receipt { + receipt_uid: 0, + from: PortfolioId::default_portfolio(alice_did), + to: PortfolioId::default_portfolio(bob_did), + asset: ticker, + amount: amount, + }; + let msg2 = Receipt { + receipt_uid: 0, + from: PortfolioId::default_portfolio(alice_did), + to: PortfolioId::default_portfolio(bob_did), + asset: ticker2, + amount: amount, + }; + let msg3 = Receipt { + receipt_uid: 1, + from: PortfolioId::default_portfolio(alice_did), + to: PortfolioId::default_portfolio(bob_did), + asset: ticker2, + amount: amount, + }; - assert_ok!(Settlement::affirm_with_receipts( + assert_noop!( + Settlement::affirm_with_receipts( alice_signed.clone(), instruction_counter, vec![ @@ -2090,107 +2078,129 @@ fn claim_multiple_receipts_during_authorization() { metadata: ReceiptMetadata::default() }, ReceiptDetails { - receipt_uid: 1, - leg_id: 1, + receipt_uid: 0, + leg_id: 0, signer: AccountKeyring::Alice.public(), signature: OffChainSignature::from( - AccountKeyring::Alice.sign(&msg3.encode()) + AccountKeyring::Alice.sign(&msg2.encode()) ), metadata: ReceiptMetadata::default() }, ], - default_portfolio_vec(alice_did) - )); - - assert_eq!( - Settlement::instruction_affirms_pending(instruction_counter), - 1 - ); - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(alice_did), - instruction_counter - ), - AffirmationStatus::Affirmed - ); - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(bob_did), - instruction_counter - ), - AffirmationStatus::Pending - ); - assert_eq!( - Settlement::affirms_received( - instruction_counter, - PortfolioId::default_portfolio(alice_did) - ), - AffirmationStatus::Affirmed - ); - assert_eq!( - Settlement::affirms_received( - instruction_counter, - PortfolioId::default_portfolio(bob_did) - ), - AffirmationStatus::Unknown - ); - assert_eq!( - Settlement::instruction_leg_status(instruction_counter, 0), - LegStatus::ExecutionToBeSkipped(AccountKeyring::Alice.public(), 0) - ); - assert_eq!( - Settlement::instruction_leg_status(instruction_counter, 1), - LegStatus::ExecutionToBeSkipped(AccountKeyring::Alice.public(), 1) - ); - assert_eq!( - Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), - 0 - ); - - assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); - assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); - assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); - assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); + default_portfolio_vec(alice_did), + 10 + ), + Error::ReceiptAlreadyClaimed + ); - set_current_block_number(1); - assert_ok!(Settlement::affirm_instruction( - bob_signed.clone(), + assert_ok!(Settlement::affirm_with_receipts( + alice_signed.clone(), + instruction_counter, + vec![ + ReceiptDetails { + receipt_uid: 0, + leg_id: 0, + signer: AccountKeyring::Alice.public(), + signature: OffChainSignature::from(AccountKeyring::Alice.sign(&msg1.encode())), + metadata: ReceiptMetadata::default() + }, + ReceiptDetails { + receipt_uid: 1, + leg_id: 1, + signer: AccountKeyring::Alice.public(), + signature: OffChainSignature::from(AccountKeyring::Alice.sign(&msg3.encode())), + metadata: ReceiptMetadata::default() + }, + ], + default_portfolio_vec(alice_did), + 10 + )); + + assert_eq!( + Settlement::instruction_affirms_pending(instruction_counter), + 1 + ); + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(alice_did), + instruction_counter + ), + AffirmationStatus::Affirmed + ); + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(bob_did), + instruction_counter + ), + AffirmationStatus::Pending + ); + assert_eq!( + Settlement::affirms_received( instruction_counter, - default_portfolio_vec(bob_did) - )); - - // Advances block - assert_instruction_execution!( - assert_eq, - Settlement::user_affirmations( - PortfolioId::default_portfolio(alice_did), - instruction_counter - ), - AffirmationStatus::Unknown - ); - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(bob_did), - instruction_counter - ), - AffirmationStatus::Unknown - ); - assert_eq!( - Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), - 0 - ); - assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); - assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); - assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); - assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); - }); + PortfolioId::default_portfolio(alice_did) + ), + AffirmationStatus::Affirmed + ); + assert_eq!( + Settlement::affirms_received( + instruction_counter, + PortfolioId::default_portfolio(bob_did) + ), + AffirmationStatus::Unknown + ); + assert_eq!( + Settlement::instruction_leg_status(instruction_counter, 0), + LegStatus::ExecutionToBeSkipped(AccountKeyring::Alice.public(), 0) + ); + assert_eq!( + Settlement::instruction_leg_status(instruction_counter, 1), + LegStatus::ExecutionToBeSkipped(AccountKeyring::Alice.public(), 1) + ); + assert_eq!( + Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), + 0 + ); + + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); + assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); + + set_current_block_number(1); + + assert_affirm_instruction_with_zero_leg!(bob_signed.clone(), instruction_counter, bob_did); + + // Advances block + assert_instruction_execution!( + assert_eq, + Settlement::user_affirmations( + PortfolioId::default_portfolio(alice_did), + instruction_counter + ), + AffirmationStatus::Unknown + ); + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(bob_did), + instruction_counter + ), + AffirmationStatus::Unknown + ); + assert_eq!( + Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), + 0 + ); + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + assert_eq!(Asset::balance_of(&ticker2, alice_did), alice_init_balance2); + assert_eq!(Asset::balance_of(&ticker2, bob_did), bob_init_balance2); + }); } #[test] fn overload_settle_on_block() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -2239,16 +2249,17 @@ fn overload_settle_on_block() { } for i in &[0u64, 1, 3] { - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction!( alice_signed.clone(), instruction_counter + i, - default_portfolio_vec(alice_did) - )); - assert_ok!(Settlement::affirm_instruction( + alice_did, + 500 + ); + assert_affirm_instruction_with_zero_leg!( bob_signed.clone(), instruction_counter + i, - default_portfolio_vec(bob_did) - )); + bob_did + ); } assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); @@ -2325,7 +2336,8 @@ fn overload_settle_on_block() { Settlement::affirm_instruction( alice_signed.clone(), instruction_counter + 2, - default_portfolio_vec(alice_did) + default_portfolio_vec(alice_did), + 1 ), Error::InstructionSettleBlockPassed ); @@ -2383,7 +2395,6 @@ fn encode_receipt() { fn test_weights_for_settlement_transaction() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Dave.public()]) - .set_max_legs_allowed(5) // set maximum no. of legs allowed for an instruction. .set_max_tms_allowed(4) // set maximum no. of tms an asset can have. .build() .execute_with(|| { @@ -2481,18 +2492,18 @@ fn test_weights_for_settlement_transaction() { legs.clone() )); - let result_affirm_instruction_1 = Settlement::affirm_instruction( + assert_affirm_instruction_with_one_leg!( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did), + alice_did ); - assert_ok!(result_affirm_instruction_1); set_current_block_number(100); - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction_with_zero_leg!( bob_signed.clone(), instruction_counter, - default_portfolio_vec(bob_did), - )); + bob_did + ); + assert_ok!( Asset::_is_valid_transfer( &ticker, @@ -2509,7 +2520,6 @@ fn test_weights_for_settlement_transaction() { fn cross_portfolio_settlement() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -2565,11 +2575,11 @@ fn cross_portfolio_settlement() { ); set_current_block_number(10); // Approved by Alice - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction_with_one_leg!( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did) - )); + alice_did + ); assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); assert_eq!( @@ -2593,6 +2603,7 @@ fn cross_portfolio_settlement() { bob_signed.clone(), instruction_counter, default_portfolio_vec(bob_did), + 0 ), Error::UnexpectedAffirmationStatus ); @@ -2602,7 +2613,8 @@ fn cross_portfolio_settlement() { assert_ok!(Settlement::affirm_instruction( bob_signed.clone(), instruction_counter, - user_portfolio_vec(bob_did, num) + user_portfolio_vec(bob_did, num), + 0 )); // Instruction should've settled assert_instruction_execution!( @@ -2638,7 +2650,6 @@ fn cross_portfolio_settlement() { fn multiple_portfolio_settlement() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -2710,11 +2721,12 @@ fn multiple_portfolio_settlement() { ); // Alice approves the instruction from her default portfolio - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction_with_one_leg!( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did) - )); + alice_did + ); + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); assert_eq!( @@ -2739,7 +2751,8 @@ fn multiple_portfolio_settlement() { Settlement::affirm_instruction( alice_signed.clone(), instruction_counter, - user_portfolio_vec(alice_did, alice_num) + user_portfolio_vec(alice_did, alice_num), + 1 ), Error::FailedToLockTokens ); @@ -2756,7 +2769,8 @@ fn multiple_portfolio_settlement() { assert_ok!(Settlement::affirm_instruction( alice_signed.clone(), instruction_counter, - user_portfolio_vec(alice_did, alice_num) + user_portfolio_vec(alice_did, alice_num), + 1 )); assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); @@ -2798,7 +2812,8 @@ fn multiple_portfolio_settlement() { assert_ok!(Settlement::affirm_instruction( bob_signed.clone(), instruction_counter, - portfolios_vec + portfolios_vec, + 0 )); // Instruction should've settled @@ -2834,7 +2849,6 @@ fn multiple_portfolio_settlement() { fn multiple_custodian_settlement() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(500) .build() .execute_with(|| { let alice_signed = Origin::signed(AccountKeyring::Alice.public()); @@ -2937,7 +2951,8 @@ fn multiple_custodian_settlement() { assert_ok!(Settlement::affirm_instruction( alice_signed.clone(), instruction_counter, - portfolios_vec.clone() + portfolios_vec.clone(), + 2 )); assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); @@ -2985,18 +3000,19 @@ fn multiple_custodian_settlement() { Settlement::affirm_instruction( bob_signed.clone(), instruction_counter, - portfolios_bob + portfolios_bob, + 0 ), PortfolioError::UnauthorizedCustodian ); next_block(); // Bob can approve instruction from the portfolio he has custody of - assert_ok!(Settlement::affirm_instruction( + assert_affirm_instruction_with_zero_leg!( bob_signed.clone(), instruction_counter, - default_portfolio_vec(bob_did) - )); + bob_did + ); // Alice fails to deny the instruction from both her portfolios since she doesn't have the custody assert_instruction_execution!( @@ -3004,7 +3020,8 @@ fn multiple_custodian_settlement() { Settlement::withdraw_affirmation( alice_signed.clone(), instruction_counter, - portfolios_vec + portfolios_vec, + 2 ), PortfolioError::UnauthorizedCustodian ); @@ -3013,7 +3030,8 @@ fn multiple_custodian_settlement() { assert_ok!(Settlement::withdraw_affirmation( alice_signed.clone(), instruction_counter, - default_portfolio_vec(alice_did) + default_portfolio_vec(alice_did), + 1 )); assert_eq!( Portfolio::locked_assets(PortfolioId::default_portfolio(alice_did), &ticker), @@ -3029,7 +3047,8 @@ fn multiple_custodian_settlement() { assert_ok!(Settlement::affirm_instruction( alice_signed.clone(), instruction_counter, - portfolios_final + portfolios_final, + 1 )); // Instruction should've settled @@ -3063,103 +3082,187 @@ fn multiple_custodian_settlement() { #[test] fn reject_instruction() { + ExtBuilder::default().build().execute_with(|| { + let (alice_signed, alice_did) = make_account(AccountKeyring::Alice.public()).unwrap(); + let (bob_signed, bob_did) = make_account(AccountKeyring::Bob.public()).unwrap(); + let (charlie_signed, _) = make_account(AccountKeyring::Charlie.public()).unwrap(); + + let token_name = b"ACME"; + let ticker = Ticker::try_from(&token_name[..]).unwrap(); + let venue_counter = init(token_name, ticker, AccountKeyring::Alice.public()); + let amount = 100u128; + + let assert_user_affirmatons = |instruction_id, alice_status, bob_status| { + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(alice_did), + instruction_id + ), + alice_status + ); + assert_eq!( + Settlement::user_affirmations( + PortfolioId::default_portfolio(bob_did), + instruction_id + ), + bob_status + ); + }; + + let create_instruction = || { + let instruction_id = Settlement::instruction_counter(); + set_current_block_number(10); + assert_ok!(Settlement::add_and_affirm_instruction( + alice_signed.clone(), + venue_counter, + SettlementType::SettleOnAffirmation, + None, + None, + vec![Leg { + from: PortfolioId::default_portfolio(alice_did), + to: PortfolioId::default_portfolio(bob_did), + asset: ticker, + amount: amount + }], + default_portfolio_vec(alice_did) + )); + instruction_id + }; + + let instruction_counter = create_instruction(); + assert_user_affirmatons( + instruction_counter, + AffirmationStatus::Affirmed, + AffirmationStatus::Pending, + ); + assert_noop!( + Settlement::reject_instruction(bob_signed.clone(), instruction_counter, vec![], 0), + Error::NoPortfolioProvided + ); + + assert_noop!( + Settlement::reject_instruction( + charlie_signed.clone(), + instruction_counter, + default_portfolio_vec(bob_did), + 0 + ), + PortfolioError::UnauthorizedCustodian + ); + next_block(); + assert_ok!(Settlement::reject_instruction( + alice_signed.clone(), + instruction_counter, + default_portfolio_vec(alice_did), + 1 + )); + next_block(); + // Instruction should've been deleted + assert_user_affirmatons( + instruction_counter, + AffirmationStatus::Unknown, + AffirmationStatus::Unknown, + ); + + // Test that the receiver can also reject the instruction + let instruction_counter2 = create_instruction(); + + assert_ok!(Settlement::reject_instruction( + bob_signed.clone(), + instruction_counter2, + default_portfolio_vec(bob_did), + 0 + )); + next_block(); + // Instruction should've been deleted + assert_user_affirmatons( + instruction_counter2, + AffirmationStatus::Unknown, + AffirmationStatus::Unknown, + ); + }); +} + +#[test] +fn dirty_storage_with_tx() { ExtBuilder::default() - .set_max_legs_allowed(500) + .cdd_providers(vec![AccountKeyring::Eve.public()]) .build() .execute_with(|| { let (alice_signed, alice_did) = make_account(AccountKeyring::Alice.public()).unwrap(); let (bob_signed, bob_did) = make_account(AccountKeyring::Bob.public()).unwrap(); - let (charlie_signed, _) = make_account(AccountKeyring::Charlie.public()).unwrap(); - let token_name = b"ACME"; let ticker = Ticker::try_from(&token_name[..]).unwrap(); let venue_counter = init(token_name, ticker, AccountKeyring::Alice.public()); - let amount = 100u128; + let instruction_counter = Settlement::instruction_counter(); + let alice_init_balance = Asset::balance_of(&ticker, alice_did); + let bob_init_balance = Asset::balance_of(&ticker, bob_did); + let amount1 = 100u128; + let amount2 = 50u128; + let eve = AccountKeyring::Eve.public(); - let assert_user_affirmatons = |instruction_id, alice_status, bob_status| { - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(alice_did), - instruction_id - ), - alice_status - ); - assert_eq!( - Settlement::user_affirmations( - PortfolioId::default_portfolio(bob_did), - instruction_id - ), - bob_status - ); - }; + // Provide scope claim to sender and receiver of the transaction. + provide_scope_claim_to_multiple_parties(&[alice_did, bob_did], ticker, eve); - let create_instruction = || { - let instruction_id = Settlement::instruction_counter(); - set_current_block_number(10); - assert_ok!(Settlement::add_and_affirm_instruction( - alice_signed.clone(), - venue_counter, - SettlementType::SettleOnAffirmation, - None, - None, - vec![Leg { + assert_ok!(Settlement::add_instruction( + alice_signed.clone(), + venue_counter, + SettlementType::SettleOnAffirmation, + None, + None, + vec![ + Leg { from: PortfolioId::default_portfolio(alice_did), to: PortfolioId::default_portfolio(bob_did), asset: ticker, - amount: amount - }], - default_portfolio_vec(alice_did) - )); - instruction_id - }; + amount: amount1 + }, + Leg { + from: PortfolioId::default_portfolio(bob_did), + to: PortfolioId::default_portfolio(alice_did), + asset: ticker, + amount: 0 + }, + Leg { + from: PortfolioId::default_portfolio(alice_did), + to: PortfolioId::default_portfolio(bob_did), + asset: ticker, + amount: amount2 + } + ] + )); - let instruction_counter = create_instruction(); - assert_user_affirmatons( + assert_affirm_instruction!(alice_signed.clone(), instruction_counter, alice_did, 2); + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + set_current_block_number(5); + assert_affirm_instruction_with_one_leg!( + bob_signed.clone(), instruction_counter, - AffirmationStatus::Affirmed, - AffirmationStatus::Pending, - ); - assert_noop!( - Settlement::reject_instruction(bob_signed.clone(), instruction_counter, vec![]), - Error::NoPortfolioProvided + bob_did ); - assert_noop!( - Settlement::reject_instruction( - charlie_signed.clone(), - instruction_counter, - default_portfolio_vec(bob_did) - ), - PortfolioError::UnauthorizedCustodian + // Advances the block no. to execute the instruction. + let total_amount = amount1 + amount2; + assert_eq!( + Settlement::instruction_affirms_pending(instruction_counter), + 0 ); next_block(); - assert_ok!(Settlement::reject_instruction( - alice_signed.clone(), - instruction_counter, - default_portfolio_vec(alice_did) - )); - next_block(); - // Instruction should've been deleted - assert_user_affirmatons( - instruction_counter, - AffirmationStatus::Unknown, - AffirmationStatus::Unknown, + assert_eq!( + settlement::InstructionLegs::::iter_prefix(instruction_counter) + .count(), + 0 ); - // Test that the receiver can also reject the instruction - let instruction_counter2 = create_instruction(); - - assert_ok!(Settlement::reject_instruction( - bob_signed.clone(), - instruction_counter2, - default_portfolio_vec(bob_did) - )); - next_block(); - // Instruction should've been deleted - assert_user_affirmatons( - instruction_counter2, - AffirmationStatus::Unknown, - AffirmationStatus::Unknown, + // Ensure proper balance transfers + assert_eq!( + Asset::balance_of(&ticker, alice_did), + alice_init_balance - total_amount + ); + assert_eq!( + Asset::balance_of(&ticker, bob_did), + bob_init_balance + total_amount ); }); } diff --git a/pallets/runtime/tests/src/signed_extra.rs b/pallets/runtime/tests/src/signed_extra.rs new file mode 100644 index 0000000000..68b333c25a --- /dev/null +++ b/pallets/runtime/tests/src/signed_extra.rs @@ -0,0 +1,163 @@ +use pallet_group as group; +use pallet_identity as identity; +use polymesh_primitives::{AccountId, IdentityId, Index, InvestorUid}; +use polymesh_runtime_develop::{ + runtime::{Call, SignedExtra}, + Runtime, +}; + +use frame_support::{weights::DispatchClass, weights::DispatchInfo}; +use frame_system::{CheckEra, CheckGenesis, CheckNonce, CheckSpecVersion, CheckTxVersion}; +use sp_io::TestExternalities; +use sp_runtime::{generic, traits::SignedExtension}; +use sp_std::convert::From; + +use test_client::AccountKeyring; + +pub fn make_call() -> (::Call, usize) { + (Call::System(frame_system::Call::remark(vec![])), 10) +} + +/// Generate a `SignedExtra` value as it is defined in `Runtime`. +/// It ensures that `Runtime` is using: +/// - Transaction `priority` == `tip`. +/// - Only `Operational` transactions could have `tip` != 0. +/// - `Normal` transactions have `priority` == 0, as `tip` == 0. +fn make_signed_extra(current_block: u64, period: u64, nonce: Index, tip: u128) -> SignedExtra { + ( + CheckSpecVersion::::new(), + CheckTxVersion::::new(), + CheckGenesis::::new(), + CheckEra::::from(generic::Era::mortal(period, current_block)), + CheckNonce::::from(nonce), + polymesh_extensions::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(tip), + pallet_permissions::StoreCallMetadata::::new(), + ) +} + +/// Create the minimun storage for `Runtime` to validate transactions. +/// It is needed because almost any call requires an account with DID and a valid CDD claim. +/// In this genesis configuration, we define the following: +/// - `Alice`, `Bob`, and `Charlie` accounts are created with `1_000_000` balance. +/// - Those accounts have DIDs (starting from 0), and auto-generated CDD claims. +/// - Those accounts are added as CDD providers, so auto-generated CDD claims are valid. +fn make_min_storage() -> Result { + let accounts = [ + AccountKeyring::Alice.to_account_id(), + AccountKeyring::Bob.to_account_id(), + AccountKeyring::Charlie.to_account_id(), + ]; + let identities = accounts + .iter() + .enumerate() + .map(|(idx, acc)| { + let did = IdentityId::from(idx as u128); + let uid = InvestorUid::from(did.as_ref()); + + (acc.clone(), did, did, uid, None) + }) + .collect::>(); + let did = identities + .iter() + .map(|(_acc, did, ..)| did.clone()) + .collect::>(); + + let mut storage = frame_system::GenesisConfig::default().build_storage::()?; + + // Balances + pallet_balances::GenesisConfig:: { + balances: accounts + .iter() + .map(|acc| (acc.clone(), 1_000_000)) + .collect::>(), + } + .assimilate_storage(&mut storage)?; + + // Sudo + pallet_sudo::GenesisConfig:: { + key: accounts[0].clone(), + } + .assimilate_storage(&mut storage)?; + + // Identity + identity::GenesisConfig:: { + identities: identities, + ..Default::default() + } + .assimilate_storage(&mut storage)?; + + // CDD service + group::GenesisConfig:: { + active_members_limit: u32::MAX, + active_members: did, + ..Default::default() + } + .assimilate_storage(&mut storage)?; + + Ok(TestExternalities::new(storage)) +} + +#[test] +fn normal_tx_ext() -> Result<(), String> { + make_min_storage()?.execute_with(normal_tx) +} + +/// This test ensures the following rules are true for current `runtime::SignedExtra`: +/// - Normal transactions can not have a tip. +/// - Priority of any transaction is its own tip. +fn normal_tx() -> Result<(), String> { + let user = AccountKeyring::Alice.to_account_id(); + let (call, len) = make_call(); + let info = DispatchInfo { + weight: 100, + ..Default::default() + }; + + // Normat Tx with tip. Expected an error. + let sign_extra = make_signed_extra(0, 10, 0, 42u128.into()); + let tx_validity = sign_extra.validate(&user, &call, &info, len); + assert!(tx_validity.is_err()); + + // Normal TX without any tip. + let sign_extra = make_signed_extra(0, 10, 0, 0u128.into()); + let tx_validity = sign_extra + .validate(&user, &call, &info, len) + .expect("Tx should be valid"); + assert_eq!(tx_validity.priority, 0); + Ok(()) +} + +#[test] +fn operational_tx_ext() -> Result<(), String> { + make_min_storage()?.execute_with(operational_tx) +} + +/// This test double-checks the following statements: +/// - Operational transactions can have tip != 0. +/// - Priority of any transaction is its own tip. +fn operational_tx() -> Result<(), String> { + let user: AccountId = AccountKeyring::Alice.public().into(); + let (call, len) = make_call(); + let info = DispatchInfo { + weight: 100, + class: DispatchClass::Operational, + ..Default::default() + }; + + // Operational TX with tip. + let tip = 42u128; + let sign_extra = make_signed_extra(0, 10, 0, tip.into()); + let tx_validity = sign_extra + .validate(&user, &call, &info, len) + .expect("Tx should be valid"); + assert_eq!(tx_validity.priority as u128, tip); + + // Operational TX without any tip. + let sign_extra = make_signed_extra(0, 10, 0, 0u128.into()); + let tx_validity = sign_extra + .validate(&user, &call, &info, len) + .expect("Tx should be valid"); + assert_eq!(tx_validity.priority, 0); + Ok(()) +} diff --git a/pallets/runtime/tests/src/staking/mock.rs b/pallets/runtime/tests/src/staking/mock.rs index 235228442d..f1eba14a04 100644 --- a/pallets/runtime/tests/src/staking/mock.rs +++ b/pallets/runtime/tests/src/staking/mock.rs @@ -553,7 +553,6 @@ impl CheckCdd for Test { } impl PermissionChecker for Test { - type Call = Call; type Checker = Identity; } @@ -605,6 +604,7 @@ parameter_types! { pub const MaxValidatorPerIdentity: Permill = Permill::from_percent(33); pub const MaxVariableInflationTotalIssuance: Balance = 1_000_000_000 * POLY; pub const FixedYearlyReward: Balance = 200_000_000 * POLY; + pub const MinimumBond: Balance = 0u128; } thread_local! { @@ -666,7 +666,8 @@ impl Trait for Test { type MaxValidatorPerIdentity = MaxValidatorPerIdentity; type MaxVariableInflationTotalIssuance = MaxVariableInflationTotalIssuance; type FixedYearlyReward = FixedYearlyReward; - type WeightInfo = (); + type MinimumBond = MinimumBond; + type WeightInfo = polymesh_weights::pallet_staking::WeightInfo; } impl frame_system::offchain::SendTransactionTypes for Test diff --git a/pallets/runtime/tests/src/statistics_test.rs b/pallets/runtime/tests/src/statistics_test.rs index 8d1f1fe618..69aa161797 100644 --- a/pallets/runtime/tests/src/statistics_test.rs +++ b/pallets/runtime/tests/src/statistics_test.rs @@ -6,8 +6,7 @@ use frame_support::{assert_noop, assert_ok}; use pallet_asset::{self as asset, SecurityToken}; use pallet_compliance_manager as compliance_manager; use pallet_statistics::{self as statistics, TransferManager}; -use polymesh_common_utilities::asset::AssetType; -use polymesh_primitives::{IdentityId, PortfolioId, Ticker}; +use polymesh_primitives::{asset::AssetType, IdentityId, PortfolioId, Ticker}; use sp_arithmetic::Permill; use sp_core::sr25519::Public; use sp_std::convert::TryFrom; diff --git a/pallets/runtime/tests/src/sto_test.rs b/pallets/runtime/tests/src/sto_test.rs index 109298f892..23a0b7621d 100644 --- a/pallets/runtime/tests/src/sto_test.rs +++ b/pallets/runtime/tests/src/sto_test.rs @@ -1,15 +1,14 @@ use super::{ - storage::{register_keyring_account, TestStorage}, + storage::{make_account_with_portfolio, TestStorage}, ExtBuilder, }; use pallet_asset as asset; use pallet_compliance_manager as compliance_manager; use pallet_settlement::{self as settlement, VenueDetails, VenueType}; use pallet_sto::{ - self as sto, Fundraiser, FundraiserName, FundraiserStatus, FundraiserTier, PriceTier, + self as sto, Fundraiser, FundraiserName, FundraiserStatus, FundraiserTier, PriceTier, MAX_TIERS, }; -use polymesh_common_utilities::asset::AssetType; -use polymesh_primitives::{PortfolioId, Ticker}; +use polymesh_primitives::{asset::AssetType, IdentityId, PortfolioId, Ticker}; use crate::storage::provide_scope_claim_to_multiple_parties; use frame_support::{assert_noop, assert_ok}; @@ -30,7 +29,6 @@ type Timestamp = pallet_timestamp::Module; fn raise_happy_path_ext() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(2) .build() .execute_with(raise_happy_path); } @@ -38,11 +36,26 @@ fn raise_happy_path_ext() { fn raise_unhappy_path_ext() { ExtBuilder::default() .cdd_providers(vec![AccountKeyring::Eve.public()]) - .set_max_legs_allowed(2) .build() .execute_with(raise_unhappy_path); } +#[test] +fn zero_price_sto_ext() { + ExtBuilder::default() + .cdd_providers(vec![AccountKeyring::Eve.public()]) + .build() + .execute_with(zero_price_sto); +} + +#[test] +fn invalid_fundraiser_ext() { + ExtBuilder::default() + .cdd_providers(vec![AccountKeyring::Eve.public()]) + .build() + .execute_with(invalid_fundraiser); +} + fn create_asset(origin: Origin, ticker: Ticker, supply: u128) { assert_ok!(Asset::create_asset( origin, @@ -65,32 +78,70 @@ fn empty_compliance(origin: Origin, ticker: Ticker) { )); } -fn raise_happy_path() { - let alice_did = register_keyring_account(AccountKeyring::Alice).unwrap(); - let alice_signed = Origin::signed(AccountKeyring::Alice.public()); - let alice = AccountKeyring::Alice.public(); - let alice_portfolio = PortfolioId::default_portfolio(alice_did); - let bob_did = register_keyring_account(AccountKeyring::Bob).unwrap(); - let bob_signed = Origin::signed(AccountKeyring::Bob.public()); - let _bob = AccountKeyring::Bob.public(); - let bob_portfolio = PortfolioId::default_portfolio(bob_did); +struct RaiseContext { + alice_signed: O, + alice_did: IdentityId, + alice_portfolio: PortfolioId, + bob_signed: O, + bob_did: IdentityId, + bob_portfolio: PortfolioId, + offering_ticker: Ticker, + raise_ticker: Option, +} + +fn init_raise_context( + offering_supply: u128, + raise_supply_opt: Option, +) -> RaiseContext { + let (alice_signed, alice_did, alice_portfolio) = + make_account_with_portfolio(AccountKeyring::Alice.public()); + let (bob_signed, bob_did, bob_portfolio) = + make_account_with_portfolio(AccountKeyring::Bob.public()); + let eve = AccountKeyring::Eve.public(); // Register tokens let offering_ticker = Ticker::try_from(&[b'A'][..]).unwrap(); - let raise_ticker = Ticker::try_from(&[b'B'][..]).unwrap(); - create_asset(alice_signed.clone(), offering_ticker, 1_000_000); - create_asset(alice_signed.clone(), raise_ticker, 1_000_000); - - // Provide scope claim to both the parties of the transaction. - let eve = AccountKeyring::Eve.public(); + create_asset(alice_signed.clone(), offering_ticker, offering_supply); provide_scope_claim_to_multiple_parties(&[alice_did, bob_did], offering_ticker, eve); - provide_scope_claim_to_multiple_parties(&[alice_did, bob_did], raise_ticker, eve); + + let raise_ticker = raise_supply_opt.map(|raise_supply| { + let raise_ticker = Ticker::try_from(&[b'B'][..]).unwrap(); + create_asset(alice_signed.clone(), raise_ticker, raise_supply); + provide_scope_claim_to_multiple_parties(&[alice_did, bob_did], raise_ticker, eve); + raise_ticker + }); + + RaiseContext { + alice_signed, + alice_did, + alice_portfolio, + bob_signed, + bob_did, + bob_portfolio, + offering_ticker, + raise_ticker, + } +} + +fn raise_happy_path() { + const RAISE_SUPPLY: u128 = 1_000_000; + let RaiseContext { + alice_signed, + alice_did, + alice_portfolio, + bob_signed, + bob_did, + bob_portfolio, + offering_ticker, + raise_ticker, + } = init_raise_context(1_000_000, Some(RAISE_SUPPLY)); + let raise_ticker = raise_ticker.unwrap(); assert_ok!(Asset::unsafe_transfer( alice_portfolio, bob_portfolio, &raise_ticker, - 1_000_000 + RAISE_SUPPLY )); empty_compliance(alice_signed.clone(), offering_ticker); @@ -101,7 +152,7 @@ fn raise_happy_path() { assert_ok!(Settlement::create_venue( alice_signed.clone(), VenueDetails::default(), - vec![alice], + vec![AccountKeyring::Alice.public()], VenueType::Sto )); @@ -173,31 +224,35 @@ fn raise_happy_path() { STO::fundraiser_name(offering_ticker, fundraiser_id), fundraiser_name ); - // Investment fails if the minimum investment amount is not met - assert_noop!( + let sto_invest = |purchase_amount, max_price| { STO::invest( bob_signed.clone(), bob_portfolio, bob_portfolio, offering_ticker, fundraiser_id, - 1, - Some(2u128), - None - ), + purchase_amount, + max_price, + None, + ) + }; + // Investment fails if the minimum investment amount is not met + assert_noop!( + sto_invest(1, Some(1_000_000u128)), Error::InvestmentAmountTooLow ); + // Investment fails if the order is not filled + assert_noop!( + sto_invest(1_000_001u128, Some(1_000_000u128)), + Error::InsufficientTokensRemaining + ); + // Investment fails if the maximum price is breached + assert_noop!( + sto_invest(amount.into(), Some(999_999u128)), + Error::MaxPriceExceeded + ); // Bob invests in Alice's fundraiser - assert_ok!(STO::invest( - bob_signed.clone(), - bob_portfolio, - bob_portfolio, - offering_ticker, - fundraiser_id, - amount.into(), - Some(2u128), - None - )); + assert_ok!(sto_invest(amount.into(), Some(1_000_000u128))); check_fundraiser(1_000_000u128 - amount); assert_eq!( @@ -219,14 +274,10 @@ fn raise_happy_path() { } fn raise_unhappy_path() { - let alice_did = register_keyring_account(AccountKeyring::Alice).unwrap(); - let alice_signed = Origin::signed(AccountKeyring::Alice.public()); - let alice = AccountKeyring::Alice.public(); - let alice_portfolio = PortfolioId::default_portfolio(alice_did); - let bob_did = register_keyring_account(AccountKeyring::Bob).unwrap(); - let bob_signed = Origin::signed(AccountKeyring::Bob.public()); - let _bob = AccountKeyring::Bob.public(); - let bob_portfolio = PortfolioId::default_portfolio(bob_did); + let (alice_signed, alice_did, alice_portfolio) = + make_account_with_portfolio(AccountKeyring::Alice.public()); + let (bob_signed, bob_did, bob_portfolio) = + make_account_with_portfolio(AccountKeyring::Bob.public()); let offering_ticker = Ticker::try_from(&[b'C'][..]).unwrap(); let raise_ticker = Ticker::try_from(&[b'D'][..]).unwrap(); @@ -260,7 +311,7 @@ fn raise_unhappy_path() { assert_ok!(Settlement::create_venue( origin, VenueDetails::default(), - vec![alice], + vec![AccountKeyring::Alice.public()], type_ )); bad_venue @@ -350,3 +401,145 @@ fn raise_unhappy_path() { Error::InvalidOfferingWindow ); } + +fn zero_price_sto() { + let RaiseContext { + alice_signed, + alice_did, + alice_portfolio, + bob_signed, + bob_did, + bob_portfolio, + offering_ticker, + .. + } = init_raise_context(1_000_000, None); + let ticker = offering_ticker; + + empty_compliance(alice_signed.clone(), ticker); + + // Register a venue + let venue_counter = Settlement::venue_counter(); + assert_ok!(Settlement::create_venue( + alice_signed.clone(), + VenueDetails::default(), + vec![], + VenueType::Sto + )); + + let amount = 100u128; + let alice_init_balance = Asset::balance_of(&ticker, alice_did); + let bob_init_balance = Asset::balance_of(&ticker, bob_did); + + // Alice starts a fundraiser + let fundraiser_id = STO::fundraiser_count(ticker); + let fundraiser_name = FundraiserName::from(vec![1]); + assert_ok!(STO::create_fundraiser( + alice_signed.clone(), + alice_portfolio, + ticker, + alice_portfolio, + ticker, + vec![PriceTier { + total: 1_000_000u128, + price: 0u128 + }], + venue_counter, + None, + None, + 0, + fundraiser_name.clone() + )); + + assert_eq!(Asset::balance_of(&ticker, alice_did), alice_init_balance); + assert_eq!(Asset::balance_of(&ticker, bob_did), bob_init_balance); + + // Bob invests in Alice's zero price sto + assert_ok!(STO::invest( + bob_signed.clone(), + bob_portfolio, + bob_portfolio, + ticker, + fundraiser_id, + amount.into(), + Some(0), + None + )); + + assert_eq!( + Asset::balance_of(&ticker, alice_did), + alice_init_balance - amount + ); + assert_eq!( + Asset::balance_of(&ticker, bob_did), + bob_init_balance + amount + ); +} + +fn invalid_fundraiser() { + let RaiseContext { + alice_signed, + alice_portfolio, + offering_ticker, + raise_ticker, + .. + } = init_raise_context(1_000_000, Some(1_000_000)); + + let venue_counter = Settlement::venue_counter(); + assert_ok!(Settlement::create_venue( + alice_signed.clone(), + VenueDetails::default(), + vec![AccountKeyring::Alice.public()], + VenueType::Sto + )); + + let create_fundraiser_fn = |tiers| { + STO::create_fundraiser( + alice_signed.clone(), + alice_portfolio, + offering_ticker, + alice_portfolio, + raise_ticker.unwrap(), + tiers, + venue_counter, + None, + None, + 0, + FundraiserName::default(), + ) + }; + + // No tiers + let zero_tiers = vec![]; + assert_noop!(create_fundraiser_fn(zero_tiers), Error::InvalidPriceTiers); + + // Max tiers + let max_tiers_pass = (0..MAX_TIERS + 1) + .map(|_i| PriceTier::default()) + .collect::>(); + assert_noop!( + create_fundraiser_fn(max_tiers_pass), + Error::InvalidPriceTiers + ); + + // price_total = 0 + let total_0_tiers = (0..MAX_TIERS) + .map(|_i| PriceTier::default()) + .collect::>(); + assert_noop!( + create_fundraiser_fn(total_0_tiers), + Error::InvalidPriceTiers + ); + + // Total overflow + let total_overflow_tiers = vec![ + PriceTier { + total: u128::MAX, + price: 1, + }, + PriceTier { total: 1, price: 2 }, + ]; + assert_noop!( + create_fundraiser_fn(total_overflow_tiers), + Error::InvalidPriceTiers + ); +} diff --git a/pallets/runtime/tests/src/storage.rs b/pallets/runtime/tests/src/storage.rs index 7615f390eb..285d3df34e 100644 --- a/pallets/runtime/tests/src/storage.rs +++ b/pallets/runtime/tests/src/storage.rs @@ -1,6 +1,6 @@ use super::ext_builder::{ - EXTRINSIC_BASE_WEIGHT, MAX_NO_OF_LEGS, MAX_NO_OF_TM_ALLOWED, NETWORK_FEE_SHARE, - TRANSACTION_BYTE_FEE, WEIGHT_TO_FEE, + EXTRINSIC_BASE_WEIGHT, MAX_NO_OF_TM_ALLOWED, NETWORK_FEE_SHARE, TRANSACTION_BYTE_FEE, + WEIGHT_TO_FEE, }; use codec::Encode; use confidential_identity::{compute_cdd_id, compute_scope_id}; @@ -52,7 +52,6 @@ use smallvec::smallvec; use sp_core::{ crypto::{key_types, Pair as PairTrait}, sr25519::{Pair, Public}, - u32_trait::{_1, _2}, H256, }; use sp_runtime::{ @@ -331,13 +330,8 @@ impl multisig::Trait for TestStorage { type WeightInfo = polymesh_weights::pallet_multisig::WeightInfo; } -parameter_types! { - pub MaxLegsInInstruction: u32 = MAX_NO_OF_LEGS.with(|v| *v.borrow()); -} - impl settlement::Trait for TestStorage { type Event = Event; - type MaxLegsInInstruction = MaxLegsInInstruction; type Scheduler = Scheduler; type SchedulerCall = Call; type WeightInfo = polymesh_weights::pallet_settlement::WeightInfo; @@ -345,6 +339,7 @@ impl settlement::Trait for TestStorage { impl sto::Trait for TestStorage { type Event = Event; + type WeightInfo = polymesh_weights::pallet_sto::WeightInfo; } impl ChargeTxFee for TestStorage { @@ -437,27 +432,25 @@ impl group::Trait for TestStorage { pub type CommitteeOrigin = committee::RawOrigin<::AccountId, I>; -parameter_types! { - pub const MotionDuration: BlockNumber = 0u64; -} - /// Voting majority origin for `Instance`. -type VMO = committee::EnsureProportionAtLeast<_1, _2, AccountId, Instance>; +type VMO = committee::EnsureThresholdMet; impl committee::Trait for TestStorage { type Origin = Origin; type Proposal = Call; type CommitteeOrigin = VMO; + type VoteThresholdOrigin = Self::CommitteeOrigin; type Event = Event; - type MotionDuration = MotionDuration; + type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; } impl committee::Trait for TestStorage { type Origin = Origin; type Proposal = Call; type CommitteeOrigin = EnsureRoot; + type VoteThresholdOrigin = Self::CommitteeOrigin; type Event = Event; - type MotionDuration = MotionDuration; + type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; } impl IdentityTrait for TestStorage { @@ -562,8 +555,10 @@ impl asset::Trait for TestStorage { type UnixTime = Timestamp; type AssetNameMaxLength = AssetNameMaxLength; type FundingRoundNameMaxLength = FundingRoundNameMaxLength; + type AssetFn = Asset; type AllowedGasLimit = AllowedGasLimit; type WeightInfo = polymesh_weights::pallet_asset::WeightInfo; + type CPWeightInfo = polymesh_weights::pallet_checkpoint::WeightInfo; } parameter_types! { @@ -680,7 +675,6 @@ impl pallet_utility::Trait for TestStorage { } impl PermissionChecker for TestStorage { - type Call = Call; type Checker = Identity; } @@ -731,6 +725,18 @@ pub fn make_account( make_account_with_uid(id, uid) } +pub fn make_account_with_portfolio( + id: AccountId, +) -> ( + ::Origin, + IdentityId, + PortfolioId, +) { + let (origin, did) = make_account(id).unwrap(); + let portfolio = PortfolioId::default_portfolio(did); + (origin, did, portfolio) +} + pub fn make_account_with_scope( id: AccountId, ticker: Ticker, @@ -966,6 +972,10 @@ pub fn create_cdd_id_and_investor_uid(identity_id: IdentityId) -> (CddId, Invest (cdd_id, uid) } +pub fn make_remark_proposal() -> Call { + Call::System(frame_system::Call::remark(vec![b'X'; 100])).into() +} + #[macro_export] macro_rules! assert_last_event { ($event:pat) => { diff --git a/pallets/runtime/tests/src/transaction_payment_test.rs b/pallets/runtime/tests/src/transaction_payment_test.rs index 79bb5540c7..a429bc5f39 100644 --- a/pallets/runtime/tests/src/transaction_payment_test.rs +++ b/pallets/runtime/tests/src/transaction_payment_test.rs @@ -1,5 +1,7 @@ use super::ext_builder::ExtBuilder; use super::storage::{Call, MaximumBlockWeight, TestStorage}; +use polymesh_primitives::TransactionError; + use codec::Encode; use frame_support::{ traits::Currency, @@ -7,7 +9,12 @@ use frame_support::{ }; use pallet_balances::Call as BalancesCall; use pallet_transaction_payment::{ChargeTransactionPayment, Multiplier, RuntimeDispatchInfo}; -use sp_runtime::{testing::TestXt, traits::SignedExtension, FixedPointNumber}; +use sp_runtime::{ + testing::TestXt, + traits::SignedExtension, + transaction_validity::{InvalidTransaction, TransactionValidityError}, + FixedPointNumber, +}; use test_client::AccountKeyring; fn call() -> ::Call { @@ -27,6 +34,14 @@ pub fn info_from_weight(w: Weight) -> DispatchInfo { } } +fn operational_info_from_weight(w: Weight) -> DispatchInfo { + DispatchInfo { + weight: w, + class: DispatchClass::Operational, + ..Default::default() + } +} + fn post_info_from_weight(w: Weight) -> PostDispatchInfo { PostDispatchInfo { actual_weight: Some(w), @@ -460,3 +475,60 @@ fn refund_consistent_with_actual_weight() { assert_eq!(refund_based_fee, actual_fee); }); } + +#[test] +fn normal_tx_with_tip() { + ExtBuilder::default() + .monied(true) + .build() + .execute_with(normal_tx_with_tip_ext); +} + +fn normal_tx_with_tip_ext() { + let len = 10; + let tip = 42; + let user = AccountKeyring::Alice.public(); + let call = call(); + let normal_info = info_from_weight(100); + + // Invalid normal tx with tip. + let expected_err = TransactionValidityError::Invalid(InvalidTransaction::Custom( + TransactionError::ZeroTip as u8, + )); + let pre_err = ChargeTransactionPayment::::from(tip) + .pre_dispatch(&user, &call, &normal_info, len) + .map(|_| ()) + .unwrap_err(); + assert!(pre_err == expected_err); + + // Valid normal tx. + assert!(ChargeTransactionPayment::::from(0) + .pre_dispatch(&user, &call, &normal_info, len) + .is_ok()); +} + +#[test] +fn operational_tx_with_tip() { + ExtBuilder::default() + .monied(true) + .build() + .execute_with(operational_tx_with_tip_ext); +} + +fn operational_tx_with_tip_ext() { + let len = 10; + let tip = 42; + let user = AccountKeyring::Alice.public(); + let call = call(); + let operational_info = operational_info_from_weight(100); + + // Valid operational tx with tip. + assert!(ChargeTransactionPayment::::from(tip) + .pre_dispatch(&user, &call, &operational_info, len) + .is_ok()); + + // Valid operational tx. + assert!(ChargeTransactionPayment::::from(0) + .pre_dispatch(&user, &call, &operational_info, len) + .is_ok()); +} diff --git a/pallets/runtime/tests/src/utility_test.rs b/pallets/runtime/tests/src/utility_test.rs index 0ba06de66d..c8d37153c1 100644 --- a/pallets/runtime/tests/src/utility_test.rs +++ b/pallets/runtime/tests/src/utility_test.rs @@ -256,7 +256,9 @@ fn batch_secondary_with_permissions() { bob_origin.clone(), low_risk_name.clone() )); - assert_last_event!(EventTest::portfolio(pallet_portfolio::RawEvent::PortfolioCreated(_, _, _))); + assert_last_event!(EventTest::portfolio( + pallet_portfolio::RawEvent::PortfolioCreated(_, _, _) + )); check_name(low_risk_name.clone()); // Set and check Bob's permissions. @@ -300,7 +302,7 @@ fn batch_secondary_with_permissions() { let calls = vec![ Call::Portfolio(PortfolioCall::create_portfolio(high_risk_name.clone())), Call::Portfolio(PortfolioCall::rename_portfolio( - 1.into(), + 1u64.into(), high_risk_name.clone(), )), ]; diff --git a/pallets/settlement/Cargo.toml b/pallets/settlement/Cargo.toml index a4979fa973..73600d23c4 100644 --- a/pallets/settlement/Cargo.toml +++ b/pallets/settlement/Cargo.toml @@ -23,20 +23,20 @@ codec = { package = "parity-scale-codec", version = "1.1.0", default-features = hex-literal = "0.2.1" hex = { version = "0.4.2", optional = true } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-serializer = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-contracts = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-serializer = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Only in STD -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } [features] equalize = [] diff --git a/pallets/settlement/src/benchmarking.rs b/pallets/settlement/src/benchmarking.rs index 4b234f2b01..04aaf6a56f 100644 --- a/pallets/settlement/src/benchmarking.rs +++ b/pallets/settlement/src/benchmarking.rs @@ -13,30 +13,25 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] use crate::*; pub use frame_benchmarking::{account, benchmarks}; -use frame_support::weights::Weight; +use frame_support::{traits::Get, weights::Weight}; use frame_system::RawOrigin; -use pallet_asset::{ - benchmarking::make_base_asset, AggregateBalance, BalanceOf, BalanceOfAtScope, ScopeIdOf, - SecurityToken, Tokens, -}; +use pallet_asset::{BalanceOf, SecurityToken, Tokens}; use pallet_contracts::ContractAddressFor; use pallet_identity as identity; use pallet_portfolio::PortfolioAssetBalances; +use pallet_statistics::TransferManager; use polymesh_common_utilities::{ - benchs::{User, UserBuilder}, + benchs::{self, generate_ticker, user, User, UserBuilder}, constants::currency::POLY, - traits::asset::{AssetName, AssetType}, + traits::asset::AssetFnTrait, }; -//use polymesh_contracts::benchmarking::emulate_blueprint_in_storage; -use pallet_statistics::TransferManager; use polymesh_primitives::{ - CddId, Claim, Condition, ConditionType, CountryCode, IdentityId, InvestorUid, PortfolioId, - PortfolioName, PortfolioNumber, Scope, SmartExtension, SmartExtensionType, Ticker, - TrustedIssuer, + asset::{AssetName, AssetType}, + Claim, Condition, ConditionType, CountryCode, IdentityId, PortfolioId, PortfolioName, + PortfolioNumber, Scope, SmartExtension, SmartExtensionType, Ticker, TrustedIssuer, }; use sp_runtime::traits::Hash; use sp_runtime::SaturatedConversion; @@ -52,6 +47,7 @@ use sp_runtime::MultiSignature; const MAX_VENUE_DETAILS_LENGTH: u32 = 100000; const MAX_SIGNERS_ALLOWED: u32 = 50; const MAX_VENUE_ALLOWED: u32 = 100; +const MAX_LEGS_IN_INSTRUCTION: u32 = 25; type Portfolio = pallet_portfolio::Module; @@ -70,6 +66,11 @@ impl From> for UserData { } } +fn make_asset(owner: &User, name: Option>) -> Ticker { + benchs::make_asset::>(owner, name) + .expect("Asset cannot be created") +} + fn set_block_number(new_block_no: u64) { system::Module::::set_block_number(new_block_no.saturated_into::()); } @@ -90,7 +91,7 @@ fn create_venue_(did: IdentityId, signers: Vec) -> u64 { } /// Set instruction leg status to `LegStatus::ExecutionToBeSkipped` without any sanity checks. -fn set_instruction_let_status_to_skipped( +fn set_instruction_leg_status_to_skipped( instruction_id: u64, leg_id: u64, signer: T::AccountId, @@ -116,9 +117,9 @@ fn set_user_affirmations(instruction_id: u64, portfolio: PortfolioId, affirm: Af // create asset fn create_asset_(owner_did: IdentityId) -> Result { - let ticker = Ticker::try_from(vec![b'A'; 8 as usize].as_slice()).unwrap(); + let ticker = Ticker::try_from(generate_ticker(8u64).as_slice()).unwrap(); let name = AssetName::from(vec![b'N'; 8 as usize].as_slice()); - let total_supply: T::Balance = 90000.into(); + let total_supply: T::Balance = 90000u32.into(); let token = SecurityToken { name, total_supply, @@ -147,15 +148,15 @@ fn setup_leg_and_portfolio( receiver_portfolios: &mut Vec, ) { let variance = index + 1; - let ticker = Ticker::try_from(vec![b'A'; variance as usize].as_slice()).unwrap(); + let ticker = Ticker::try_from(generate_ticker(variance.into()).as_slice()).unwrap(); let portfolio_from = generate_portfolio::("", variance + 500, from_user); - let _ = fund_portfolio::(&portfolio_from, &ticker, 500.into()); + let _ = fund_portfolio::(&portfolio_from, &ticker, 500u32.into()); let portfolio_to = generate_portfolio::("to_did", variance + 800, to_user); legs.push(Leg { from: portfolio_from, to: portfolio_to, asset: ticker, - amount: 100.into(), + amount: 100u32.into(), }); receiver_portfolios.push(portfolio_to); sender_portfolios.push(portfolio_from); @@ -188,12 +189,12 @@ fn generate_portfolio( } fn populate_legs_for_instruction(index: u32, legs: &mut Vec>) { - let ticker = Ticker::try_from(vec![b'A'; index as usize].as_slice()).unwrap(); + let ticker = Ticker::try_from(generate_ticker(index.into()).as_slice()).unwrap(); legs.push(Leg { from: generate_portfolio::("from_did", index + 500, None), to: generate_portfolio::("to_did", index + 800, None), asset: ticker, - amount: 100.into(), + amount: 100u32.into(), }); } @@ -277,7 +278,7 @@ fn emulate_add_instruction( populate_legs_for_instruction::(i, &mut legs); } } - >::set(100000000.into()); + >::set(100000000u32.into()); Ok(( legs, venue_id, @@ -312,36 +313,6 @@ fn emulate_portfolios( }) } -fn setup_leg_and_portfolio_with_ticker( - to_user: Option>, - from_user: Option>, - from_ticker: Ticker, - to_ticker: Ticker, - index: u32, - legs: &mut Vec>, - sender_portfolios: &mut Vec, - receiver_portfolios: &mut Vec, -) { - emulate_portfolios::( - from_user.clone(), - to_user.clone(), - from_ticker, - index, - legs, - sender_portfolios, - receiver_portfolios, - ); - emulate_portfolios::( - to_user, - from_user, - to_ticker, - index, - legs, - receiver_portfolios, - sender_portfolios, - ); -} - // Generate signature. fn get_encoded_signature(signer: &User, msg: &Receipt) -> Vec { let raw_signature: [u8; 64] = signer.sign(&msg.encode()).expect("Data cannot be signed").0; @@ -349,24 +320,6 @@ fn get_encoded_signature(signer: &User, msg: &Receipt) encoded } -// Add investor uniqueness claim directly in the storage. -fn add_investor_uniqueness_claim(did: IdentityId, ticker: Ticker) { - identity::Module::::base_add_claim( - did, - Claim::InvestorUniqueness( - Scope::Ticker(ticker), - did, - CddId::new(did, InvestorUid::from(did.to_bytes())), - ), - did, - None, - ); - let current_balance = >::balance_of(ticker, did); - >::insert(ticker, &did, current_balance); - >::insert(did, did, current_balance); - ::insert(ticker, did, did); -} - fn add_trusted_issuer( origin: RawOrigin, ticker: Ticker, @@ -380,17 +333,35 @@ fn add_trusted_issuer( .expect("Default trusted claim issuer cannot be added"); } -pub fn get_conditions(complexity: u32, trusted_issuer: TrustedIssuer) -> Vec { - let mut conditions = Vec::with_capacity(complexity as usize); - for i in 0..complexity / 2 { - let scope = Scope::Custom(vec![1; i.try_into().unwrap()]); - conditions.push(Claim::Jurisdiction(CountryCode::AF, scope)); - } - let condition_type = ConditionType::IsNoneOf(conditions); - vec![Condition::new(condition_type, vec![trusted_issuer])] +pub fn setup_conditions( + count: u32, + trusted_issuer: TrustedIssuer, + dids: Vec, + ticker: Ticker, +) -> Vec { + let encoded_ticker = ticker.encode(); + (0..count) + .map(|i| { + let scope = + Scope::Custom((encoded_ticker.clone(), vec![1; i.try_into().unwrap()]).encode()); + let claim = Claim::Jurisdiction(CountryCode::AF, scope); + for did in &dids { + identity::Module::::base_add_claim( + did.clone(), + claim.clone(), + trusted_issuer.issuer, + None, + ); + } + Condition::new( + ConditionType::IsPresent(claim), + vec![trusted_issuer.clone()], + ) + }) + .collect() } -fn compliance_setup( +pub fn compliance_setup( max_complexity: u32, ticker: Ticker, origin: RawOrigin, @@ -399,17 +370,22 @@ fn compliance_setup( trusted_issuer: TrustedIssuer, ) { // Add investor uniqueness claim. - add_investor_uniqueness_claim::(from_did, ticker); - add_investor_uniqueness_claim::(to_did, ticker); + ::Asset::add_investor_uniqueness_claim(from_did, ticker); + ::Asset::add_investor_uniqueness_claim(to_did, ticker); // Add trusted issuer. add_trusted_issuer::(origin.clone(), ticker, trusted_issuer.clone()); - let cond = get_conditions::(max_complexity, trusted_issuer); + let conditions = setup_conditions::( + max_complexity / 2, + trusted_issuer, + vec![from_did, to_did], + ticker, + ); pallet_compliance_manager::Module::::add_compliance_requirement( origin.clone().into(), ticker, - cond.clone(), - cond, + conditions.clone(), + conditions, ) .expect("Failed to add the asset compliance"); } @@ -420,8 +396,7 @@ fn setup_affirm_instruction( Vec, UserData, UserData, - Ticker, - Ticker, + Vec, Vec>, ) { // create venue @@ -432,45 +407,21 @@ fn setup_affirm_instruction( let mut portfolios_from: Vec = Vec::with_capacity(l as usize); let mut portfolios_to: Vec = Vec::with_capacity(l as usize); let mut legs: Vec> = Vec::with_capacity(l as usize); - - // Create legs vector. - // Assuming the worst case where there is no dedup of `from` and `to` in the legs vector. - // Assumption here is that instruction will never be executed as still there is one auth pending. - let from_ticker = make_base_asset::( - &from, - true, - Some(Ticker::try_from(vec![b'A'; 8 as usize].as_slice()).unwrap()), - ); - let to_ticker = make_base_asset::( - &to, - true, - Some(Ticker::try_from(vec![b'B'; 8 as usize].as_slice()).unwrap()), - ); - let from_data = UserData::from(from); + let mut tickers = Vec::with_capacity(l as usize); + let from_data = UserData::from(from.clone()); let to_data = UserData::from(to); - if l == 1 { + + for n in 0..l { + tickers.push(make_asset::(&from, Some(generate_ticker(n as u64 + 1)))); emulate_portfolios::( Some(from_data.clone()), Some(to_data.clone()), - from_ticker, + tickers[n as usize], l, &mut legs, &mut portfolios_from, &mut portfolios_to, ); - } else { - for n in 0..l / 2 { - setup_leg_and_portfolio_with_ticker::( - Some(to_data.clone()), - Some(from_data.clone()), - from_ticker, - to_ticker, - n, - &mut legs, - &mut portfolios_from, - &mut portfolios_to, - ); - } } Module::::add_and_affirm_instruction( (RawOrigin::Signed(from_data.account.clone())).into(), @@ -482,14 +433,8 @@ fn setup_affirm_instruction( portfolios_from, ) .expect("Unable to add and affirm the instruction"); - ( - portfolios_to, - from_data, - to_data, - from_ticker, - to_ticker, - legs, - ) + + (portfolios_to, from_data, to_data, tickers, legs) } #[allow(dead_code)] @@ -504,11 +449,11 @@ fn add_smart_extension_to_ticker( ]; // Allow 100% as percentage ownership and allow primary issuance. >::instantiate( origin.clone().into(), - 0.into(), + 0u32.into(), Weight::max_value(), code_hash, data.clone(), - 0.into(), + 0u32.into(), ) .expect("Settlement: Failed to instantiate the contract"); let extension_id = @@ -558,24 +503,31 @@ fn create_receipt_details( } } -fn add_transfer_manager( +pub fn add_transfer_managers( ticker: Ticker, origin: RawOrigin, - tm_no: u32, exempted_entity: IdentityId, + count: u32, ) { - let tm = TransferManager::CountTransferManager(tm_no.into()); - // Add Transfer manager - >::add_transfer_manager(origin.clone().into(), ticker, tm.clone()) + for i in 0..count { + let tm = TransferManager::CountTransferManager(i.into()); + // Add Transfer manager + >::add_transfer_manager( + origin.clone().into(), + ticker, + tm.clone(), + ) .expect("failed to add transfer manager"); - // Exempt the user. - >::add_exempted_entities( - origin.into(), - ticker, - tm, - vec![exempted_entity], - ) - .expect("failed to add exempted entities"); + // Exempt the user. + >::add_exempted_entities( + origin.clone().into(), + ticker, + tm, + vec![exempted_entity], + ) + .expect("failed to add exempted entities"); + } + >::set_investor_count(&ticker, count.into()); } benchmarks! { @@ -621,55 +573,55 @@ benchmarks! { add_instruction { - let l in 1 .. T::MaxLegsInInstruction::get() as u32; // Variation for the MAX leg count. + let l in 1 .. MAX_LEGS_IN_INSTRUCTION; // Variation for the MAX leg count. // Define settlement type let settlement_type = SettlementType::SettleOnAffirmation; // Emulate the add instruction and get all the necessary arguments. let (legs, venue_id, origin, did , _, _, _ ) = emulate_add_instruction::(l, false)?; - }: _(origin, venue_id, settlement_type, Some(99999999.into()), Some(99999999.into()), legs) + }: _(origin, venue_id, settlement_type, Some(99999999u32.into()), Some(99999999u32.into()), legs) verify { verify_add_instruction::(venue_id, settlement_type)?; } add_instruction_with_settle_on_block_type { - let l in 1 .. T::MaxLegsInInstruction::get() as u32; // Variation for the MAX leg count. + let l in 1 .. MAX_LEGS_IN_INSTRUCTION; // Variation for the MAX leg count. // Define settlement type - let settlement_type = SettlementType::SettleOnBlock(100.into()); + let settlement_type = SettlementType::SettleOnBlock(100u32.into()); set_block_number::(50); // Emulate the add instruction and get all the necessary arguments. let (legs, venue_id, origin, did , _, _, _ ) = emulate_add_instruction::(l, false)?; - }: add_instruction(origin, venue_id, settlement_type, Some(99999999.into()), Some(99999999.into()), legs) + }: add_instruction(origin, venue_id, settlement_type, Some(99999999u32.into()), Some(99999999u32.into()), legs) verify { verify_add_instruction::(venue_id, settlement_type)?; } add_and_affirm_instruction { - let l in 1 .. T::MaxLegsInInstruction::get() as u32; + let l in 1 .. MAX_LEGS_IN_INSTRUCTION; // Define settlement type let settlement_type = SettlementType::SettleOnAffirmation; // Emulate the add instruction and get all the necessary arguments. let (legs, venue_id, origin, did , portfolios, _, _) = emulate_add_instruction::(l, true)?; - - }: _(origin, venue_id, settlement_type, Some(99999999.into()), Some(99999999.into()), legs, portfolios.clone()) + let s_portfolios = portfolios.clone(); + }: _(origin, venue_id, settlement_type, Some(99999999u32.into()), Some(99999999u32.into()), legs, s_portfolios) verify { verify_add_and_affirm_instruction::(venue_id, settlement_type, portfolios)?; } add_and_affirm_instruction_with_settle_on_block_type { - let l in 1 .. T::MaxLegsInInstruction::get() as u32; + let l in 1 .. MAX_LEGS_IN_INSTRUCTION; // Define settlement type. - let settlement_type = SettlementType::SettleOnBlock(100.into()); + let settlement_type = SettlementType::SettleOnBlock(100u32.into()); set_block_number::(50); // Emulate the add instruction and get all the necessary arguments. let (legs, venue_id, origin, did , portfolios, _, _) = emulate_add_instruction::(l, true)?; - - }: add_and_affirm_instruction(origin, venue_id, settlement_type, Some(99999999.into()), Some(99999999.into()), legs, portfolios.clone()) + let s_portfolios = portfolios.clone(); + }: add_and_affirm_instruction(origin, venue_id, settlement_type, Some(99999999u32.into()), Some(99999999u32.into()), legs, s_portfolios) verify { verify_add_and_affirm_instruction::(venue_id, settlement_type, portfolios)?; } @@ -704,7 +656,8 @@ benchmarks! { for i in 0 .. v { venues.push(i.into()); } - }: _(origin, ticker, venues.clone()) + let s_venues = venues.clone(); + }: _(origin, ticker, s_venues) verify { for v in venues.iter() { ensure!(Module::::venue_allow_list(ticker, v), "Fail: allow_venue dispatch"); @@ -721,7 +674,8 @@ benchmarks! { for i in 0 .. v { venues.push(i.into()); } - }: _(origin, ticker, venues.clone()) + let s_venues = venues.clone(); + }: _(origin, ticker, s_venues) verify { for v in venues.iter() { ensure!(!Module::::venue_allow_list(ticker, v), "Fail: allow_venue dispatch"); @@ -732,7 +686,7 @@ benchmarks! { withdraw_affirmation { // Below setup is for the onchain affirmation. - let l in 0 .. T::MaxLegsInInstruction::get() as u32; + let l in 0 .. MAX_LEGS_IN_INSTRUCTION; // Emulate the add instruction and get all the necessary arguments. let (legs, venue_id, origin, did , portfolios, _, _) = emulate_add_instruction::(l, true)?; // Add instruction @@ -740,9 +694,9 @@ benchmarks! { let instruction_id: u64 = 1; // Affirm an instruction let portfolios_set = portfolios.clone().into_iter().collect::>(); - Module::::unsafe_affirm_instruction(did, instruction_id, portfolios_set, None)?; + Module::::unsafe_affirm_instruction(did, instruction_id, portfolios_set, l.into(), None)?; - }: _(origin, instruction_id, portfolios) + }: _(origin, instruction_id, portfolios, l.into()) verify { for (idx, leg) in legs.iter().enumerate() { ensure!(matches!(Module::::instruction_leg_status(instruction_id, u64::try_from(idx).unwrap_or_default()), LegStatus::PendingTokenLock), "Fail: withdraw affirmation dispatch"); @@ -753,7 +707,7 @@ benchmarks! { withdraw_affirmation_with_receipt { // Below setup is for the receipt based affirmation - let l in 0 .. T::MaxLegsInInstruction::get() as u32; + let l in 0 .. MAX_LEGS_IN_INSTRUCTION; // Emulate the add instruction and get all the necessary arguments. let (legs, venue_id, origin, did , portfolios, _, account_id) = emulate_add_instruction::(l, true)?; // Add instruction @@ -766,9 +720,9 @@ benchmarks! { for (idx, _) in legs.clone().iter().enumerate() { let leg_id = u64::try_from(idx).unwrap_or_default(); // use leg_id for the receipt_uid as well. - set_instruction_let_status_to_skipped::(instruction_id, leg_id, account_id.clone(), leg_id); + set_instruction_leg_status_to_skipped::(instruction_id, leg_id, account_id.clone(), leg_id); } - }: withdraw_affirmation(origin, instruction_id, portfolios) + }: withdraw_affirmation(origin, instruction_id, portfolios, l.into()) verify { for (idx, leg) in legs.iter().enumerate() { ensure!(matches!(Module::::instruction_leg_status(instruction_id, u64::try_from(idx).unwrap_or_default()), LegStatus::PendingTokenLock), "Fail: withdraw affirmation dispatch"); @@ -785,7 +739,7 @@ benchmarks! { let instruction_id = 1; let leg_id = 0; - set_instruction_let_status_to_skipped::(instruction_id, leg_id, account_id.clone(), 0); + set_instruction_leg_status_to_skipped::(instruction_id, leg_id, account_id.clone(), 0); }: _(origin, instruction_id, leg_id) verify { ensure!(matches!(Module::::instruction_leg_status(instruction_id, leg_id), LegStatus::ExecutionPending), "Fail: unclaim_receipt dispatch"); @@ -795,13 +749,14 @@ benchmarks! { reject_instruction { // At least one portfolio needed - let l in 1 .. T::MaxLegsInInstruction::get() as u32; + let l in 1 .. MAX_LEGS_IN_INSTRUCTION; // Emulate the add instruction and get all the necessary arguments. let (legs, venue_id, origin, did , portfolios, _, account_id) = emulate_add_instruction::(l, true)?; // Add and affirm instruction. Module::::add_and_affirm_instruction((origin.clone()).into(), venue_id, SettlementType::SettleOnAffirmation, None, None, legs, portfolios.clone()).expect("Unable to add and affirm the instruction"); let instruction_id: u64 = 1; - }: _(origin, instruction_id, portfolios.clone()) + let s_portfolios = portfolios.clone(); + }: _(origin, instruction_id, s_portfolios, l.into()) verify { for p in portfolios.iter() { ensure!(Module::::affirms_received(instruction_id, p) == AffirmationStatus::Rejected, "Settlement: Failed to reject instruction"); @@ -811,13 +766,14 @@ benchmarks! { reject_instruction_with_no_pre_affirmations { // At least one portfolio needed - let l in 1 .. T::MaxLegsInInstruction::get() as u32; + let l in 1 .. MAX_LEGS_IN_INSTRUCTION; // Emulate the add instruction and get all the necessary arguments. let (legs, venue_id, origin, did , portfolios, _, account_id) = emulate_add_instruction::(l, true)?; // Add instruction Module::::base_add_instruction(did, venue_id, SettlementType::SettleOnAffirmation, None, None, legs.clone())?; let instruction_id: u64 = 1; - }: reject_instruction(origin, instruction_id, portfolios.clone()) + let s_portfolios = portfolios.clone(); + }: reject_instruction(origin, instruction_id, s_portfolios, l.into()) verify { for p in portfolios.iter() { ensure!(Module::::affirms_received(instruction_id, p) == AffirmationStatus::Rejected, "Settlement: Failed to reject instruction"); @@ -826,11 +782,12 @@ benchmarks! { affirm_instruction { - - let l in 2 .. T::MaxLegsInInstruction::get() as u32; // At least 2 legs needed to achieve worst case. - let (portfolios_to, _, to, _, _, _) = setup_affirm_instruction::(l); + let l in 0 .. MAX_LEGS_IN_INSTRUCTION; // At least 2 legs needed to achieve worst case. + let (portfolios_to, _, to, _, _) = setup_affirm_instruction::(l); let instruction_id = 1; // It will always be `1` as we know there is no other instruction in the storage yet. - }: _(RawOrigin::Signed(to.account), instruction_id, portfolios_to.clone()) + let to_portfolios = portfolios_to.clone(); + let legs_count = (l / 2).into(); + }: _(RawOrigin::Signed(to.account), instruction_id, to_portfolios, legs_count) verify { for p in portfolios_to.iter() { ensure!(Module::::affirms_received(instruction_id, p) == AffirmationStatus::Affirmed, "Settlement: Failed to affirm instruction"); @@ -845,14 +802,15 @@ benchmarks! { // Add instruction Module::::base_add_instruction(did, venue_id, SettlementType::SettleOnAffirmation, None, None, legs.clone())?; let instruction_id = 1; - let ticker = Ticker::try_from(vec![b'A'; 1 as usize].as_slice()).unwrap(); + let ticker = Ticker::try_from(generate_ticker(1u64).as_slice()).unwrap(); let receipt = create_receipt_details::(0, legs.first().unwrap().clone()); let leg_id = 0; - let amount = 100; + let amount = 100u128; // Some manual setup to support the extrinsic. set_instruction_leg_status_to_pending::(instruction_id, leg_id); T::Portfolio::lock_tokens(s_portfolios.first().unwrap(), &ticker, &amount.into())?; - }: _(origin, instruction_id, receipt.clone()) + let s_receipt = receipt.clone(); + }: _(origin, instruction_id, s_receipt) verify { ensure!(Module::::instruction_leg_status(instruction_id, leg_id) == LegStatus::ExecutionToBeSkipped( receipt.signer, @@ -863,7 +821,7 @@ benchmarks! { affirm_with_receipts { // Catalyst here is the length of receipts vector. - let r in 1 .. T::MaxLegsInInstruction::get() as u32; + let r in 1 .. MAX_LEGS_IN_INSTRUCTION; // Emulate the add instruction and get all the necessary arguments. let (legs, venue_id, origin, did , s_portfolios, r_portfolios, account_id) = emulate_add_instruction::(r, true)?; // Add instruction @@ -873,7 +831,8 @@ benchmarks! { legs.clone().into_iter().enumerate().for_each(|(idx, l)| { receipt_details.push(create_receipt_details::(idx as u32, l)); }); - }: _(origin, instruction_id, receipt_details.clone(), s_portfolios) + let s_receipt_details = receipt_details.clone(); + }: _(origin, instruction_id, s_receipt_details, s_portfolios, r) verify { for (i, receipt) in receipt_details.iter().enumerate() { ensure!(Module::::instruction_leg_status(instruction_id, i as u64) == LegStatus::ExecutionToBeSkipped( @@ -883,20 +842,29 @@ benchmarks! { } } + change_receipt_validity { + let signer = user::("signer", 0); + }: _(signer.origin(), 0, false) + verify { + ensure!(Module::::receipts_used(&signer.account(), 0), "Settlement: change_receipt_validity didn't work"); + } + execute_scheduled_instruction { // This dispatch execute an instruction. // // Worst case scenarios. // 1. Create maximum legs and both traded assets are different assets/securities. - // 2. Assets should have worst compliance restrictions ? + // 2. Assets have maximum compliance restriction complexity. // 3. Assets have maximum no. of TMs. - let l in 0 .. T::MaxLegsInInstruction::get() as u32; - let s in 0 .. T::MaxTransferManagersPerAsset::get() as u32; - let c in 1 .. T::MaxConditionComplexity::get() as u32; // At least 1 compliance restriction needed. + let l in 0 .. MAX_LEGS_IN_INSTRUCTION; + let s = T::MaxTransferManagersPerAsset::get() as u32; + let c = T::MaxConditionComplexity::get() as u32; + // Setup affirm instruction (One party (i.e from) already affirms the instruction) - let (portfolios_to, from, to, from_ticker, to_ticker, legs) = setup_affirm_instruction::(l); + let (portfolios_to, from, to, tickers, legs) = setup_affirm_instruction::(l); // Keep the portfolio asset balance before the instruction execution to verify it later. + let legs_count: u32 = legs.len().try_into().unwrap(); let first_leg = legs.into_iter().nth(0).unwrap_or_default(); let before_transfer_balance = >::get(first_leg.from, first_leg.asset); // It always be one as no other instruction is already scheduled. @@ -905,27 +873,25 @@ benchmarks! { let from_origin = RawOrigin::Signed(from.account.clone()); let to_origin = RawOrigin::Signed(to.account.clone()); // Do another affirmations that lead to scheduling an instruction. - Module::::affirm_instruction((to_origin.clone()).into(), instruction_id, portfolios_to).expect("Settlement: Failed to affirm instruction"); + Module::::affirm_instruction((to_origin.clone()).into(), instruction_id, portfolios_to, (legs_count / 2).into()).expect("Settlement: Failed to affirm instruction"); // Create trusted issuer for both the ticker let t_issuer = UserBuilder::::default().generate_did().build("TrustedClaimIssuer"); let trusted_issuer = TrustedIssuer::from(t_issuer.did()); // Need to provide the Investor uniqueness claim for both sender and receiver, // for both assets also add the compliance rules as per the `MaxConditionComplexity`. - compliance_setup::(c, from_ticker, from_origin.clone(), from.did, to.did, trusted_issuer.clone()); - compliance_setup::(c, to_ticker, to_origin.clone(), from.did, to.did, trusted_issuer); + for ticker in tickers { + compliance_setup::(c, ticker, from_origin.clone(), from.did, to.did, trusted_issuer.clone()); + add_transfer_managers::(ticker, from_origin.clone(), from.did, s); + } + // -------- Commented the smart extension integration ---------------- // let code_hash = emulate_blueprint_in_storage::(0, from_origin.clone(), "ptm")?; // for i in 0 .. s { // add_smart_extension_to_ticker::(code_hash, from_origin.clone(), from.account.clone(), from_ticker); // add_smart_extension_to_ticker::(code_hash, to_origin.clone(), to.account.clone(), to_ticker); // } - - for i in 0 .. s { - add_transfer_manager::(from_ticker, from_origin.clone(), i, from.did); - add_transfer_manager::(to_ticker, to_origin.clone(), i, to.did); - } - }: _(origin, instruction_id) + }: _(origin, instruction_id, l) verify { // Ensure that any one leg processed through that give sufficient evidence of successful execution of instruction. let after_transfer_balance = >::get(first_leg.from, first_leg.asset); diff --git a/pallets/settlement/src/lib.rs b/pallets/settlement/src/lib.rs index 617218cbef..be338f272e 100644 --- a/pallets/settlement/src/lib.rs +++ b/pallets/settlement/src/lib.rs @@ -57,10 +57,7 @@ use frame_support::{ decl_error, decl_event, decl_module, decl_storage, dispatch::{DispatchError, DispatchResult}, ensure, storage, - traits::{ - schedule::{DispatchTime, Named as ScheduleNamed}, - Get, - }, + traits::schedule::{DispatchTime, Named as ScheduleNamed}, weights::Weight, IterableStorageDoubleMap, StorageHasher, Twox128, }; @@ -97,8 +94,6 @@ pub trait Trait: { /// The overarching event type. type Event: From> + Into<::Event>; - /// The maximum number of total legs allowed for a instruction can have. - type MaxLegsInInstruction: Get; /// Scheduler of settlement instructions. type Scheduler: ScheduleNamed; /// A call type for identity-mapping the `Call` enum type. Used by the scheduler. @@ -315,8 +310,9 @@ pub trait WeightInfo { fn set_venue_filtering() -> Weight; fn allow_venues(u: u32) -> Weight; fn disallow_venues(u: u32) -> Weight; - fn execute_scheduled_instruction(l: u32, s: u32, c: u32) -> Weight; + fn execute_scheduled_instruction(l: u32) -> Weight; fn reject_instruction_with_no_pre_affirmations(l: u32) -> Weight; + fn change_receipt_validity() -> Weight; // Some multiple paths based extrinsic. // TODO: Will be removed once we get the worst case weight. @@ -357,6 +353,8 @@ decl_event!( InstructionRejected(IdentityId, u64), /// A receipt has been claimed (did, instruction_id, leg_id, receipt_uid, signer, receipt metadata) ReceiptClaimed(IdentityId, u64, u64, u64, AccountId, ReceiptMetadata), + /// A receipt has been invalidated (did, signer, receipt_uid, validity) + ReceiptValidityChanged(IdentityId, AccountId, u64, bool), /// A receipt has been unclaimed (did, instruction_id, leg_id, receipt_uid, signer) ReceiptUnclaimed(IdentityId, u64, u64, u64, AccountId), /// Venue filtering has been enabled or disabled for a ticker (did, ticker, filtering_enabled) @@ -413,8 +411,6 @@ decl_error! { InvalidSignature, /// Sender and receiver are the same. SameSenderReceiver, - /// Maximum numbers of legs in a instruction > `MaxLegsInInstruction`. - LegsCountExceededMaxLimit, /// Portfolio in receipt does not match with portfolios provided by the user. PortfolioMismatch, /// The provided settlement block number is in the past and cannot be used by the scheduler. @@ -424,7 +420,9 @@ decl_error! { /// The current instruction affirmation status does not support the requested action. UnexpectedAffirmationStatus, /// Scheduling of an instruction fails. - FailedToSchedule + FailedToSchedule, + /// Legs count should matches with the total number of legs in which given portfolio act as `from_portfolio`. + LegCountTooSmall } } @@ -443,7 +441,7 @@ decl_storage! { /// Details about an instruction. instruction_id -> instruction_details InstructionDetails get(fn instruction_details): map hasher(twox_64_concat) u64 => Instruction; /// Legs under an instruction. (instruction_id, leg_id) -> Leg - InstructionLegs get(fn instruction_legs): double_map hasher(twox_64_concat) u64, hasher(twox_64_concat) u64 => Leg; + pub InstructionLegs get(fn instruction_legs): double_map hasher(twox_64_concat) u64, hasher(twox_64_concat) u64 => Leg; /// Status of a leg under an instruction. (instruction_id, leg_id) -> LegStatus InstructionLegStatus get(fn instruction_leg_status): double_map hasher(twox_64_concat) u64, hasher(twox_64_concat) u64 => LegStatus; /// Number of affirmations pending before instruction is executed. instruction_id -> affirm_pending @@ -475,8 +473,6 @@ decl_module! { fn deposit_event() = default; - const MaxLegsInInstruction: u32 = T::MaxLegsInInstruction::get(); - fn on_runtime_upgrade() -> Weight { let storage_ver = StorageVersion::get(); @@ -559,7 +555,7 @@ decl_module! { /// `950_000_000 + 1_000_000 * legs.len()` #[weight = ::WeightInfo::add_instruction_with_settle_on_block_type(legs.len() as u32) .saturating_add( - ::WeightInfo::execute_scheduled_instruction(legs.len() as u32, T::MaxNumberOfTMExtensionForAsset::get(), T::MaxConditionComplexity::get()) + ::WeightInfo::execute_scheduled_instruction(legs.len() as u32) )] pub fn add_instruction( origin, @@ -583,9 +579,12 @@ decl_module! { /// * `value_date` - Optional date after which the instruction should be settled (not enforced) /// * `legs` - Legs included in this instruction. /// * `portfolios` - Portfolios that the sender controls and wants to use in this affirmations. + /// + /// # Permissions + /// * Portfolio #[weight = ::WeightInfo::add_and_affirm_instruction_with_settle_on_block_type(legs.len() as u32) .saturating_add( - ::WeightInfo::execute_scheduled_instruction(legs.len() as u32, T::MaxNumberOfTMExtensionForAsset::get(), T::MaxConditionComplexity::get()) + ::WeightInfo::execute_scheduled_instruction(legs.len() as u32) )] pub fn add_and_affirm_instruction( origin, @@ -598,9 +597,10 @@ decl_module! { ) -> DispatchResult { let did = Identity::::ensure_perms(origin.clone())?; with_transaction(|| { - let instruction_id = Self::base_add_instruction(did, venue_id, settlement_type, trade_date, value_date, legs)?; let portfolios_set = portfolios.into_iter().collect::>(); - Self::affirm_and_maybe_schedule_instruction(origin, instruction_id, portfolios_set.into_iter()) + let legs_count = legs.iter().filter(|l| portfolios_set.contains(&l.from)).count() as u32; + let instruction_id = Self::base_add_instruction(did, venue_id, settlement_type, trade_date, value_date, legs)?; + Self::affirm_and_maybe_schedule_instruction(origin, instruction_id, portfolios_set.into_iter(), legs_count) }) } @@ -608,10 +608,14 @@ decl_module! { /// /// # Arguments /// * `instruction_id` - Instruction id to affirm. - /// * `portfolios` - Portfolios that the sender controls and wants to affirm this instruction - #[weight = ::WeightInfo::affirm_instruction(portfolios.len() as u32)] - pub fn affirm_instruction(origin, instruction_id: u64, portfolios: Vec) -> DispatchResult { - Self::affirm_and_maybe_schedule_instruction(origin, instruction_id, portfolios.into_iter()) + /// * `portfolios` - Portfolios that the sender controls and wants to affirm this instruction. + /// * `legs` - List of legs needs to affirmed. + /// + /// # Permissions + /// * Portfolio + #[weight = ::WeightInfo::affirm_instruction(*max_legs_count as u32)] + pub fn affirm_instruction(origin, instruction_id: u64, portfolios: Vec, max_legs_count: u32) -> DispatchResult { + Self::affirm_and_maybe_schedule_instruction(origin, instruction_id, portfolios.into_iter(), max_legs_count) } /// Withdraw an affirmation for a given instruction. @@ -619,13 +623,16 @@ decl_module! { /// # Arguments /// * `instruction_id` - Instruction id for that affirmation get withdrawn. /// * `portfolios` - Portfolios that the sender controls and wants to withdraw affirmation. - #[weight = ::WeightInfo::withdraw_affirmation(portfolios.len() as u32)] - pub fn withdraw_affirmation(origin, instruction_id: u64, portfolios: Vec) { + /// + /// # Permissions + /// * Portfolio + #[weight = ::WeightInfo::withdraw_affirmation(*max_legs_count as u32)] + pub fn withdraw_affirmation(origin, instruction_id: u64, portfolios: Vec, max_legs_count: u32) { let (did, secondary_key) = Self::ensure_origin_perm_and_instruction_validity(origin, instruction_id)?; let portfolios_set = portfolios.into_iter().collect::>(); // Withdraw an affirmation. - Self::unsafe_withdraw_instruction_affirmation(did, instruction_id, portfolios_set, secondary_key.as_ref())?; + Self::unsafe_withdraw_instruction_affirmation(did, instruction_id, portfolios_set, secondary_key.as_ref(), max_legs_count)?; if Self::instruction_details(instruction_id).settlement_type == SettlementType::SettleOnAffirmation { // Cancel the scheduled task for the execution of a given instruction. let _ = T::Scheduler::cancel_named((SETTLEMENT_INSTRUCTION_EXECUTION, instruction_id).encode()); @@ -637,8 +644,11 @@ decl_module! { /// # Arguments /// * `instruction_id` - Instruction id to reject. /// * `portfolios` - Portfolios that the sender controls and wants them to reject this instruction - #[weight = ::WeightInfo::reject_instruction_with_no_pre_affirmations(portfolios.len() as u32)] - pub fn reject_instruction(origin, instruction_id: u64, portfolios: Vec) { + /// + /// # Permissions + /// * Portfolio + #[weight = ::WeightInfo::reject_instruction_with_no_pre_affirmations(*max_legs_count as u32)] + pub fn reject_instruction(origin, instruction_id: u64, portfolios: Vec, max_legs_count: u32) { let (did, secondary_key) = Self::ensure_origin_perm_and_instruction_validity(origin, instruction_id)?; ensure!(!portfolios.is_empty(), Error::::NoPortfolioProvided); @@ -655,7 +665,7 @@ decl_module! { _ => return Err(Error::::NoPendingAffirm.into()) }; } - Self::unsafe_withdraw_instruction_affirmation(did, instruction_id, affirmed_portfolios, secondary_key.as_ref())?; + let legs_count = Self::unsafe_withdraw_instruction_affirmation(did, instruction_id, affirmed_portfolios, secondary_key.as_ref(), max_legs_count)?; // Updates storage to mark the instruction as rejected. for portfolio in portfolios_set { @@ -665,7 +675,7 @@ decl_module! { Self::deposit_event(RawEvent::InstructionRejected(did, instruction_id)); // Schedule the instruction to execute in the next block only if it was meant to be executed on affirmation. - Self::maybe_schedule_instruction(Zero::zero(), instruction_id) + Self::maybe_schedule_instruction(Zero::zero(), instruction_id, legs_count) } /// Accepts an instruction and claims a signed receipt. @@ -677,9 +687,12 @@ decl_module! { /// * `signer` - Signer of the receipt. /// * `signed_data` - Signed receipt. /// * `portfolios` - Portfolios that the sender controls and wants to accept this instruction with - #[weight = ::WeightInfo::affirm_with_receipts(receipt_details.len() as u32)] - pub fn affirm_with_receipts(origin, instruction_id: u64, receipt_details: Vec>, portfolios: Vec) -> DispatchResult { - Self::affirm_with_receipts_and_maybe_schedule_instruction(origin, instruction_id, receipt_details, portfolios) + /// + /// # Permissions + /// * Portfolio + #[weight = ::WeightInfo::affirm_with_receipts(*max_legs_count as u32).max(::WeightInfo::affirm_instruction(*max_legs_count as u32))] + pub fn affirm_with_receipts(origin, instruction_id: u64, receipt_details: Vec>, portfolios: Vec, max_legs_count: u32) -> DispatchResult { + Self::affirm_with_receipts_and_maybe_schedule_instruction(origin, instruction_id, receipt_details, portfolios, max_legs_count) } /// Claims a signed receipt. @@ -690,6 +703,9 @@ decl_module! { /// * `receipt_uid` - Receipt ID generated by the signer. /// * `signer` - Signer of the receipt. /// * `signed_data` - Signed receipt. + /// + /// # Permissions + /// * Portfolio #[weight = ::WeightInfo::claim_receipt()] pub fn claim_receipt(origin, instruction_id: u64, receipt_details: ReceiptDetails) -> DispatchResult { let (primary_did, secondary_key) = Self::ensure_origin_perm_and_instruction_validity(origin, instruction_id)?; @@ -706,6 +722,9 @@ decl_module! { /// # Arguments /// * `instruction_id` - Target instruction id for the receipt. /// * `leg_id` - Target leg id for the receipt + /// + /// # Permissions + /// * Portfolio #[weight = ::WeightInfo::unclaim_receipt()] pub fn unclaim_receipt(origin, instruction_id: u64, leg_id: u64) { let (did, secondary_key) = Self::ensure_origin_perm_and_instruction_validity(origin, instruction_id)?; @@ -728,6 +747,9 @@ decl_module! { /// # Arguments /// * `ticker` - Ticker of the token in question. /// * `enabled` - Boolean that decides if the filtering should be enabled. + /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::set_venue_filtering()] pub fn set_venue_filtering(origin, ticker: Ticker, enabled: bool) { let did = >::ensure_perms_owner_asset(origin, &ticker)?; @@ -744,8 +766,8 @@ decl_module! { /// * `ticker` - Ticker of the token in question. /// * `venues` - Array of venues that are allowed to create instructions for the token in question. /// - /// # Weight - /// `200_000_000 + 500_000 * venues.len()` + /// # Permissions + /// * Asset #[weight = ::WeightInfo::allow_venues(venues.len() as u32)] pub fn allow_venues(origin, ticker: Ticker, venues: Vec) { let did = >::ensure_perms_owner_asset(origin, &ticker)?; @@ -760,8 +782,8 @@ decl_module! { /// * `ticker` - Ticker of the token in question. /// * `venues` - Array of venues that are no longer allowed to create instructions for the token in question. /// - /// # Weight - /// `200_000_000 + 500_000 * venues.len()` + /// # Permissions + /// * Asset #[weight = ::WeightInfo::disallow_venues(venues.len() as u32)] pub fn disallow_venues(origin, ticker: Ticker, venues: Vec) { let did = >::ensure_perms_owner_asset(origin, &ticker)?; @@ -771,9 +793,25 @@ decl_module! { Self::deposit_event(RawEvent::VenuesBlocked(did, ticker, venues)); } + /// Marks a receipt issued by the caller as claimed or not claimed. + /// This allows the receipt issuer to invalidate an already issued receipt or revalidate an already claimed receipt. + /// + /// * `receipt_uid` - Unique ID of the receipt. + /// * `validity` - New validity of the receipt. + #[weight = ::WeightInfo::change_receipt_validity()] + pub fn change_receipt_validity(origin, receipt_uid: u64, validity: bool) { + let PermissionedCallOriginData { + primary_did, + sender: signer, + .. + } = Identity::::ensure_origin_call_permissions(origin)?; + >::insert(&signer, receipt_uid, !validity); + Self::deposit_event(RawEvent::ReceiptValidityChanged(primary_did, signer, receipt_uid, validity)); + } + /// Root callable extrinsic, used as an internal call to execute a scheduled settlement instruction. - #[weight = ::WeightInfo::execute_scheduled_instruction(T::MaxLegsInInstruction::get(), T::MaxNumberOfTMExtensionForAsset::get(), T::MaxConditionComplexity::get())] - fn execute_scheduled_instruction(origin, instruction_id: u64) { + #[weight = ::WeightInfo::execute_scheduled_instruction(*legs_count)] + fn execute_scheduled_instruction(origin, instruction_id: u64, legs_count: u32) { ensure_root(origin)?; Self::execute_instruction(instruction_id)?; } @@ -811,12 +849,6 @@ impl Module { value_date: Option, legs: Vec>, ) -> Result { - // Check whether the no. of legs within the limit or not. - ensure!( - u32::try_from(legs.len()).unwrap_or_default() <= T::MaxLegsInInstruction::get(), - Error::::LegsCountExceededMaxLimit - ); - // Ensure that the scheduled block number is in the future so that `T::Scheduler::schedule_named` // doesn't fail. if let SettlementType::SettleOnBlock(block_number) = &settlement_type { @@ -881,7 +913,7 @@ impl Module { } if let SettlementType::SettleOnBlock(block_number) = settlement_type { - Self::schedule_instruction(instruction_counter, block_number); + Self::schedule_instruction(instruction_counter, block_number, legs.len() as u32); } >::insert(instruction_counter, instruction); @@ -909,7 +941,8 @@ impl Module { instruction_id: u64, portfolios: BTreeSet, secondary_key: Option<&SecondaryKey>, - ) -> DispatchResult { + max_legs_count: u32, + ) -> Result { // checks custodianship of portfolios and affirmation status Self::ensure_portfolios_and_affirmation_status( instruction_id, @@ -919,10 +952,9 @@ impl Module { &[AffirmationStatus::Affirmed], )?; // Unlock tokens that were previously locked during the affirmation - let legs = >::iter_prefix(instruction_id); - for (leg_id, leg_details) in - legs.filter(|(_leg_id, leg_details)| portfolios.contains(&leg_details.from)) - { + let (total_leg_count, filtered_legs) = + Self::filtered_legs(instruction_id, &portfolios, max_legs_count)?; + for (leg_id, leg_details) in filtered_legs { match Self::instruction_leg_status(instruction_id, leg_id) { LegStatus::ExecutionToBeSkipped(signer, receipt_uid) => { // Receipt was claimed for this instruction. Therefore, no token unlocking is required, we just unclaim the receipt. @@ -961,7 +993,7 @@ impl Module { *affirms_pending += u64::try_from(portfolios.len()).unwrap_or_default() }); - Ok(()) + Ok(total_leg_count) } fn ensure_instruction_validity(instruction_id: u64) -> DispatchResult { @@ -986,7 +1018,14 @@ impl Module { } fn execute_instruction(instruction_id: u64) -> Result { - let legs = >::iter_prefix(instruction_id).collect::>(); + let mut legs = >::iter_prefix(instruction_id).collect::>(); + // NB: Execution order doesn't matter in most cases but might matter in some edge cases around compliance + // Example of an edge case: Consider a token with total supply 100 and maximum percentage ownership of 10%. + // Alice owns 10 tokens, Bob owns 5 and Charlie owns 0. + // Instruction has two legs: 1. Alice transfers 5 tokens to Charlie. 2. Bob transfers 5 tokens to Alice. + // If the instruction is executed in order, it remains valid but if the second leg gets executed before first, + // Alice will momentarily hold 15% of the asset and hence the settlement will fail compliance. + legs.sort_by_key(|leg| leg.0); let instructions_processed: u32 = u32::try_from(legs.len()).unwrap_or_default(); Self::unchecked_release_locks(instruction_id, &legs); let mut result = DispatchResult::Ok(()); @@ -1086,8 +1125,9 @@ impl Module { did: IdentityId, instruction_id: u64, portfolios: BTreeSet, + max_legs_count: u32, secondary_key: Option<&SecondaryKey>, - ) -> DispatchResult { + ) -> Result { // checks portfolio's custodian and if it is a counter party with a pending or rejected affirmation Self::ensure_portfolios_and_affirmation_status( instruction_id, @@ -1097,11 +1137,10 @@ impl Module { &[AffirmationStatus::Pending, AffirmationStatus::Rejected], )?; + let (total_leg_count, filtered_legs) = + Self::filtered_legs(instruction_id, &portfolios, max_legs_count)?; with_transaction(|| { - let legs = >::iter_prefix(instruction_id); - for (leg_id, leg_details) in - legs.filter(|(_leg_id, leg_details)| portfolios.contains(&leg_details.from)) - { + for (leg_id, leg_details) in filtered_legs { if let Err(_) = Self::lock_via_leg(&leg_details) { // rustc fails to infer return type of `with_transaction` if you use ?/map_err here return Err(DispatchError::from(Error::::FailedToLockTokens)); @@ -1132,7 +1171,7 @@ impl Module { affirms_pending.saturating_sub(u64::try_from(portfolios.len()).unwrap_or_default()), ); - Ok(()) + Ok(total_leg_count) } fn unsafe_claim_receipt( @@ -1235,13 +1274,13 @@ impl Module { /// Schedule a given instruction to be executed on the next block only if the /// settlement type is `SettleOnAffirmation` and no. of affirms pending is 0. - fn maybe_schedule_instruction(affirms_pending: u64, id: u64) { + fn maybe_schedule_instruction(affirms_pending: u64, id: u64, legs_count: u32) { if affirms_pending == 0 && Self::instruction_details(id).settlement_type == SettlementType::SettleOnAffirmation { // Schedule instruction to be executed in the next block. let execution_at = system::Module::::block_number() + One::one(); - Self::schedule_instruction(id, execution_at); + Self::schedule_instruction(id, execution_at, legs_count); } } @@ -1250,8 +1289,8 @@ impl Module { /// NB - It is expected to execute the given instruction into the given block number but /// it is not a guaranteed behavior, Scheduler may have other high priority task scheduled /// for the given block so there are chances where the instruction execution block no. may drift. - fn schedule_instruction(instruction_id: u64, execution_at: T::BlockNumber) { - let call = Call::::execute_scheduled_instruction(instruction_id).into(); + fn schedule_instruction(instruction_id: u64, execution_at: T::BlockNumber, legs_count: u32) { + let call = Call::::execute_scheduled_instruction(instruction_id, legs_count).into(); if let Err(_) = T::Scheduler::schedule_named( (SETTLEMENT_INSTRUCTION_EXECUTION, instruction_id).encode(), DispatchTime::At(execution_at), @@ -1271,7 +1310,8 @@ impl Module { instruction_id: u64, receipt_details: Vec>, portfolios: Vec, - ) -> DispatchResult { + max_legs_count: u32, + ) -> Result { let (did, secondary_key) = Self::ensure_origin_perm_and_instruction_validity(origin, instruction_id)?; let portfolios_set = portfolios.into_iter().collect::>(); @@ -1328,12 +1368,11 @@ impl Module { ); } + let (total_leg_count, filtered_legs) = + Self::filtered_legs(instruction_id, &portfolios_set, max_legs_count)?; // Lock tokens that do not have a receipt attached to their leg. with_transaction(|| { - let legs = >::iter_prefix(instruction_id); - for (leg_id, leg_details) in - legs.filter(|(_leg_id, leg_details)| portfolios_set.contains(&leg_details.from)) - { + for (leg_id, leg_details) in filtered_legs { // Receipt for the leg was provided if let Some(receipt) = receipt_details .iter() @@ -1389,20 +1428,27 @@ impl Module { } InstructionAffirmsPending::insert(instruction_id, affirms_pending); - Ok(()) + Ok(total_leg_count) } pub fn base_affirm_instruction( origin: ::Origin, instruction_id: u64, portfolios: impl Iterator, - ) -> DispatchResult { + max_legs_count: u32, + ) -> Result { let (did, secondary_key) = Self::ensure_origin_perm_and_instruction_validity(origin, instruction_id)?; let portfolios_set = portfolios.collect::>(); // Provide affirmation to the instruction - Self::unsafe_affirm_instruction(did, instruction_id, portfolios_set, secondary_key.as_ref()) + Self::unsafe_affirm_instruction( + did, + instruction_id, + portfolios_set, + max_legs_count, + secondary_key.as_ref(), + ) } // It affirms the instruction and may schedule the instruction @@ -1412,12 +1458,20 @@ impl Module { instruction_id: u64, receipt_details: Vec>, portfolios: Vec, + max_legs_count: u32, ) -> DispatchResult { - Self::base_affirm_with_receipts(origin, instruction_id, receipt_details, portfolios)?; + let legs_count = Self::base_affirm_with_receipts( + origin, + instruction_id, + receipt_details, + portfolios, + max_legs_count, + )?; // Schedule instruction to be execute in the next block (expected) if conditions are met. Self::maybe_schedule_instruction( Self::instruction_affirms_pending(instruction_id), instruction_id, + legs_count, ); Ok(()) } @@ -1428,12 +1482,15 @@ impl Module { origin: ::Origin, instruction_id: u64, portfolios: impl Iterator, + max_legs_count: u32, ) -> DispatchResult { - Self::base_affirm_instruction(origin, instruction_id, portfolios)?; + let legs_count = + Self::base_affirm_instruction(origin, instruction_id, portfolios, max_legs_count)?; // Schedule the instruction if conditions are met Self::maybe_schedule_instruction( Self::instruction_affirms_pending(instruction_id), instruction_id, + legs_count, ); Ok(()) } @@ -1445,9 +1502,15 @@ impl Module { origin: ::Origin, instruction_id: u64, portfolios: Vec, + max_legs_count: u32, ) -> DispatchResult { with_transaction(|| { - Self::base_affirm_instruction(origin, instruction_id, portfolios.into_iter())?; + Self::base_affirm_instruction( + origin, + instruction_id, + portfolios.into_iter(), + max_legs_count, + )?; Self::execute_settle_on_affirmation_instruction( instruction_id, Self::instruction_affirms_pending(instruction_id), @@ -1464,9 +1527,16 @@ impl Module { instruction_id: u64, receipt_details: Vec>, portfolios: Vec, + max_legs_count: u32, ) -> DispatchResult { with_transaction(|| { - Self::base_affirm_with_receipts(origin, instruction_id, receipt_details, portfolios)?; + Self::base_affirm_with_receipts( + origin, + instruction_id, + receipt_details, + portfolios, + max_legs_count, + )?; Self::execute_settle_on_affirmation_instruction( instruction_id, Self::instruction_affirms_pending(instruction_id), @@ -1509,4 +1579,25 @@ impl Module { } Ok(()) } + + /// Returns total number of legs of an `instruction_id` and vector of legs where sender is in the `portfolios` set. + /// Also, ensures that the number of filtered legs is under the limit. + fn filtered_legs( + instruction_id: u64, + portfolios: &BTreeSet, + max_filtered_legs: u32, + ) -> Result<(u32, Vec<(u64, Leg)>), DispatchError> { + let mut legs_count = 0; + let filtered_legs = >::iter_prefix(instruction_id) + .into_iter() + .inspect(|_| legs_count += 1) + .filter(|(_, leg_details)| portfolios.contains(&leg_details.from)) + .collect::>(); + // Ensure leg count is under the limit + ensure!( + filtered_legs.len() as u32 <= max_filtered_legs, + Error::::LegCountTooSmall + ); + Ok((legs_count, filtered_legs)) + } } diff --git a/pallets/staking/Cargo.toml b/pallets/staking/Cargo.toml index 1ae37a328e..d7abc8c15b 100644 --- a/pallets/staking/Cargo.toml +++ b/pallets/staking/Cargo.toml @@ -15,26 +15,26 @@ serde = { version = "1.0.104", optional = true } # Substrate codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0"} -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-staking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-npos-elections = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0"} +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1"} +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-staking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-npos-elections = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1"} -pallet-session = { features = ["historical"], git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-babe = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-session = { features = ["historical"], git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-authorship = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-babe = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Optional imports for benchmarking -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0", optional = true } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1", optional = true } rand_chacha = { version = "0.2", default-features = false, optional = true } [dev-dependencies] -pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-staking-reward-curve = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } [features] default = ["std"] diff --git a/pallets/staking/rpc/Cargo.toml b/pallets/staking/rpc/Cargo.toml index 0eb85324ab..86f44045b7 100644 --- a/pallets/staking/rpc/Cargo.toml +++ b/pallets/staking/rpc/Cargo.toml @@ -10,8 +10,8 @@ serde = { version = "1.0.104", features = ["derive"] } jsonrpc-core = "15.0.0" jsonrpc-core-client = "15.0.0" jsonrpc-derive = "15.0.0" -sp-runtime = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } -sp-blockchain = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0"} -sp-api = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0"} +sp-runtime = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } +sp-blockchain = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1"} +sp-api = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1"} pallet-staking-rpc-runtime-api = { version = "2.0.0", path = "./runtime-api" } diff --git a/pallets/staking/rpc/runtime-api/Cargo.toml b/pallets/staking/rpc/runtime-api/Cargo.toml index b74cb1bb8b..787de6070e 100644 --- a/pallets/staking/rpc/runtime-api/Cargo.toml +++ b/pallets/staking/rpc/runtime-api/Cargo.toml @@ -5,9 +5,9 @@ authors = ["Anonymous"] edition = "2018" [dependencies] -sp-api = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0"} -sp-runtime = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0"} -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-api = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1"} +sp-runtime = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1"} +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } [dev-dependencies] serde_json = "1.0.48" diff --git a/pallets/staking/src/benchmarking.rs b/pallets/staking/src/benchmarking.rs index b095cdc0e4..6977b48dcc 100644 --- a/pallets/staking/src/benchmarking.rs +++ b/pallets/staking/src/benchmarking.rs @@ -23,6 +23,7 @@ use testing_utils::*; pub use frame_benchmarking::{account, benchmarks, whitelisted_caller}; use frame_system::RawOrigin; +use polymesh_common_utilities::benchs::UserBuilder; use sp_runtime::traits::One; const SEED: u32 = 0; const MAX_SPANS: u32 = 100; @@ -47,38 +48,65 @@ fn add_slashing_spans(who: &T::AccountId, spans: u32) { SlashingSpans::::insert(who, slashing_spans); } +fn add_perm_validator(id: IdentityId, intended_count: Option) { + Staking::::set_validator_count(RawOrigin::Root.into(), 10) + .expect("Failed to set the validator count"); + Staking::::add_permissioned_validator(RawOrigin::Root.into(), id, intended_count) + .expect("Failed to add permissioned validator"); +} + // This function generates one validator being nominated by n nominators, and returns the validator // stash account. It also starts an era and creates pending payouts. pub fn create_validator_with_nominators( n: u32, upper_bound: u32, dead: bool, -) -> Result { +) -> Result { + create_validator_with_nominators_with_balance::(n, upper_bound, 10000u32.into(), dead) +} + +// This function generates one validator being nominated by n nominators, and returns the validator +// stash account. It also starts an era and creates pending payouts. +// The balance is added to controller and stash accounts. +pub fn create_validator_with_nominators_with_balance( + n: u32, + upper_bound: u32, + balance: u32, + dead: bool, +) -> Result { let mut points_total = 0; let mut points_individual = Vec::new(); - let (v_stash, v_controller) = create_stash_controller::(0, 100)?; + let (v_stash, v_controller) = create_stash_controller_with_balance::(0, balance)?; + let v_controller_origin = v_controller.origin(); + let validator_prefs = ValidatorPrefs { commission: Perbill::from_percent(50), }; - Staking::::validate(RawOrigin::Signed(v_controller).into(), validator_prefs)?; - let stash_lookup: ::Source = T::Lookup::unlookup(v_stash.clone()); + emulate_validator_setup::(1, 10, Perbill::from_percent(60)); + Staking::::add_permissioned_validator(RawOrigin::Root.into(), v_stash.did(), Some(2)) + .expect("Failed to add permissioned validator"); + Staking::::validate(v_controller_origin.into(), validator_prefs.clone()) + .expect("Failed to validate"); + assert_eq!( + Staking::::validators(v_stash.account()), + validator_prefs, + "Failed to set the validator" + ); + let stash_lookup = v_stash.lookup(); points_total += 10; - points_individual.push((v_stash.clone(), 10)); + points_individual.push((v_stash.account(), 10)); // Give the validator n nominators, but keep total users in the system the same. for i in 0..upper_bound { let (_n_stash, n_controller) = if !dead { - create_stash_controller::(u32::max_value() - i, 100)? + create_stash_controller_with_balance::(u32::max_value() - i, 100)? } else { - create_stash_and_dead_controller::(u32::max_value() - i, 100)? + create_stash_with_dead_controller::(u32::max_value() - i, 100)? }; if i < n { - Staking::::nominate( - RawOrigin::Signed(n_controller.clone()).into(), - vec![stash_lookup.clone()], - )?; + Staking::::nominate(n_controller.origin().into(), vec![stash_lookup.clone()])?; } } @@ -99,10 +127,35 @@ pub fn create_validator_with_nominators( ErasRewardPoints::::insert(current_era, reward); // Create reward pool - let total_payout = T::Currency::minimum_balance() * 1000.into(); + let total_payout: BalanceOf = 10000u32.into(); >::insert(current_era, total_payout); - Ok(v_stash) + Ok(v_stash.account()) +} + +fn payout_stakers_( + alive: bool, + n: u32, +) -> Result<(RawOrigin, T::AccountId, u32, BalanceOf), DispatchError> { + let validator = create_validator_with_nominators::( + n, + T::MaxNominatorRewardedPerValidator::get() as u32, + !alive, + )?; + let current_era = CurrentEra::get().unwrap(); + >::insert( + current_era, + validator.clone(), + >::validators(&validator), + ); + let caller = UserBuilder::::default() + .seed(n) + .generate_did() + .build("caller"); + let caller_key = frame_system::Account::::hashed_key_for(&caller.account()); + frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into()); + let balance_before = T::Currency::free_balance(&validator); + Ok((caller.origin(), validator, current_era, balance_before)) } benchmarks! { @@ -112,40 +165,36 @@ benchmarks! { } bond { - let u in ...; - let stash = create_funded_user::("stash", u, 100); - let controller = create_funded_user::("controller", u, 100); - let controller_lookup: ::Source = T::Lookup::unlookup(controller.clone()); + let stash = create_funded_user::("stash", 2, 100); + let controller = create_funded_user::("controller", 5, 100); + let controller_lookup = controller.lookup(); let reward_destination = RewardDestination::Staked; - let amount = T::Currency::minimum_balance() * 10.into(); - }: _(RawOrigin::Signed(stash.clone()), controller_lookup, amount, reward_destination) + }: _(stash.origin(), controller_lookup, 10u32.into(), reward_destination) verify { - assert!(Bonded::::contains_key(stash)); - assert!(Ledger::::contains_key(controller)); + assert!(Bonded::::contains_key(stash.account())); + assert!(Ledger::::contains_key(controller.account())); } bond_extra { - let u in ...; - let (stash, controller) = create_stash_controller::(u, 100)?; - let max_additional = T::Currency::minimum_balance() * 10.into(); - let ledger = Ledger::::get(&controller).ok_or("ledger not created before")?; + let (stash, controller) = create_stash_controller::(5, 1000)?; + let max_additional = 200u32; + let ledger = Ledger::::get(&controller.account()).ok_or("ledger not created before")?; let original_bonded: BalanceOf = ledger.active; - }: _(RawOrigin::Signed(stash), max_additional) + }: _(stash.origin(), max_additional.into()) verify { - let ledger = Ledger::::get(&controller).ok_or("ledger not created after")?; + let ledger = Ledger::::get(&controller.account()).ok_or("ledger not created after")?; let new_bonded: BalanceOf = ledger.active; assert!(original_bonded < new_bonded); } unbond { - let u in ...; - let (_, controller) = create_stash_controller::(u, 100)?; - let amount = T::Currency::minimum_balance() * 10.into(); - let ledger = Ledger::::get(&controller).ok_or("ledger not created before")?; + let (_, controller) = create_stash_controller::(500, 2000)?; + let amount = 20u32; + let ledger = Ledger::::get(&controller.account()).ok_or("ledger not created before")?; let original_bonded: BalanceOf = ledger.active; - }: _(RawOrigin::Signed(controller.clone()), amount) + }: _(controller.origin(), amount.into()) verify { - let ledger = Ledger::::get(&controller).ok_or("ledger not created after")?; + let ledger = Ledger::::get(&controller.account()).ok_or("ledger not created after")?; let new_bonded: BalanceOf = ledger.active; assert!(original_bonded > new_bonded); } @@ -154,16 +203,16 @@ benchmarks! { withdraw_unbonded_update { // Slashing Spans let s in 0 .. MAX_SPANS; - let (stash, controller) = create_stash_controller::(0, 100)?; - add_slashing_spans::(&stash, s); - let amount = T::Currency::minimum_balance() * 5.into(); // Half of total - Staking::::unbond(RawOrigin::Signed(controller.clone()).into(), amount)?; + let (stash, controller) = create_stash_controller::(0, 1000)?; + add_slashing_spans::(&stash.account(), s); + let amount = 50u32; // Half of total + Staking::::unbond(controller.origin().into(), amount.into())?; CurrentEra::put(EraIndex::max_value()); - let ledger = Ledger::::get(&controller).ok_or("ledger not created before")?; + let ledger = Ledger::::get(&controller.account()).ok_or("ledger not created before")?; let original_total: BalanceOf = ledger.total; - }: withdraw_unbonded(RawOrigin::Signed(controller.clone()), s) + }: withdraw_unbonded(controller.origin(), s) verify { - let ledger = Ledger::::get(&controller).ok_or("ledger not created after")?; + let ledger = Ledger::::get(&controller.account()).ok_or("ledger not created after")?; let new_total: BalanceOf = ledger.total; assert!(original_total > new_total); } @@ -172,59 +221,99 @@ benchmarks! { withdraw_unbonded_kill { // Slashing Spans let s in 0 .. MAX_SPANS; - let (stash, controller) = create_stash_controller::(0, 100)?; - add_slashing_spans::(&stash, s); - let amount = T::Currency::minimum_balance() * 10.into(); - Staking::::unbond(RawOrigin::Signed(controller.clone()).into(), amount)?; + let (stash, controller) = create_stash_controller::(0, 1000)?; + add_slashing_spans::(&stash.account(), s); + let amount = 100u32; + Staking::::unbond(controller.origin().into(), amount.into())?; CurrentEra::put(EraIndex::max_value()); - let ledger = Ledger::::get(&controller).ok_or("ledger not created before")?; + let ledger = Ledger::::get(&controller.account()).ok_or("ledger not created before")?; let original_total: BalanceOf = ledger.total; - }: withdraw_unbonded(RawOrigin::Signed(controller.clone()), s) + }: withdraw_unbonded(controller.origin(), s) verify { - assert!(!Ledger::::contains_key(controller)); + assert!(!Ledger::::contains_key(controller.account())); + } + + set_min_bond_threshold { + let origin = RawOrigin::Root; + }: _(origin, 10000u32.into()) + verify { + assert_eq!(Staking::::min_bond_threshold(), 10000u32.into()); + } + + add_permissioned_validator { + let (stash, controller) = create_stash_controller::(5, 100)?; + Staking::::set_validator_count(RawOrigin::Root.into(), 10)?; + }: _(RawOrigin::Root, stash.did(), Some(1)) + verify { + let pref = Staking::::permissioned_identity(stash.did()); + ensure!(pref.is_some(), "fail to add a permissioned identity"); + ensure!(pref.unwrap().intended_count == 1, "fail to set a incorrect intended count"); + } + + remove_permissioned_validator { + let (stash, controller) = create_stash_controller::(5, 100)?; + add_perm_validator::(stash.did(), Some(1)); + }: _(RawOrigin::Root, stash.did()) + verify { + let pref = Staking::::permissioned_identity(stash.did()); + ensure!(pref.is_none(), "fail to remove a permissioned identity"); + } + + set_commission_cap { + let m in 0 .. MAX_ALLOWED_VALIDATORS; + let mut stashes = Vec::with_capacity(m as usize); + // Add validators + for i in 0 .. m { + let stash = create_funded_user::("stash", i, 1000); + stashes.push(stash.account()); + Validators::::insert(stash.account(), ValidatorPrefs { commission: Perbill::from_percent(70)}); + } + }: _(RawOrigin::Root, Perbill::from_percent(50)) + verify { + stashes.iter().for_each(|s| { + assert_eq!(Staking::::validators(s), ValidatorPrefs { commission: Perbill::from_percent(50) }); + }); } validate { - let u in ...; - let (stash, controller) = create_stash_controller::(u, 100)?; + Staking::::set_min_bond_threshold(RawOrigin::Root.into(), 100u32.into())?; + let (stash, controller) = create_stash_controller::(70, 10000)?; + add_perm_validator::(stash.did(), Some(2)); let prefs = ValidatorPrefs::default(); - }: _(RawOrigin::Signed(controller), prefs) + }: _(controller.origin(), prefs) verify { - assert!(Validators::::contains_key(stash)); + assert!(Validators::::contains_key(stash.account())); } // Worst case scenario, MAX_NOMINATIONS nominate { let n in 1 .. MAX_NOMINATIONS as u32; - let (stash, controller) = create_stash_controller::(n + 1, 100)?; - let validators = create_validators::(n, 100)?; - }: _(RawOrigin::Signed(controller), validators) + let (stash, controller) = create_stash_controller::(n + 1, 10000)?; + let validators = create_validators::(n, 1000000)?; + }: _(controller.origin(), validators) verify { - assert!(Nominators::::contains_key(stash)); + assert!(Nominators::::contains_key(stash.account())); } chill { - let u in ...; - let (_, controller) = create_stash_controller::(u, 100)?; - }: _(RawOrigin::Signed(controller)) + let (_, controller) = create_stash_controller::(10, 100)?; + }: _(controller.origin()) set_payee { - let u in ...; - let (stash, controller) = create_stash_controller::(u, 100)?; - assert_eq!(Payee::::get(&stash), RewardDestination::Staked); - }: _(RawOrigin::Signed(controller), RewardDestination::Controller) + let (stash, controller) = create_stash_controller::(10, 100)?; + assert_eq!(Payee::::get(&stash.account()), RewardDestination::Staked); + }: _(controller.origin(), RewardDestination::Controller) verify { - assert_eq!(Payee::::get(&stash), RewardDestination::Controller); + assert_eq!(Payee::::get(&stash.account()), RewardDestination::Controller); } set_controller { - let u in ...; - let (stash, _) = create_stash_controller::(u, 100)?; - let new_controller = create_funded_user::("new_controller", u, 100); - let new_controller_lookup = T::Lookup::unlookup(new_controller.clone()); - }: _(RawOrigin::Signed(stash), new_controller_lookup) + let (stash, _) = create_stash_controller::(10, 100)?; + let new_controller = create_funded_user::("new_controller", 10, 100); + let new_controller_lookup = new_controller.lookup(); + }: _(stash.origin(), new_controller_lookup) verify { - assert!(Ledger::::contains_key(&new_controller)); + assert!(Ledger::::contains_key(&new_controller.account())); } set_validator_count { @@ -234,13 +323,13 @@ benchmarks! { assert_eq!(ValidatorCount::get(), c); } - force_no_eras { let i in 0 .. 1; }: _(RawOrigin::Root) + force_no_eras { }: _(RawOrigin::Root) verify { assert_eq!(ForceEra::get(), Forcing::ForceNone); } - force_new_era {let i in 0 .. 1; }: _(RawOrigin::Root) + force_new_era { }: _(RawOrigin::Root) verify { assert_eq!(ForceEra::get(), Forcing::ForceNew); } - force_new_era_always { let i in 0 .. 1; }: _(RawOrigin::Root) + force_new_era_always { }: _(RawOrigin::Root) verify { assert_eq!(ForceEra::get(), Forcing::ForceAlways); } // Worst case scenario, the list of invulnerables is very long. @@ -258,11 +347,11 @@ benchmarks! { force_unstake { // Slashing Spans let s in 0 .. MAX_SPANS; - let (stash, controller) = create_stash_controller::(0, 100)?; - add_slashing_spans::(&stash, s); - }: _(RawOrigin::Root, stash, s) + let (stash, controller) = create_stash_controller::(0, 1000)?; + add_slashing_spans::(&stash.account(), s); + }: _(RawOrigin::Root, stash.account(), s) verify { - assert!(!Ledger::::contains_key(&controller)); + assert!(!Ledger::::contains_key(&controller.account())); } cancel_deferred_slash { @@ -282,12 +371,8 @@ benchmarks! { payout_stakers { let n in 1 .. T::MaxNominatorRewardedPerValidator::get() as u32; - let validator = create_validator_with_nominators::(n, T::MaxNominatorRewardedPerValidator::get() as u32, true)?; - - let current_era = CurrentEra::get().unwrap(); - let caller = whitelisted_caller(); - let balance_before = T::Currency::free_balance(&validator); - }: _(RawOrigin::Signed(caller), validator.clone(), current_era) + let (origin, validator, current_era, balance_before) = payout_stakers_::(false, n)?; + }: _(origin, validator.clone(), current_era) verify { // Validator has been paid! let balance_after = T::Currency::free_balance(&validator); @@ -296,12 +381,8 @@ benchmarks! { payout_stakers_alive_controller { let n in 1 .. T::MaxNominatorRewardedPerValidator::get() as u32; - let validator = create_validator_with_nominators::(n, T::MaxNominatorRewardedPerValidator::get() as u32, false)?; - - let current_era = CurrentEra::get().unwrap(); - let caller = whitelisted_caller(); - let balance_before = T::Currency::free_balance(&validator); - }: payout_stakers(RawOrigin::Signed(caller), validator.clone(), current_era) + let (origin, validator, current_era, balance_before) = payout_stakers_::(true, n)?; + }: payout_stakers(origin, validator.clone(), current_era) verify { // Validator has been paid! let balance_after = T::Currency::free_balance(&validator); @@ -310,20 +391,20 @@ benchmarks! { rebond { let l in 1 .. MAX_UNLOCKING_CHUNKS as u32; - let (_, controller) = create_stash_controller::(u, 100)?; - let mut staking_ledger = Ledger::::get(controller.clone()).unwrap(); + let (_, controller) = create_stash_controller::(u, 1000)?; + let mut staking_ledger = Ledger::::get(controller.account()).unwrap(); let unlock_chunk = UnlockChunk::> { - value: 1.into(), + value: 1u32.into(), era: EraIndex::zero(), }; for _ in 0 .. l { staking_ledger.unlocking.push(unlock_chunk.clone()) } - Ledger::::insert(controller.clone(), staking_ledger.clone()); + Ledger::::insert(controller.account(), staking_ledger.clone()); let original_bonded: BalanceOf = staking_ledger.active; - }: _(RawOrigin::Signed(controller.clone()), (l + 100).into()) + }: _(controller.origin(), (l + 100).into()) verify { - let ledger = Ledger::::get(&controller).ok_or("ledger not created after")?; + let ledger = Ledger::::get(&controller.account()).ok_or("ledger not created after")?; let new_bonded: BalanceOf = ledger.active; assert!(original_bonded < new_bonded); } @@ -349,11 +430,11 @@ benchmarks! { reap_stash { let s in 1 .. MAX_SPANS; let (stash, controller) = create_stash_controller::(0, 100)?; - add_slashing_spans::(&stash, s); - T::Currency::make_free_balance_be(&stash, 0.into()); - }: _(RawOrigin::Signed(controller), stash.clone(), s) + add_slashing_spans::(&stash.account(), s); + T::Currency::make_free_balance_be(&stash.account(), 0u32.into()); + }: _(controller.origin(), stash.account(), s) verify { - assert!(!Bonded::::contains_key(&stash)); + assert!(!Bonded::::contains_key(&stash.account())); } new_era { @@ -370,26 +451,25 @@ benchmarks! { do_slash { let l in 1 .. MAX_UNLOCKING_CHUNKS as u32; let (stash, controller) = create_stash_controller::(0, 100)?; - let mut staking_ledger = Ledger::::get(controller.clone()).unwrap(); + let mut staking_ledger = Ledger::::get(controller.account()).unwrap(); let unlock_chunk = UnlockChunk::> { - value: 1.into(), + value: 1u32.into(), era: EraIndex::zero(), }; for _ in 0 .. l { staking_ledger.unlocking.push(unlock_chunk.clone()) } - Ledger::::insert(controller, staking_ledger); - let slash_amount = T::Currency::minimum_balance() * 10.into(); - let balance_before = T::Currency::free_balance(&stash); + Ledger::::insert(controller.account(), staking_ledger); + let balance_before = T::Currency::free_balance(&stash.account()); }: { crate::slashing::do_slash::( - &stash, - slash_amount, + &stash.account(), + 10u32.into(), &mut BalanceOf::::zero(), &mut NegativeImbalanceOf::::zero() ); } verify { - let balance_after = T::Currency::free_balance(&stash); + let balance_after = T::Currency::free_balance(&stash.account()); assert!(balance_before > balance_after); } @@ -421,7 +501,7 @@ benchmarks! { ErasRewardPoints::::insert(current_era, reward); // Create reward pool - let total_payout = T::Currency::minimum_balance() * 1000.into(); + let total_payout: BalanceOf = 1000u32.into(); >::insert(current_era, total_payout); let caller: T::AccountId = whitelisted_caller(); @@ -475,14 +555,14 @@ benchmarks! { >::put(ElectionStatus::Open(T::BlockNumber::from(1u32))); let era = >::current_era().unwrap_or(0); - let caller: T::AccountId = account("caller", n, SEED); + let caller = create_funded_user::("caller", n, 10000); // Whitelist caller account from further DB operations. - let caller_key = frame_system::Account::::hashed_key_for(&caller); + let caller_key = frame_system::Account::::hashed_key_for(&caller.account()); frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into()); }: { let result = >::submit_election_solution( - RawOrigin::Signed(caller.clone()).into(), + caller.origin().into(), winners, compact, score.clone(), @@ -539,10 +619,10 @@ benchmarks! { >::put(ElectionStatus::Open(T::BlockNumber::from(1u32))); let era = >::current_era().unwrap_or(0); - let caller: T::AccountId = account("caller", n, SEED); + let caller = create_funded_user::("caller", n, 10000); // Whitelist caller account from further DB operations. - let caller_key = frame_system::Account::::hashed_key_for(&caller); + let caller_key = frame_system::Account::::hashed_key_for(&caller.account()); frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into()); // submit a very bad solution on-chain @@ -552,7 +632,7 @@ benchmarks! { let (winners, compact, score, size) = get_single_winner_solution::(single_winner)?; assert!( >::submit_election_solution( - RawOrigin::Signed(caller.clone()).into(), + caller.origin().into(), winners, compact, score.clone(), @@ -566,7 +646,7 @@ benchmarks! { } }: { let result = >::submit_election_solution( - RawOrigin::Signed(caller.clone()).into(), + caller.origin().into(), winners, compact, score.clone(), @@ -594,11 +674,11 @@ benchmarks! { // needed for the solution to be accepted >::put(ElectionStatus::Open(T::BlockNumber::from(1u32))); - let caller: T::AccountId = account("caller", n, SEED); + let caller = create_funded_user::("caller", n, 10000); let era = >::current_era().unwrap_or(0); // Whitelist caller account from further DB operations. - let caller_key = frame_system::Account::::hashed_key_for(&caller); + let caller_key = frame_system::Account::::hashed_key_for(&caller.account()); frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into()); // submit a seq-phragmen with all the good stuff on chain. @@ -606,7 +686,7 @@ benchmarks! { let (winners, compact, score, size) = get_seq_phragmen_solution::(true); assert!( >::submit_election_solution( - RawOrigin::Signed(caller.clone()).into(), + caller.origin().into(), winners, compact, score.clone(), @@ -624,7 +704,7 @@ benchmarks! { }: { assert!( >::submit_election_solution( - RawOrigin::Signed(caller.clone()).into(), + caller.origin().into(), winners, compact, score.clone(), @@ -633,6 +713,38 @@ benchmarks! { ).is_err() ); } + + change_slashing_allowed_for { + + }: _(RawOrigin::Root, SlashingSwitch::ValidatorAndNominator) + verify { + assert!(Staking::::slashing_allowed_for() == SlashingSwitch::ValidatorAndNominator, "Incorrect value set"); + } + + update_permissioned_validator_intended_count { + let (stash, controller) = create_stash_controller::(5, 100)?; + let stash_id = stash.did(); + add_perm_validator::(stash_id, Some(1)); + }: _(RawOrigin::Root, stash_id, 2) + verify { + assert!(Staking::::permissioned_identity(stash_id).unwrap().intended_count == 2, "Unable to update intended validator count"); + } + + increase_validator_count { + Staking::::set_validator_count(RawOrigin::Root.into(), 10) + .expect("Failed to set the validator count"); + }: _(RawOrigin::Root, 15) + verify { + assert_eq!(Staking::::validator_count(), 25); + } + + scale_validator_count { + Staking::::set_validator_count(RawOrigin::Root.into(), 10) + .expect("Failed to set the validator count"); + }: _(RawOrigin::Root, Percent::from_percent(25)) + verify { + assert_eq!(Staking::::validator_count(), 12); + } } #[cfg(test)] diff --git a/pallets/staking/src/lib.rs b/pallets/staking/src/lib.rs index be586b4203..6d497c0404 100644 --- a/pallets/staking/src/lib.rs +++ b/pallets/staking/src/lib.rs @@ -353,6 +353,8 @@ use sp_std::{ const STAKING_ID: LockIdentifier = *b"staking "; pub const MAX_UNLOCKING_CHUNKS: usize = 32; +/// Maximum number of validators accounted for the weight estimation of `set_commission_cap`. +pub const MAX_ALLOWED_VALIDATORS: u32 = 150; pub const MAX_NOMINATIONS: usize = ::LIMIT; pub(crate) const LOG_TARGET: &str = "staking"; @@ -826,203 +828,43 @@ where type Identity = identity::Module; -pub mod weight { - use super::*; - - /// All weight notes are pertaining to the case of a better solution, in which we execute - /// the longest code path. - /// Weight: 0 + (0.63 μs * v) + (0.36 μs * n) + (96.53 μs * a ) + (8 μs * w ) with: - /// * v validators in snapshot validators, - /// * n nominators in snapshot nominators, - /// * a assignment in the submitted solution - /// * w winners in the submitted solution - /// - /// State reads: - /// - Initial checks: - /// - ElectionState, CurrentEra, QueuedScore - /// - SnapshotValidators.len() + SnapShotNominators.len() - /// - ValidatorCount - /// - SnapshotValidators - /// - SnapshotNominators - /// - Iterate over nominators: - /// - compact.len() * Nominators(who) - /// - (non_self_vote_edges) * SlashingSpans - /// - For `assignment_ratio_to_staked`: Basically read the staked value of each stash. - /// - (winners.len() + compact.len()) * (Ledger + Bonded) - /// - TotalIssuance (read a gzillion times potentially, but well it is cached.) - /// - State writes: - /// - QueuedElected, QueuedScore - pub fn weight_for_submit_solution( - winners: &[ValidatorIndex], - compact: &CompactAssignments, - size: &ElectionSize, - ) -> Weight { - (630 * WEIGHT_PER_NANOS) - .saturating_mul(size.validators as Weight) - .saturating_add((360 * WEIGHT_PER_NANOS).saturating_mul(size.nominators as Weight)) - .saturating_add((96 * WEIGHT_PER_MICROS).saturating_mul(compact.len() as Weight)) - .saturating_add((8 * WEIGHT_PER_MICROS).saturating_mul(winners.len() as Weight)) - // Initial checks - .saturating_add(T::DbWeight::get().reads(8)) - // Nominators - .saturating_add(T::DbWeight::get().reads(compact.len() as Weight)) - // SlashingSpans (upper bound for invalid solution) - .saturating_add(T::DbWeight::get().reads(compact.edge_count() as Weight)) - // `assignment_ratio_to_staked` - .saturating_add( - T::DbWeight::get().reads(2 * ((winners.len() + compact.len()) as Weight)), - ) - .saturating_add(T::DbWeight::get().reads(1)) - // write queued score and elected - .saturating_add(T::DbWeight::get().writes(2)) - } - - /// Weight of `submit_solution` in case of a correct submission. - /// - /// refund: we charged compact.len() * read(1) for SlashingSpans. A valid solution only reads - /// winners.len(). - pub fn weight_for_correct_submit_solution( - winners: &[ValidatorIndex], - compact: &CompactAssignments, - size: &ElectionSize, - ) -> Weight { - // NOTE: for consistency, we re-compute the original weight to maintain their relation and - // prevent any foot-guns. - let original_weight = weight_for_submit_solution::(winners, compact, size); - original_weight - .saturating_sub(T::DbWeight::get().reads(compact.edge_count() as Weight)) - .saturating_add(T::DbWeight::get().reads(winners.len() as Weight)) - } - - /// Weight of `payout_stakers()` & `payout_stakers_by_system()` dispatch. - // TODO: Weight is dummy, Need to benchamrk to get exact weight for the dispatch. - pub fn weight_for_payout_stakers() -> Weight { - T::DbWeight::get().reads(5) * Weight::from(T::MaxNominatorRewardedPerValidator::get() + 1) - + T::DbWeight::get().writes(3) - * Weight::from(T::MaxNominatorRewardedPerValidator::get() + 1) - } -} - pub trait WeightInfo { - fn bond(u: u32) -> Weight; - fn bond_extra(u: u32) -> Weight; - fn unbond(u: u32) -> Weight; + fn bond() -> Weight; + fn bond_extra() -> Weight; + fn unbond() -> Weight; fn withdraw_unbonded_update(s: u32) -> Weight; fn withdraw_unbonded_kill(s: u32) -> Weight; - fn validate(u: u32) -> Weight; + fn set_min_bond_threshold() -> Weight; + fn add_permissioned_validator() -> Weight; + fn remove_permissioned_validator() -> Weight; + fn set_commission_cap(m: u32) -> Weight; + fn validate() -> Weight; fn nominate(n: u32) -> Weight; - fn chill(u: u32) -> Weight; - fn set_payee(u: u32) -> Weight; - fn set_controller(u: u32) -> Weight; - fn set_validator_count(c: u32) -> Weight; - fn force_no_eras(i: u32) -> Weight; - fn force_new_era(i: u32) -> Weight; - fn force_new_era_always(i: u32) -> Weight; + fn chill() -> Weight; + fn set_payee() -> Weight; + fn set_controller() -> Weight; + fn set_validator_count() -> Weight; + fn force_no_eras() -> Weight; + fn force_new_era() -> Weight; + fn force_new_era_always() -> Weight; fn set_invulnerables(v: u32) -> Weight; fn force_unstake(s: u32) -> Weight; fn cancel_deferred_slash(s: u32) -> Weight; fn payout_stakers(n: u32) -> Weight; - fn payout_stakers_alive_controller(n: u32) -> Weight; + fn payout_stakers_alive_controller() -> Weight; fn rebond(l: u32) -> Weight; fn set_history_depth(e: u32) -> Weight; fn reap_stash(s: u32) -> Weight; fn new_era(v: u32, n: u32) -> Weight; fn do_slash(l: u32) -> Weight; fn payout_all(v: u32, n: u32) -> Weight; - fn submit_solution_initial(v: u32, n: u32, a: u32, w: u32) -> Weight; + fn submit_solution_initial(v: u32, a: u32, w: u32) -> Weight; fn submit_solution_better(v: u32, n: u32, a: u32, w: u32) -> Weight; - fn submit_solution_weaker(v: u32, n: u32) -> Weight; + fn submit_solution_weaker(n: u32) -> Weight; fn change_slashing_allowed_for() -> Weight; -} - -impl WeightInfo for () { - fn bond(_u: u32) -> Weight { - 1_000_000_000 - } - fn bond_extra(_u: u32) -> Weight { - 1_000_000_000 - } - fn unbond(_u: u32) -> Weight { - 1_000_000_000 - } - fn withdraw_unbonded_update(_s: u32) -> Weight { - 1_000_000_000 - } - fn withdraw_unbonded_kill(_s: u32) -> Weight { - 1_000_000_000 - } - fn validate(_u: u32) -> Weight { - 1_000_000_000 - } - fn nominate(_n: u32) -> Weight { - 1_000_000_000 - } - fn chill(_u: u32) -> Weight { - 1_000_000_000 - } - fn set_payee(_u: u32) -> Weight { - 1_000_000_000 - } - fn set_controller(_u: u32) -> Weight { - 1_000_000_000 - } - fn set_validator_count(_c: u32) -> Weight { - 1_000_000_000 - } - fn force_no_eras(_i: u32) -> Weight { - 1_000_000_000 - } - fn force_new_era(_i: u32) -> Weight { - 1_000_000_000 - } - fn force_new_era_always(_i: u32) -> Weight { - 1_000_000_000 - } - fn set_invulnerables(_v: u32) -> Weight { - 1_000_000_000 - } - fn force_unstake(_s: u32) -> Weight { - 1_000_000_000 - } - fn cancel_deferred_slash(_s: u32) -> Weight { - 1_000_000_000 - } - fn payout_stakers(_n: u32) -> Weight { - 1_000_000_000 - } - fn payout_stakers_alive_controller(_n: u32) -> Weight { - 1_000_000_000 - } - fn rebond(_l: u32) -> Weight { - 1_000_000_000 - } - fn set_history_depth(_e: u32) -> Weight { - 1_000_000_000 - } - fn reap_stash(_s: u32) -> Weight { - 1_000_000_000 - } - fn new_era(_v: u32, _n: u32) -> Weight { - 1_000_000_000 - } - fn do_slash(_l: u32) -> Weight { - 1_000_000_000 - } - fn payout_all(_v: u32, _n: u32) -> Weight { - 1_000_000_000 - } - fn submit_solution_initial(_v: u32, _n: u32, _a: u32, _w: u32) -> Weight { - 1_000_000_000 - } - fn submit_solution_better(_v: u32, _n: u32, _a: u32, _w: u32) -> Weight { - 1_000_000_000 - } - fn submit_solution_weaker(_v: u32, _n: u32) -> Weight { - 1_000_000_000 - } - fn change_slashing_allowed_for() -> Weight { - 1_000_000_000 - } + fn update_permissioned_validator_intended_count() -> Weight; + fn increase_validator_count() -> Weight; + fn scale_validator_count() -> Weight; } pub trait Trait: @@ -1150,6 +992,9 @@ pub trait Trait: /// Yearly total reward amount that gets distributed when fixed rewards kicks in. type FixedYearlyReward: Get>; + + /// Minimum bond amount. + type MinimumBond: Get>; } /// Mode of era-forcing. @@ -1579,7 +1424,9 @@ decl_error! { /// Running validator count hit the intended count. HitIntendedValidatorCount, /// When the intended number of validators to run is >= 2/3 of `validator_count`. - IntendedCountIsExceedingConsensusLimit + IntendedCountIsExceedingConsensusLimit, + /// When the amount to be bonded is less than `MinimumBond` + BondTooSmall, } } @@ -1657,6 +1504,7 @@ decl_module! { StorageVersion::put(Releases::V6_0_0); } + 1_000 } @@ -1775,7 +1623,7 @@ decl_module! { /// * origin Stash account (signer of the extrinsic). /// * controller Account that controls the operation of stash. /// * payee Destination where reward can be transferred. - #[weight = 67 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(5, 4)] + #[weight = ::WeightInfo::bond()] pub fn bond(origin, controller: ::Source, #[compact] value: BalanceOf, @@ -1783,6 +1631,7 @@ decl_module! { ) { let stash = ensure_signed(origin)?; ensure!(!>::contains_key(&stash), Error::::AlreadyBonded); + ensure!(value >= T::MinimumBond::get() , Error::::BondTooSmall); let controller = T::Lookup::lookup(controller)?; ensure!(!>::contains_key(&controller), Error::::AlreadyPaired); @@ -1844,7 +1693,7 @@ decl_module! { /// # Arguments /// * origin Stash account (signer of the extrinsic). /// * max_additional Extra amount that need to be bonded. - #[weight = 55 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(4, 2)] + #[weight = ::WeightInfo::bond_extra()] pub fn bond_extra(origin, #[compact] max_additional: BalanceOf) { ensure!(Self::era_election_status().is_closed(), Error::::CallNotAllowed); let stash = ensure_signed(origin)?; @@ -1900,7 +1749,7 @@ decl_module! { /// # Arguments /// * origin Controller (Signer of the extrinsic). /// * value Balance needs to be unbonded. - #[weight = 50 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(4, 2)] + #[weight = ::WeightInfo::unbond()] pub fn unbond(origin, #[compact] value: BalanceOf) { ensure!(Self::era_election_status().is_closed(), Error::::CallNotAllowed); let controller = ensure_signed(origin)?; @@ -1942,15 +1791,7 @@ decl_module! { /// - Writes Each: SpanSlash * S /// NOTE: Weight annotation is the kill scenario, we refund otherwise. /// # - #[weight = T::DbWeight::get().reads_writes(6, 6) - .saturating_add(80 * WEIGHT_PER_MICROS) - .saturating_add( - (2 * WEIGHT_PER_MICROS).saturating_mul(Weight::from(*num_slashing_spans)) - ) - .saturating_add(T::DbWeight::get().writes(Weight::from(*num_slashing_spans))) - // if slashing spans is non-zero, add 1 more write - .saturating_add(T::DbWeight::get().writes(Weight::from(*num_slashing_spans).min(1))) - ] + #[weight = ::WeightInfo::withdraw_unbonded_kill(*num_slashing_spans)] pub fn withdraw_unbonded(origin, num_slashing_spans: u32) -> DispatchResultWithPostInfo { ensure!(Self::era_election_status().is_closed(), Error::::CallNotAllowed); let controller = ensure_signed(origin)?; @@ -2004,8 +1845,8 @@ decl_module! { /// - Read: Era Election Status, Ledger /// - Write: Nominators, Validators /// # - #[weight = 17 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(2, 2)] - pub fn validate(origin, prefs: ValidatorPrefs) { + #[weight = ::WeightInfo::validate()] + pub fn validate(origin, prefs: ValidatorPrefs) -> DispatchResult { ensure!(Self::era_election_status().is_closed(), Error::::CallNotAllowed); let controller = ensure_signed(origin)?; let ledger = Self::ledger(&controller).ok_or(Error::::NotController)?; @@ -2027,7 +1868,7 @@ decl_module! { >::remove(stash); >::insert(stash, prefs); } - + Ok(()) } /// Declare the desire to nominate `targets` for the origin controller. @@ -2049,10 +1890,7 @@ decl_module! { /// - Reads: Era Election Status, Ledger, Current Era /// - Writes: Validators, Nominators /// # - #[weight = T::DbWeight::get().reads_writes(3, 2) - .saturating_add(22 * WEIGHT_PER_MICROS) - .saturating_add((360 * WEIGHT_PER_NANOS).saturating_mul(targets.len() as Weight)) - ] + #[weight = ::WeightInfo::nominate(targets.len() as u32)] pub fn nominate(origin, targets: Vec<::Source>) { ensure!(Self::era_election_status().is_closed(), Error::::CallNotAllowed); let controller = ensure_signed(origin)?; @@ -2105,7 +1943,7 @@ decl_module! { /// - Read: EraElectionStatus, Ledger /// - Write: Validators, Nominators /// # - #[weight = 16 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(2, 2)] + #[weight = ::WeightInfo::chill()] pub fn chill(origin) { ensure!(Self::era_election_status().is_closed(), Error::::CallNotAllowed); let controller = ensure_signed(origin)?; @@ -2129,7 +1967,7 @@ decl_module! { /// - Read: Ledger /// - Write: Payee /// # - #[weight = 11 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(1, 1)] + #[weight = ::WeightInfo::set_payee()] pub fn set_payee(origin, payee: RewardDestination) { let controller = ensure_signed(origin)?; let ledger = Self::ledger(&controller).ok_or(Error::::NotController)?; @@ -2153,7 +1991,7 @@ decl_module! { /// - Read: Bonded, Ledger New Controller, Ledger Old Controller /// - Write: Bonded, Ledger New Controller, Ledger Old Controller /// # - #[weight = 25 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(3, 3)] + #[weight = ::WeightInfo::set_controller()] pub fn set_controller(origin, controller: ::Source) { let stash = ensure_signed(origin)?; let old_controller = Self::bonded(&stash).ok_or(Error::::NotStash)?; @@ -2175,7 +2013,7 @@ decl_module! { /// Base Weight: 1.717 µs /// Write: Validator Count /// # - #[weight = 2 * WEIGHT_PER_MICROS + T::DbWeight::get().writes(1)] + #[weight = ::WeightInfo::set_validator_count()] fn set_validator_count(origin, #[compact] new: u32) { ensure_root(origin)?; ValidatorCount::put(new); @@ -2189,7 +2027,7 @@ decl_module! { /// Base Weight: 1.717 µs /// Read/Write: Validator Count /// # - #[weight = 2 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(1, 1)] + #[weight = ::WeightInfo::increase_validator_count()] fn increase_validator_count(origin, #[compact] additional: u32) { ensure_root(origin)?; ValidatorCount::mutate(|n| *n += additional); @@ -2203,7 +2041,7 @@ decl_module! { /// Base Weight: 1.717 µs /// Read/Write: Validator Count /// # - #[weight = 2 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(1, 1)] + #[weight = ::WeightInfo::scale_validator_count()] fn scale_validator_count(origin, factor: Percent) { ensure_root(origin)?; ValidatorCount::mutate(|n| *n += factor * *n); @@ -2217,7 +2055,7 @@ decl_module! { /// * origin Required origin for adding a potential validator. /// * identity Validator's IdentityId. /// * intended_count No. of validators given identity intends to run. - #[weight = 750_000_000] + #[weight = ::WeightInfo::add_permissioned_validator()] pub fn add_permissioned_validator(origin, identity: IdentityId, intended_count: Option) { T::RequiredAddOrigin::ensure_origin(origin)?; ensure!(Self::permissioned_identity(&identity).is_none(), Error::::AlreadyExists); @@ -2244,7 +2082,7 @@ decl_module! { /// # Arguments /// * origin Required origin for removing a potential validator. /// * identity Validator's IdentityId. - #[weight = 750_000_000] + #[weight = ::WeightInfo::remove_permissioned_validator()] pub fn remove_permissioned_validator(origin, identity: IdentityId) { T::RequiredRemoveOrigin::ensure_origin(origin)?; ensure!(Self::permissioned_identity(&identity).is_some(), Error::::NotExists); @@ -2310,7 +2148,7 @@ decl_module! { /// /// # Arguments /// * `new_cap` the new commission cap. - #[weight = (800_000_000, Operational, Pays::Yes)] + #[weight = (::WeightInfo::set_commission_cap(MAX_ALLOWED_VALIDATORS), Operational, Pays::Yes)] pub fn set_commission_cap(origin, new_cap: Perbill) { T::RequiredCommissionOrigin::ensure_origin(origin.clone())?; @@ -2328,14 +2166,11 @@ decl_module! { /// /// # Arguments /// * `new_value` the new minimum - #[weight = (750_000_000, Operational, Pays::Yes)] + #[weight = (::WeightInfo::set_min_bond_threshold(), Operational, Pays::Yes)] pub fn set_min_bond_threshold(origin, new_value: BalanceOf) { T::RequiredCommissionOrigin::ensure_origin(origin.clone())?; - let key = ensure_signed(origin)?; - let id = >::get_identity(&key); - >::put(new_value); - Self::deposit_event(RawEvent::MinimumBondThresholdUpdated(id, new_value)); + Self::deposit_event(RawEvent::MinimumBondThresholdUpdated(Some(GC_DID), new_value)); } /// Force there to be no new eras indefinitely. @@ -2347,7 +2182,7 @@ decl_module! { /// - Base Weight: 1.857 µs /// - Write: ForceEra /// # - #[weight = 2 * WEIGHT_PER_MICROS + T::DbWeight::get().writes(1)] + #[weight = ::WeightInfo::force_no_eras()] fn force_no_eras(origin) { ensure_root(origin)?; ForceEra::put(Forcing::ForceNone); @@ -2363,7 +2198,7 @@ decl_module! { /// - Base Weight: 1.959 µs /// - Write ForceEra /// # - #[weight = 2 * WEIGHT_PER_MICROS + T::DbWeight::get().writes(1)] + #[weight = ::WeightInfo::force_new_era()] fn force_new_era(origin) { ensure_root(origin)?; ForceEra::put(Forcing::ForceNew); @@ -2378,10 +2213,7 @@ decl_module! { /// - Base Weight: 2.208 + .006 * V µs /// - Write: Invulnerables /// # - #[weight = T::DbWeight::get().writes(1) - .saturating_add(2 * WEIGHT_PER_MICROS) - .saturating_add((6 * WEIGHT_PER_NANOS).saturating_mul(validators.len() as Weight)) - ] + #[weight = ::WeightInfo::set_invulnerables(validators.len() as u32)] fn set_invulnerables(origin, validators: Vec) { ensure_root(origin)?; >::put(validators); @@ -2398,15 +2230,7 @@ decl_module! { /// Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators, Account, Locks /// Writes Each: SpanSlash * S /// # - #[weight = T::DbWeight::get().reads_writes(4, 7) - .saturating_add(53 * WEIGHT_PER_MICROS) - .saturating_add( - WEIGHT_PER_MICROS.saturating_mul(2).saturating_mul(Weight::from(*num_slashing_spans)) - ) - .saturating_add(T::DbWeight::get().writes(Weight::from(*num_slashing_spans))) - // if slashing spans is non-zero, add 1 more write - .saturating_add(T::DbWeight::get().writes(Weight::from(*num_slashing_spans > 0))) - ] + #[weight = ::WeightInfo::force_unstake(*num_slashing_spans)] pub fn force_unstake(origin, stash: T::AccountId, num_slashing_spans: u32) { ensure_root(origin)?; @@ -2425,7 +2249,7 @@ decl_module! { /// - Base Weight: 2.05 µs /// - Write: ForceEra /// # - #[weight = 2 * WEIGHT_PER_MICROS + T::DbWeight::get().writes(1)] + #[weight = ::WeightInfo::force_new_era_always()] pub fn force_new_era_always(origin) { ensure_root(origin)?; ForceEra::put(Forcing::ForceAlways); @@ -2445,10 +2269,7 @@ decl_module! { /// - Read: Unapplied Slashes /// - Write: Unapplied Slashes /// # - #[weight = T::DbWeight::get().reads_writes(1, 1) - .saturating_add(5_870 * WEIGHT_PER_MICROS) - .saturating_add((35 * WEIGHT_PER_MICROS).saturating_mul(slash_indices.len() as Weight)) - ] + #[weight = ::WeightInfo::cancel_deferred_slash(slash_indices.len() as u32)] pub fn cancel_deferred_slash(origin, era: EraIndex, slash_indices: Vec) { T::SlashCancelOrigin::ensure_origin(origin)?; @@ -2495,7 +2316,7 @@ decl_module! { /// - Read Each: Bonded, Ledger, Payee, Locks, System Account (5 items) /// - Write Each: System Account, Locks, Ledger (3 items) /// # - #[weight = weight::weight_for_payout_stakers::()] + #[weight = ::WeightInfo::payout_stakers(T::MaxNominatorRewardedPerValidator::get() as u32)] pub fn payout_stakers(origin, validator_stash: T::AccountId, era: EraIndex) -> DispatchResult { ensure!(Self::era_election_status().is_closed(), Error::::CallNotAllowed); ensure_signed(origin)?; @@ -2517,11 +2338,7 @@ decl_module! { /// - Reads: EraElectionStatus, Ledger, Locks, [Origin Account] /// - Writes: [Origin Account], Locks, Ledger /// # - #[weight = - 35 * WEIGHT_PER_MICROS - + 50 * WEIGHT_PER_NANOS * (MAX_UNLOCKING_CHUNKS as Weight) - + T::DbWeight::get().reads_writes(3, 2) - ] + #[weight = ::WeightInfo::rebond(MAX_UNLOCKING_CHUNKS as u32)] pub fn rebond(origin, #[compact] value: BalanceOf) -> DispatchResultWithPostInfo { ensure!(Self::era_election_status().is_closed(), Error::::CallNotAllowed); let controller = ensure_signed(origin)?; @@ -2558,12 +2375,7 @@ decl_module! { /// - Clear Prefix Each: Era Stakers, EraStakersClipped, ErasValidatorPrefs /// - Writes Each: ErasValidatorReward, ErasRewardPoints, ErasTotalStake, ErasStartSessionIndex /// # - #[weight = { - let items = Weight::from(*_era_items_deleted); - T::DbWeight::get().reads_writes(2, 1) - .saturating_add(T::DbWeight::get().reads_writes(items, items)) - - }] + #[weight = ::WeightInfo::set_history_depth(*_era_items_deleted)] pub fn set_history_depth(origin, #[compact] new_history_depth: EraIndex, #[compact] _era_items_deleted: u32, @@ -2597,15 +2409,7 @@ decl_module! { /// - Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators, Stash Account, Locks /// - Writes Each: SpanSlash * S /// # - #[weight = T::DbWeight::get().reads_writes(4, 7) - .saturating_add(76 * WEIGHT_PER_MICROS) - .saturating_add( - WEIGHT_PER_MICROS.saturating_mul(2).saturating_mul(Weight::from(*num_slashing_spans)) - ) - .saturating_add(T::DbWeight::get().writes(Weight::from(*num_slashing_spans))) - // if slashing spans is non-zero, add 1 more write - .saturating_add(T::DbWeight::get().writes(Weight::from(*num_slashing_spans).min(1))) - ] + #[weight = ::WeightInfo::reap_stash(*num_slashing_spans)] pub fn reap_stash(_origin, stash: T::AccountId, num_slashing_spans: u32) { ensure!(T::Currency::total_balance(&stash).is_zero(), Error::::FundedTarget); Self::kill_stash(&stash, num_slashing_spans)?; @@ -2659,7 +2463,12 @@ decl_module! { /// # /// See `crate::weight` module. /// # - #[weight = weight::weight_for_submit_solution::(winners, compact, size)] + #[weight = ::WeightInfo::submit_solution_better( + size.validators.into(), + size.nominators.into(), + compact.len() as u32, + winners.len() as u32, + )] pub fn submit_election_solution( origin, winners: Vec, @@ -2688,7 +2497,12 @@ decl_module! { /// # /// See `crate::weight` module. /// # - #[weight = weight::weight_for_submit_solution::(winners, compact, size)] + #[weight = ::WeightInfo::submit_solution_better( + size.validators.into(), + size.nominators.into(), + compact.len() as u32, + winners.len() as u32, + )] pub fn submit_election_solution_unsigned( origin, winners: Vec, @@ -2716,7 +2530,7 @@ decl_module! { // Polymesh-note: Change it from `ensure_signed` to `ensure_root` in the favour of reward scheduling. /// System version of `payout_stakers()`. Only be called by the root origin. - #[weight = weight::weight_for_payout_stakers::()] + #[weight = ::WeightInfo::payout_stakers(T::MaxNominatorRewardedPerValidator::get() as u32)] pub fn payout_stakers_by_system(origin, validator_stash: T::AccountId, era: EraIndex) -> DispatchResult { ensure!(Self::era_election_status().is_closed(), Error::::CallNotAllowed); ensure_root(origin)?; @@ -2728,7 +2542,7 @@ decl_module! { /// # Arguments /// * origin - AccountId of root. /// * slashing_switch - Switch used to set the targets for slashing. - #[weight = 5_000_000 + T::DbWeight::get().reads_writes(2, 1)] + #[weight = ::WeightInfo::change_slashing_allowed_for()] pub fn change_slashing_allowed_for(origin, slashing_switch: SlashingSwitch) { // Ensure origin should be root. ensure_root(origin)?; @@ -2742,7 +2556,7 @@ decl_module! { /// * origin which must be the required origin for adding a potential validator. /// * identity to add as a validator. /// * new_intended_count New value of intended count. - #[weight = 150_000_000] + #[weight = ::WeightInfo::update_permissioned_validator_intended_count()] pub fn update_permissioned_validator_intended_count(origin, identity: IdentityId, new_intended_count: u32) -> DispatchResult { T::RequiredAddOrigin::ensure_origin(origin)?; ensure!(Self::get_allowed_validator_count() > new_intended_count, Error::::IntendedCountIsExceedingConsensusLimit); @@ -3067,13 +2881,6 @@ impl Module { ) -> DispatchResultWithPostInfo { // Do the basic checks. era, claimed score and window open. Self::pre_dispatch_checks(claimed_score, era)?; - // the weight that we will refund in case of a correct submission. We compute this now - // because the data needed for it will be consumed further down. - let adjusted_weight = weight::weight_for_correct_submit_solution::( - &winners, - &compact_assignments, - &election_size, - ); // Check that the number of presented winners is sane. Most often we have more candidates // than we need. Then it should be `Self::validator_count()`. Else it should be all the @@ -3247,7 +3054,7 @@ impl Module { // emit event. Self::deposit_event(RawEvent::SolutionStored(compute)); - Ok(Some(adjusted_weight).into()) + Ok(None.into()) } /// Start a session potentially starting an era. @@ -3341,7 +3148,7 @@ impl Module { let rest = max_payout.saturating_sub(validator_payout); // Schedule Rewards for the validators - let next_block_no = >::block_number() + 1.into(); + let next_block_no = >::block_number() + 1u32.into(); for (index, validator_id) in T::SessionInterface::validators().into_iter().enumerate() { let schedule_block_no = next_block_no + index.saturated_into::(); match T::RewardScheduler::schedule( diff --git a/pallets/staking/src/testing_utils.rs b/pallets/staking/src/testing_utils.rs index cedeff09d3..85e89593e6 100644 --- a/pallets/staking/src/testing_utils.rs +++ b/pallets/staking/src/testing_utils.rs @@ -22,66 +22,91 @@ use crate::Module as Staking; use crate::*; use frame_benchmarking::account; use frame_system::RawOrigin; +use polymesh_common_utilities::benchs::{User, UserBuilder}; +use polymesh_primitives::{AuthorizationData, Permissions, Signatory}; use rand_chacha::{ rand_core::{RngCore, SeedableRng}, ChaChaRng, }; use sp_io::hashing::blake2_256; use sp_npos_elections::*; +use sp_runtime::DispatchError; const SEED: u32 = 0; -/// Grab a funded user. -pub fn create_funded_user( - string: &'static str, - n: u32, - balance_factor: u32, -) -> T::AccountId { - let user = account(string, n, SEED); - let balance = T::Currency::minimum_balance() * balance_factor.into(); - T::Currency::make_free_balance_be(&user, balance); +/// Grab a funded user with the given balance. +pub fn create_funded_user(string: &'static str, n: u32, balance: u32) -> User { + let user = UserBuilder::::default() + .balance(balance) + .seed(n) + .generate_did() + .build(string); // ensure T::CurrencyToVote will work correctly. - T::Currency::issue(balance); + T::Currency::issue(balance.into()); user } +pub fn create_stash_controller_with_balance( + n: u32, + balance: u32, +) -> Result<(User, User), DispatchError> { + let (s, c) = create_stash_controller::(n, balance)?; + let _ = T::Balances::make_free_balance_be(&c.account(), balance.into()); + T::Currency::issue(balance.into()); + Ok((s, c)) +} + /// Create a stash and controller pair. +/// Both accounts are created with the given balance and with DID. pub fn create_stash_controller( n: u32, - balance_factor: u32, -) -> Result<(T::AccountId, T::AccountId), &'static str> { - let stash = create_funded_user::("stash", n, balance_factor); - let controller = create_funded_user::("controller", n, balance_factor); - let controller_lookup: ::Source = - T::Lookup::unlookup(controller.clone()); - let reward_destination = RewardDestination::Staked; - let amount = T::Currency::minimum_balance() * (balance_factor / 10).max(1).into(); - Staking::::bond( - RawOrigin::Signed(stash.clone()).into(), - controller_lookup, - amount, - reward_destination, - )?; - return Ok((stash, controller)); + balance: u32, +) -> Result<(User, User), DispatchError> { + _create_stash_controller::(n, balance, RewardDestination::Staked, false) } -/// Create a stash and controller pair, where the controller is dead, and payouts go to controller. -/// This is used to test worst case payout scenarios. -pub fn create_stash_and_dead_controller( +pub fn create_stash_with_dead_controller( n: u32, - balance_factor: u32, -) -> Result<(T::AccountId, T::AccountId), &'static str> { - let stash = create_funded_user::("stash", n, balance_factor); - // controller has no funds - let controller = create_funded_user::("controller", n, 0); - let controller_lookup: ::Source = - T::Lookup::unlookup(controller.clone()); - let reward_destination = RewardDestination::Controller; - let amount = T::Currency::minimum_balance() * (balance_factor / 10).max(1).into(); + balance: u32, +) -> Result<(User, User), DispatchError> { + _create_stash_controller::(n, balance, RewardDestination::Controller, true) +} + +fn _create_stash_controller( + n: u32, + balance: u32, + reward_destination: RewardDestination, + dead: bool, +) -> Result<(User, User), DispatchError> { + let stash = create_funded_user::("stash", n, balance); + let controller = if dead { + let acc: T::AccountId = account("controller", n, 100); + User { + account: acc.clone(), + origin: RawOrigin::Signed(acc), + did: None, + secret: None, + uid: None, + } + } else { + UserBuilder::::default() + .balance(balance) + .seed(n) + .build("controller") + }; + // Attach the controller key as the secondary key to the stash. + let auth_id = >::add_auth( + stash.did(), + Signatory::Account(controller.account()), + AuthorizationData::JoinIdentity(Permissions::default()), + None, + ); + >::join_identity_as_key(controller.origin().into(), auth_id)?; + let controller_lookup = controller.lookup(); Staking::::bond( - RawOrigin::Signed(stash.clone()).into(), + stash.origin().into(), controller_lookup, - amount, + (balance / 10u32).into(), reward_destination, )?; return Ok((stash, controller)); @@ -93,18 +118,30 @@ pub fn create_validators( balance_factor: u32, ) -> Result::Source>, &'static str> { let mut validators: Vec<::Source> = Vec::with_capacity(max as usize); + emulate_validator_setup::(1, 10, Perbill::from_percent(50)); for i in 0..max { let (stash, controller) = create_stash_controller::(i, balance_factor)?; let validator_prefs = ValidatorPrefs { commission: Perbill::from_percent(50), }; - Staking::::validate(RawOrigin::Signed(controller).into(), validator_prefs)?; - let stash_lookup: ::Source = T::Lookup::unlookup(stash); + Staking::::add_permissioned_validator(RawOrigin::Root.into(), stash.did(), Some(2)) + .expect("Failed to add permissioned validator"); + Staking::::validate(controller.origin().into(), validator_prefs)?; + let stash_lookup = stash.lookup(); validators.push(stash_lookup); } Ok(validators) } +pub fn emulate_validator_setup(min_bond: u32, validator_count: u32, cap: Perbill) { + Staking::::set_min_bond_threshold(RawOrigin::Root.into(), min_bond.into()) + .expect("Failed to set the min bond threshold"); + Staking::::set_validator_count(RawOrigin::Root.into(), validator_count) + .expect("Failed to set the validator count"); + Staking::::set_commission_cap(RawOrigin::Root.into(), cap) + .expect("Failed to set the validator commission cap"); +} + /// This function generates validators and nominators who are randomly nominating /// `edge_per_nominator` random validators (until `to_nominate` if provided). /// @@ -127,7 +164,7 @@ pub fn create_validators_with_nominators_for_era( let mut validators_stash: Vec<::Source> = Vec::with_capacity(validators as usize); let mut rng = ChaChaRng::from_seed(SEED.using_encoded(blake2_256)); - + emulate_validator_setup::(1, 10, Perbill::from_percent(50)); // Create validators for i in 0..validators { let balance_factor = if randomize_stake { @@ -139,13 +176,10 @@ pub fn create_validators_with_nominators_for_era( let validator_prefs = ValidatorPrefs { commission: Perbill::from_percent(50), }; - Staking::::validate( - RawOrigin::Signed(v_controller.clone()).into(), - validator_prefs, - )?; - let stash_lookup: ::Source = - T::Lookup::unlookup(v_stash.clone()); - validators_stash.push(stash_lookup.clone()); + Staking::::add_permissioned_validator(RawOrigin::Root.into(), v_stash.did(), Some(2)) + .expect("Failed to add permissioned validator"); + Staking::::validate(v_controller.origin().into(), validator_prefs)?; + validators_stash.push(v_stash.lookup()); } let to_nominate = to_nominate.unwrap_or(validators_stash.len() as u32) as usize; @@ -171,10 +205,7 @@ pub fn create_validators_with_nominators_for_era( let validator = available_validators.remove(selected); selected_validators.push(validator); } - Staking::::nominate( - RawOrigin::Signed(n_controller.clone()).into(), - selected_validators, - )?; + Staking::::nominate(n_controller.origin().into(), selected_validators)?; } ValidatorCount::put(validators); diff --git a/pallets/statistics/Cargo.toml b/pallets/statistics/Cargo.toml index cdf74adcb5..20a5515719 100644 --- a/pallets/statistics/Cargo.toml +++ b/pallets/statistics/Cargo.toml @@ -14,24 +14,24 @@ serde_derive = { version = "1.0.112", optional = true, default-features = false} # Substrate codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Only in STD -substrate-test-runtime-client = { git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } # Only in Benchmarks -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0", optional = true } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1", optional = true } [dev-dependencies] lazy_static = "1.4.0" @@ -41,6 +41,7 @@ equalize = [] default = ["std", "equalize"] no_std = [] only-staking = [] +running-ci = [] std = [ "substrate-test-runtime-client", "serde_derive", diff --git a/pallets/statistics/src/benchmarking.rs b/pallets/statistics/src/benchmarking.rs index a3adf9e6ba..3a7f74a8e3 100644 --- a/pallets/statistics/src/benchmarking.rs +++ b/pallets/statistics/src/benchmarking.rs @@ -1,10 +1,8 @@ use crate::*; use core::convert::TryFrom; use frame_benchmarking::benchmarks; -use polymesh_common_utilities::{ - asset::AssetType, - benchs::{User, UserBuilder}, -}; +use polymesh_common_utilities::benchs::{User, UserBuilder}; +use polymesh_primitives::asset::AssetType; use sp_std::prelude::*; /// Create a new token with name `name` on behalf of `owner`. @@ -15,7 +13,7 @@ pub fn make_token(owner: &User, name: Vec) -> Ticker { owner.origin.clone().into(), name.into(), ticker.clone(), - 1_000_000.into(), + 1_000_000u32.into(), true, AssetType::default(), Vec::new(), @@ -32,20 +30,34 @@ fn init_ticker() -> (User, Ticker) { (owner, ticker) } -fn init_ctm() -> (User, Ticker, Vec) { +fn init_ctm( + max_transfer_manager_per_asset: u32, +) -> (User, Ticker, Vec) { let (owner, ticker) = init_ticker::(); - let tms = (0..T::MaxTransferManagersPerAsset::get()) + let tms = (0..max_transfer_manager_per_asset) .map(|x| TransferManager::CountTransferManager(x.into())) .collect::>(); ActiveTransferManagers::insert(ticker, tms.clone()); (owner, ticker, tms) } +#[cfg(feature = "running-ci")] +mod limits { + pub const MAX_EXEMPTED_IDENTITIES: u32 = 10; +} + +#[cfg(not(feature = "running-ci"))] +mod limits { + pub const MAX_EXEMPTED_IDENTITIES: u32 = 1000; +} + benchmarks! { _ {} add_transfer_manager { - let (owner, ticker, mut tms) = init_ctm::(); + let max_tm = T::MaxTransferManagersPerAsset::get().saturating_sub(1); + let (owner, ticker, mut tms) = init_ctm::(max_tm); + let last_tm = TransferManager::CountTransferManager(420); tms.push(last_tm.clone()); }: _(owner.origin, ticker, last_tm) @@ -54,8 +66,8 @@ benchmarks! { } remove_transfer_manager { - let (owner, ticker, mut tms) = init_ctm::(); - let last_tm = tms.pop().unwrap(); + let (owner, ticker, mut tms) = init_ctm::(T::MaxTransferManagersPerAsset::get()); + let last_tm = tms.pop().expect("MaxTransferManagersPerAsset should be greater than zero"); }: _(owner.origin, ticker, last_tm) verify { assert!(Module::::transfer_managers(ticker) == tms); @@ -63,7 +75,7 @@ benchmarks! { add_exempted_entities { // Length of the vector of Exempted identities being added. - let i in 0 .. 1000; + let i in 0 .. limits::MAX_EXEMPTED_IDENTITIES; let (owner, ticker) = init_ticker::(); let scope_ids = (0..i as u128).map(IdentityId::from).collect::>(); @@ -76,7 +88,7 @@ benchmarks! { remove_exempted_entities { // Length of the vector of Exempted identities being removed. - let i in 0 .. 1000; + let i in 0 .. limits::MAX_EXEMPTED_IDENTITIES; let (owner, ticker) = init_ticker::(); let tm = TransferManager::CountTransferManager(420); @@ -110,10 +122,10 @@ benchmarks! { &ticker, owner_did, owner_did, - 100.into(), - 200.into(), - 0.into(), - 500.into(), + 100u32.into(), + 200u32.into(), + 0u32.into(), + 500u32.into(), )?; } } diff --git a/pallets/statistics/src/lib.rs b/pallets/statistics/src/lib.rs index fcf8d53fe3..610c896805 100644 --- a/pallets/statistics/src/lib.rs +++ b/pallets/statistics/src/lib.rs @@ -22,7 +22,7 @@ use frame_support::{ decl_error, decl_event, decl_module, decl_storage, dispatch::DispatchResult, ensure, traits::Get, weights::Weight, }; -use polymesh_common_utilities::{asset::Trait as AssetTrait, identity::Trait as IdentityTrait}; +use polymesh_common_utilities::{asset::AssetFnTrait, identity::Trait as IdentityTrait}; use polymesh_primitives::{IdentityId, ScopeId, Ticker}; use sp_arithmetic::Permill; #[cfg(feature = "std")] @@ -47,7 +47,7 @@ pub trait Trait: frame_system::Trait + IdentityTrait { /// The overarching event type. type Event: From + Into<::Event>; /// Asset module - type Asset: AssetTrait; + type Asset: AssetFnTrait; /// Maximum transfer managers that can be enabled for an Asset type MaxTransferManagersPerAsset: Get; /// Weights for extrinsics @@ -99,6 +99,8 @@ decl_module! { /// * `DuplicateTransferManager` if `new_transfer_manager` is already enabled for the ticker. /// * `TransferManagersLimitReached` if the `ticker` already has max TMs attached /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::add_transfer_manager()] pub fn add_transfer_manager(origin, ticker: Ticker, new_transfer_manager: TransferManager) { let did = T::Asset::ensure_perms_owner_asset(origin, &ticker)?; @@ -122,6 +124,8 @@ decl_module! { /// * `Unauthorized` if `origin` is not the owner of the ticker. /// * `TransferManagerMissing` if `asset_compliance` contains multiple entries with the same `requirement_id`. /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::remove_transfer_manager()] pub fn remove_transfer_manager(origin, ticker: Ticker, transfer_manager: TransferManager) { let did = T::Asset::ensure_perms_owner_asset(origin, &ticker)?; @@ -145,6 +149,8 @@ decl_module! { /// # Errors /// * `Unauthorized` if `origin` is not the owner of the ticker. /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::add_exempted_entities(exempted_entities.len() as u32)] pub fn add_exempted_entities(origin, ticker: Ticker, transfer_manager: TransferManager, exempted_entities: Vec) { let did = T::Asset::ensure_perms_owner_asset(origin, &ticker)?; @@ -166,6 +172,8 @@ decl_module! { /// # Errors /// * `Unauthorized` if `origin` is not the owner of the ticker. /// + /// # Permissions + /// * Asset #[weight = ::WeightInfo::remove_exempted_entities(entities.len() as u32)] pub fn remove_exempted_entities(origin, ticker: Ticker, transfer_manager: TransferManager, entities: Vec) { let did = T::Asset::ensure_perms_owner_asset(origin, &ticker)?; @@ -208,7 +216,7 @@ impl Module { // Only updates extrinsics if counter has been changed. if new_counter != counter { - ::insert(ticker, new_counter) + InvestorCountPerAsset::insert(ticker, new_counter) } } } @@ -290,6 +298,11 @@ impl Module { ); Ok(()) } + + #[cfg(feature = "runtime-benchmarks")] + pub fn set_investor_count(ticker: &Ticker, count: Counter) { + InvestorCountPerAsset::insert(ticker, count); + } } decl_event!( diff --git a/pallets/sto/Cargo.toml b/pallets/sto/Cargo.toml index 7e0b62c941..8c800f2d4f 100644 --- a/pallets/sto/Cargo.toml +++ b/pallets/sto/Cargo.toml @@ -7,6 +7,7 @@ edition = "2018" [dependencies] pallet-asset = { path = "../asset", default-features = false } pallet-balances = { path = "../balances", default-features = false } +pallet-compliance-manager = { path = "../compliance-manager", default-features = false } pallet-identity = { path = "../identity", default-features = false } pallet-permissions = { path = "../permissions", default-features = false } pallet-portfolio = { path = "../portfolio", default-features = false } @@ -19,17 +20,20 @@ serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-serializer = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-serializer = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } + +# Only in STD +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } [features] equalize = [] @@ -48,6 +52,7 @@ std = [ "sp-api/std", "frame-system/std", "frame-support/std", + "frame-benchmarking/std", "polymesh-common-utilities/std", "pallet-balances/std", "polymesh-primitives/std", @@ -56,3 +61,6 @@ std = [ "pallet-settlement/std", "pallet-timestamp/std" ] +runtime-benchmarks = [ + "frame-benchmarking" +] diff --git a/pallets/sto/src/benchmarking.rs b/pallets/sto/src/benchmarking.rs new file mode 100644 index 0000000000..02b638313e --- /dev/null +++ b/pallets/sto/src/benchmarking.rs @@ -0,0 +1,206 @@ +use crate::*; +use frame_benchmarking::benchmarks; +use frame_support::traits::Get; +use pallet_settlement::{ + benchmarking::{add_transfer_managers, compliance_setup}, + VenueDetails, +}; +use polymesh_common_utilities::benchs::{make_asset, User, UserBuilder}; +use polymesh_primitives::TrustedIssuer; + +const OFFERING_TICKER: Ticker = Ticker::repeating(b'A'); +const RAISE_TICKER: Ticker = Ticker::repeating(b'B'); + +pub type Asset = pallet_asset::Module; +pub type ComplianceManager = pallet_compliance_manager::Module; +pub type Identity = identity::Module; +pub type Timestamp = pallet_timestamp::Module; +pub type Settlement = pallet_settlement::Module; +pub type Sto = crate::Module; + +fn create_assets_and_compliance( + from: &User, + to: &User, + offering_ticker: Ticker, + raise_ticker: Ticker, + complexity: u32, + transfer_managers: u32, +) -> DispatchResult { + let t_issuer = UserBuilder::::default() + .generate_did() + .build("TrustedClaimIssuer"); + let trusted_issuer = TrustedIssuer::from(t_issuer.did()); + let setup = |a: &User, + b: &User, + ticker: Ticker, + complexity: u32, + transfer_managers: u32| + -> DispatchResult { + make_asset::(a, Some(ticker))?; + compliance_setup::( + complexity, + ticker, + a.origin(), + a.did(), + b.did(), + trusted_issuer.clone(), + ); + add_transfer_managers::(ticker, a.origin(), a.did(), transfer_managers); + Ok(()) + }; + + setup(from, to, offering_ticker, complexity, transfer_managers)?; + setup(to, from, raise_ticker, complexity, transfer_managers)?; + + Ok(()) +} + +fn generate_tiers(n: u32) -> Vec> { + let n = n as usize; + let mut tiers = Vec::with_capacity(n); + for i in 0..n { + tiers.push(PriceTier { + total: 1u32.into(), + price: (i as u128 + 1).into(), + }) + } + tiers +} + +fn create_venue(user: &User) -> Result { + let venue_id = >::venue_counter(); + >::create_venue( + user.origin().into(), + VenueDetails::default(), + vec![user.account()], + VenueType::Sto, + )?; + Ok(venue_id) +} + +struct UserWithPortfolio { + user: User, + portfolio: PortfolioId, +} + +fn setup_fundraiser( + complexity: u32, + tiers: u32, + transfer_managers: u32, +) -> Result<(UserWithPortfolio, UserWithPortfolio), DispatchError> { + let alice = user::("alice"); + let bob = user::("bob"); + + create_assets_and_compliance::( + &alice.user, + &bob.user, + OFFERING_TICKER, + RAISE_TICKER, + complexity, + transfer_managers, + )?; + + let venue_id = create_venue(&alice.user)?; + + >::create_fundraiser( + alice.user.origin().into(), + alice.portfolio, + OFFERING_TICKER, + alice.portfolio, + RAISE_TICKER, + generate_tiers::(tiers), + venue_id, + None, + Some(101u32.into()), + 0u32.into(), + vec![].into(), + )?; + + Ok((alice, bob)) +} + +fn user(name: &'static str) -> UserWithPortfolio { + let user = >::default().generate_did().build(name); + let portfolio = PortfolioId::default_portfolio(user.did()); + UserWithPortfolio { user, portfolio } +} + +benchmarks! { + _ {} + + create_fundraiser { + // Number of tiers + let i in 1 .. MAX_TIERS as u32; + + let alice = user::("alice"); + + create_assets_and_compliance::(&alice.user, &alice.user, OFFERING_TICKER, RAISE_TICKER, 0, 0)?; + + let venue_id = create_venue(&alice.user)?; + let tiers = generate_tiers::(i); + }: _( + alice.user.origin(), + alice.portfolio, + OFFERING_TICKER, + alice.portfolio, + RAISE_TICKER, + tiers, + venue_id, + None, + None, + 0u32.into(), + vec![].into() + ) + verify { + ensure!(FundraiserCount::get(OFFERING_TICKER) > 0, "create_fundraiser"); + } + + invest { + let (alice, bob) = setup_fundraiser::(T::MaxConditionComplexity::get() as u32, MAX_TIERS as u32, T::MaxTransferManagersPerAsset::get() as u32)?; + }: _( + bob.user.origin(), + bob.portfolio, + bob.portfolio, + OFFERING_TICKER, + 0, + (MAX_TIERS as u128).into(), + Some(100u32.into()), + None + ) + verify { + ensure!(>::balance_of(&OFFERING_TICKER, bob.user.did()) > 0u32.into(), "invest"); + } + + freeze_fundraiser { + let (alice, _) = setup_fundraiser::(0, 1, 0)?; + }: _(alice.user.origin(), OFFERING_TICKER, 0) + verify { + ensure!(>::get(OFFERING_TICKER, 0).unwrap().status == FundraiserStatus::Frozen, "freeze_fundraiser"); + } + + unfreeze_fundraiser { + let (alice, _) = setup_fundraiser::(0, 1, 0)?; + >::freeze_fundraiser( + alice.user.origin().into(), + OFFERING_TICKER, + 0, + )?; + }: _(alice.user.origin(), OFFERING_TICKER, 0) + verify { + ensure!(>::get(OFFERING_TICKER, 0).unwrap().status == FundraiserStatus::Live, "unfreeze_fundraiser"); + } + + modify_fundraiser_window { + let (alice, _) = setup_fundraiser::(0, 1, 0)?; + }: _(alice.user.origin(), OFFERING_TICKER, 0, 100u32.into(), Some(101u32.into())) + verify { + ensure!(>::get(OFFERING_TICKER, 0).unwrap().end == Some(101u32.into()), "modify_fundraiser_window"); + } + + stop { + let (alice, _) = setup_fundraiser::(0, 1, 0)?; + }: _(alice.user.origin(), OFFERING_TICKER, 0) + verify { + ensure!(>::get(OFFERING_TICKER, 0).unwrap().is_closed(), "stop"); + } +} diff --git a/pallets/sto/src/lib.rs b/pallets/sto/src/lib.rs index abeed7718f..58a18a9f49 100644 --- a/pallets/sto/src/lib.rs +++ b/pallets/sto/src/lib.rs @@ -23,6 +23,9 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarking; + use codec::{Decode, Encode}; use core::mem; use frame_support::{ @@ -38,17 +41,18 @@ use pallet_settlement::{ use pallet_timestamp::{self as timestamp, Trait as TimestampTrait}; use polymesh_common_utilities::{ portfolio::PortfolioSubTrait, - traits::{asset::Trait as AssetTrait, identity::Trait as IdentityTrait}, + traits::{asset::AssetFnTrait, identity::Trait as IdentityTrait}, with_transaction, CommonTrait, }; use polymesh_primitives_derive::VecU8StrongTyped; -use polymesh_primitives::{IdentityId, PortfolioId, SecondaryKey, Ticker}; -use sp_runtime::traits::{CheckedAdd, CheckedDiv, CheckedMul}; +use frame_support::weights::Weight; +use polymesh_primitives::{EventDid, IdentityId, PortfolioId, SecondaryKey, Ticker}; +use sp_runtime::traits::{CheckedAdd, CheckedDiv, CheckedMul, Saturating}; use sp_runtime::DispatchError; use sp_std::{collections::btree_set::BTreeSet, prelude::*}; -const MAX_TIERS: usize = 10; +pub const MAX_TIERS: usize = 10; type Identity = identity::Module; type Settlement = settlement::Module; @@ -66,6 +70,8 @@ pub enum FundraiserStatus { Frozen, /// Fundraiser has been stopped. Closed, + /// Fundraiser has been stopped before expiry. + ClosedEarly, } impl Default for FundraiserStatus { @@ -104,6 +110,12 @@ pub struct Fundraiser { pub minimum_investment: Balance, } +impl Fundraiser { + pub fn is_closed(&self) -> bool { + self.status == FundraiserStatus::Closed || self.status == FundraiserStatus::ClosedEarly + } +} + /// Single tier of a tiered pricing model. #[derive(Encode, Decode, Default, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct PriceTier { @@ -142,9 +154,20 @@ impl Into> for PriceTier { )] pub struct FundraiserName(Vec); +pub trait WeightInfo { + fn create_fundraiser(i: u32) -> Weight; + fn invest() -> Weight; + fn freeze_fundraiser() -> Weight; + fn unfreeze_fundraiser() -> Weight; + fn modify_fundraiser_window() -> Weight; + fn stop() -> Weight; +} + pub trait Trait: frame_system::Trait + IdentityTrait + SettlementTrait + PortfolioTrait { /// The overarching event type. type Event: From> + Into<::Event>; + /// Weight information for extrinsic of the sto pallet. + type WeightInfo: WeightInfo; } decl_event!( @@ -159,13 +182,23 @@ decl_event!( /// An investor invested in the fundraiser. /// (Investor, fundraiser_id, offering token, raise token, offering_token_amount, raise_token_amount) Invested(IdentityId, u64, Ticker, Ticker, Balance, Balance), - /// An fundraiser has been frozen. + /// A fundraiser has been frozen. /// (primary issuance agent, fundraiser id) FundraiserFrozen(IdentityId, u64), - /// An fundraiser has been unfrozen. + /// A fundraiser has been unfrozen. /// (primary issuance agent, fundraiser id) FundraiserUnfrozen(IdentityId, u64), - /// An fundraiser has been stopped. + /// A fundraiser window has been modified. + /// (primary issuance agent, fundraiser id, old_start, old_end, new_start, new_end) + FundraiserWindowModified( + EventDid, + u64, + Moment, + Option, + Moment, + Option, + ), + /// A fundraiser has been stopped. /// (primary issuance agent, fundraiser id) FundraiserClosed(IdentityId, u64), } @@ -230,10 +263,13 @@ decl_module! { /// * `venue_id` - Venue to handle settlement. /// * `start` - Fundraiser start time, if `None` the fundraiser will start immediately. /// * `end` - Fundraiser end time, if `None` the fundraiser will never expire. + /// * `minimum_investment` - Minimum amount of `raising_asset` that an investor needs to spend to invest in this raise. + /// * `fundraiser_name` - Fundraiser name, only used in the UIs. /// - /// # Weight - /// `800_000_000` placeholder - #[weight = 800_000_000] + /// # Permissions + /// * Asset + /// * Portfolio + #[weight = ::WeightInfo::create_fundraiser(tiers.len() as u32)] pub fn create_fundraiser( origin, offering_portfolio: PortfolioId, @@ -257,14 +293,15 @@ decl_module! { >::ensure_portfolio_custody_and_permission(offering_portfolio, did, secondary_key.as_ref())?; ensure!( - tiers.len() > 0 && tiers.len() <= MAX_TIERS && tiers.iter().all(|t| t.total > 0.into()), + tiers.len() > 0 && tiers.len() <= MAX_TIERS && tiers.iter().all(|t| t.total > 0u32.into()), Error::::InvalidPriceTiers ); let offering_amount: T::Balance = tiers .iter() .map(|t| t.total) - .fold(0.into(), |total, x| total + x); + .try_fold(0u32.into(), |total: T::Balance, x| total.checked_add(&x)) + .ok_or(Error::::InvalidPriceTiers)?; let start = start.unwrap_or_else(Timestamp::::get); if let Some(end) = end { @@ -300,20 +337,20 @@ decl_module! { /// * `funding_portfolio` - Portfolio that will fund the investment. /// * `offering_asset` - Asset to invest in. /// * `fundraiser_id` - ID of the fundraiser to invest in. - /// * `investment_amount` - Amount of `offering_asset` to invest in. + /// * `purchase_amount` - Amount of `offering_asset` to purchase. /// * `max_price` - Maximum price to pay per unit of `offering_asset`, If `None`there are no constraints on price. /// * `receipt` - Off-chain receipt to use instead of on-chain balance in `funding_portfolio`. /// - /// # Weight - /// `2_000_000_000` placeholder - #[weight = 2_000_000_000] + /// # Permissions + /// * Portfolio + #[weight = ::WeightInfo::invest()] pub fn invest( origin, investment_portfolio: PortfolioId, funding_portfolio: PortfolioId, offering_asset: Ticker, fundraiser_id: u64, - investment_amount: T::Balance, + purchase_amount: T::Balance, max_price: Option, receipt: Option> ) { @@ -329,7 +366,6 @@ decl_module! { let mut fundraiser = >::get(offering_asset, fundraiser_id).ok_or(Error::::FundraiserNotFound)?; ensure!(fundraiser.status == FundraiserStatus::Live, Error::::FundraiserNotLive); - ensure!(investment_amount >= fundraiser.minimum_investment, Error::::InvestmentAmountTooLow); let now = Timestamp::::get(); ensure!( @@ -338,23 +374,23 @@ decl_module! { ); // Remaining tokens to fulfil the investment amount - let mut remaining = investment_amount; + let mut remaining = purchase_amount; // Total cost to to fulfil the investment amount. // Primary use is to calculate the blended price (offering_token_amount / cost). // Blended price must be <= to max_price or the investment will fail. - let mut cost = T::Balance::from(0); + let mut cost = T::Balance::from(0u32); // Price is entered as a multiple of 1_000_000 // i.e. a price of 1 unit is 1_000_000 // a price of 1.5 units is 1_500_00 - let price_divisor = T::Balance::from(1_000_000); + let price_divisor = T::Balance::from(1_000_000u32); // Individual purchases from each tier that accumulate to fulfil the investment amount. // Tuple of (tier_id, amount to purchase from that tier). let mut purchases = Vec::new(); - for (id, tier) in fundraiser.tiers.iter().enumerate().filter(|(_, tier)| tier.remaining > 0.into()) { + for (id, tier) in fundraiser.tiers.iter().enumerate().filter(|(_, tier)| tier.remaining > 0u32.into()) { // fulfilled the investment amount - if remaining == 0.into() { + if remaining == 0u32.into() { break } @@ -377,9 +413,10 @@ decl_module! { .ok_or(Error::::Overflow)?; } - ensure!(remaining == 0.into(), Error::::InsufficientTokensRemaining); + ensure!(remaining == 0u32.into(), Error::::InsufficientTokensRemaining); + ensure!(cost >= fundraiser.minimum_investment, Error::::InvestmentAmountTooLow); ensure!( - max_price.map(|max_price| cost <= max_price * investment_amount).unwrap_or(true), + max_price.map(|max_price| cost <= max_price.saturating_mul(purchase_amount) / price_divisor).unwrap_or(true), Error::::MaxPriceExceeded ); @@ -388,7 +425,7 @@ decl_module! { from: fundraiser.offering_portfolio, to: investment_portfolio, asset: fundraiser.offering_asset, - amount: investment_amount + amount: purchase_amount }, Leg { from: funding_portfolio, @@ -399,7 +436,7 @@ decl_module! { ]; with_transaction(|| { - >::unlock_tokens(&fundraiser.offering_portfolio, &fundraiser.offering_asset, &investment_amount)?; + >::unlock_tokens(&fundraiser.offering_portfolio, &fundraiser.offering_asset, &purchase_amount)?; let instruction_id = Settlement::::base_add_instruction( fundraiser.creator, @@ -411,7 +448,7 @@ decl_module! { )?; let portfolios = [fundraiser.offering_portfolio, fundraiser.raising_portfolio].iter().copied().collect::>(); - Settlement::::unsafe_affirm_instruction(fundraiser.creator, instruction_id, portfolios, None)?; + Settlement::::unsafe_affirm_instruction(fundraiser.creator, instruction_id, portfolios, 1, None)?; let portfolios = vec![investment_portfolio, funding_portfolio]; match receipt { @@ -420,8 +457,9 @@ decl_module! { instruction_id, vec![receipt], portfolios, + 2 ), - None => Settlement::::affirm_and_execute_instruction(origin, instruction_id, portfolios), + None => Settlement::::affirm_and_execute_instruction(origin, instruction_id, portfolios, 1), } })?; @@ -429,7 +467,7 @@ decl_module! { fundraiser.tiers[id].remaining -= amount; } - Self::deposit_event(RawEvent::Invested(did, fundraiser_id, offering_asset, fundraiser.raising_asset, investment_amount, cost)); + Self::deposit_event(RawEvent::Invested(did, fundraiser_id, offering_asset, fundraiser.raising_asset, purchase_amount, cost)); >::insert(offering_asset, fundraiser_id, fundraiser); } @@ -438,9 +476,9 @@ decl_module! { /// * `offering_asset` - Asset to freeze. /// * `fundraiser_id` - ID of the fundraiser to freeze. /// - /// # Weight - /// `1_000` placeholder - #[weight = 1_000] + /// # Permissions + /// * Asset + #[weight = ::WeightInfo::freeze_fundraiser()] pub fn freeze_fundraiser(origin, offering_asset: Ticker, fundraiser_id: u64) -> DispatchResult { Self::set_frozen(origin, offering_asset, fundraiser_id, true) } @@ -450,9 +488,9 @@ decl_module! { /// * `offering_asset` - Asset to unfreeze. /// * `fundraiser_id` - ID of the fundraiser to unfreeze. /// - /// # Weight - /// `1_000` placeholder - #[weight = 1_000] + /// # Permissions + /// * Asset + #[weight = ::WeightInfo::unfreeze_fundraiser()] pub fn unfreeze_fundraiser(origin, offering_asset: Ticker, fundraiser_id: u64) -> DispatchResult { Self::set_frozen(origin, offering_asset, fundraiser_id, false) } @@ -464,21 +502,22 @@ decl_module! { /// * `start` - New start of the fundraiser. /// * `end` - New end of the fundraiser to modify. /// - /// # Weight - /// `1_000` placeholder - #[weight = 1_000] + /// # Permissions + /// * Asset + #[weight = ::WeightInfo::modify_fundraiser_window()] pub fn modify_fundraiser_window(origin, offering_asset: Ticker, fundraiser_id: u64, start: T::Moment, end: Option) -> DispatchResult { - Self::ensure_perms_pia(origin, &offering_asset)?; + let did = Self::ensure_perms_pia(origin, &offering_asset)?.0.for_event(); >::try_mutate(offering_asset, fundraiser_id, |fundraiser| { let fundraiser = fundraiser.as_mut().ok_or(Error::::FundraiserNotFound)?; - ensure!(fundraiser.status != FundraiserStatus::Closed, Error::::FundraiserClosed); + ensure!(!fundraiser.is_closed(), Error::::FundraiserClosed); if let Some(end) = fundraiser.end { ensure!(Timestamp::::get() < end, Error::::FundraiserExpired); } if let Some(end) = end { ensure!(start < end, Error::::InvalidOfferingWindow); } + Self::deposit_event(RawEvent::FundraiserWindowModified(did, fundraiser_id, fundraiser.start, fundraiser.end, start, end)); fundraiser.start = start; fundraiser.end = end; Ok(()) @@ -490,9 +529,9 @@ decl_module! { /// * `offering_asset` - Asset to stop. /// * `fundraiser_id` - ID of the fundraiser to stop. /// - /// # Weight - /// `1_000` placeholder - #[weight = 1_000] + /// # Permissions + /// * Asset + #[weight = ::WeightInfo::stop()] pub fn stop(origin, offering_asset: Ticker, fundraiser_id: u64) { let did = Self::ensure_perms(origin, &offering_asset)?.0; @@ -504,16 +543,21 @@ decl_module! { Error::::Unauthorized ); - ensure!(fundraiser.status != FundraiserStatus::Closed, Error::::FundraiserClosed); + ensure!(!fundraiser.is_closed(), Error::::FundraiserClosed); let remaining_amount: T::Balance = fundraiser.tiers .iter() .map(|t| t.remaining) - .fold(0.into(), |remaining, x| remaining + x); + .fold(0u32.into(), |remaining, x| remaining + x); + //TODO(Connor): Should we check portfolio perms here? >::unlock_tokens(&fundraiser.offering_portfolio, &fundraiser.offering_asset, &remaining_amount)?; - fundraiser.status = FundraiserStatus::Closed; + fundraiser.status = match fundraiser.end { + Some(end) if end > Timestamp::::get() => FundraiserStatus::ClosedEarly, + _ => FundraiserStatus::Closed, + }; >::insert(offering_asset, fundraiser_id, fundraiser); + Self::deposit_event(RawEvent::FundraiserClosed(did, fundraiser_id)); } } } @@ -528,10 +572,7 @@ impl Module { let did = Self::ensure_perms_pia(origin, &offering_asset)?.0; let mut fundraiser = >::get(offering_asset, fundraiser_id) .ok_or(Error::::FundraiserNotFound)?; - ensure!( - fundraiser.status != FundraiserStatus::Closed, - Error::::FundraiserClosed - ); + ensure!(!fundraiser.is_closed(), Error::::FundraiserClosed); if frozen { fundraiser.status = FundraiserStatus::Frozen; Self::deposit_event(RawEvent::FundraiserFrozen(did, fundraiser_id)); diff --git a/pallets/sudo/Cargo.toml b/pallets/sudo/Cargo.toml index 358b28c611..6b089b3cbd 100644 --- a/pallets/sudo/Cargo.toml +++ b/pallets/sudo/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" homepage = "https://substrate.dev" -repository = "https://github.com/paritytech/substrate/" +repository = "https://github.com/PolymathNetwork/substrate/" description = "FRAME pallet for sudo" readme = "README.md" @@ -15,14 +15,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.104", optional = true } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0"} -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1"} +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } [features] default = ["std"] diff --git a/pallets/transaction-payment/Cargo.toml b/pallets/transaction-payment/Cargo.toml index f9df98726d..399300fbf4 100644 --- a/pallets/transaction-payment/Cargo.toml +++ b/pallets/transaction-payment/Cargo.toml @@ -14,12 +14,12 @@ serde = { version = "1.0.104", default-features = false, optional = true } # Substrate codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } [dev-dependencies] serde_json = "1.0.56" diff --git a/pallets/transaction-payment/src/lib.rs b/pallets/transaction-payment/src/lib.rs index 339a5a6d73..a8572c08fd 100644 --- a/pallets/transaction-payment/src/lib.rs +++ b/pallets/transaction-payment/src/lib.rs @@ -40,13 +40,14 @@ pub mod runtime_dispatch_info; pub use runtime_dispatch_info::RuntimeDispatchInfo; use codec::{Decode, Encode}; +use frame_support::ensure; use frame_support::{ decl_module, decl_storage, dispatch::DispatchResult, traits::{Currency, ExistenceRequirement, Get, Imbalance, OnUnbalanced, WithdrawReason}, weights::{ - DispatchInfo, GetDispatchInfo, Pays, PostDispatchInfo, Weight, WeightToFeeCoefficient, - WeightToFeePolynomial, + DispatchClass, DispatchInfo, GetDispatchInfo, Pays, PostDispatchInfo, Weight, + WeightToFeeCoefficient, WeightToFeePolynomial, }, }; use polymesh_common_utilities::traits::transaction_payment::{CddAndFeeDetails, ChargeTxFee}; @@ -463,7 +464,7 @@ where info: &DispatchInfoOf, len: usize, ) -> Result<(BalanceOf, Option>), TransactionValidityError> { - let fee = Module::::compute_fee(len as u32, info, 0u32.into()); + let fee = Module::::compute_fee(len as u32, info, self.0); // Only mess with balances if fee is not zero. if fee.is_zero() { @@ -483,6 +484,23 @@ where T::CddHandler::set_payer_context(Some(payer_key)); Ok((fee, Some(imbalance))) } + + /// Tip in `DispatchClass::Normal` transactions MUST be zero. + fn ensure_valid_tip( + &self, + info: &DispatchInfoOf, + ) -> Result, TransactionValidityError> { + if let DispatchClass::Normal = info.class { + ensure!( + self.0 == Zero::zero(), + TransactionValidityError::Invalid(InvalidTransaction::Custom( + TransactionError::ZeroTip as u8 + )), + ); + } + + Ok(self.0) + } } impl sp_std::fmt::Debug for ChargeTransactionPayment { @@ -523,16 +541,13 @@ where info: &DispatchInfoOf, len: usize, ) -> TransactionValidity { - if self.0 != Zero::zero() { - // Tip must be set to zero. - // This is enforced to curb front running. - return InvalidTransaction::Custom(TransactionError::ZeroTip as u8).into(); - } - let (fee, _) = self.withdraw_fee(call, who, info, len)?; + let tip = self.ensure_valid_tip(info)?; + + let (_fee, _) = self.withdraw_fee(call, who, info, len)?; let mut r = ValidTransaction::default(); - // NOTE: we probably want to maximize the _fee (of any type) per weight unit_ here, which - // will be a bit more than setting the priority to tip. For now, this is enough. - r.priority = fee.saturated_into::(); + // NOTE: The priority of TX is just its `tip`, to ensure that operational one can be + // priorized and normal TX will follow the FIFO (defined by its `insertion_id`). + r.priority = tip.saturated_into::(); Ok(r) } @@ -543,15 +558,9 @@ where info: &DispatchInfoOf, len: usize, ) -> Result { - if self.0 != Zero::zero() { - // Tip must be set to zero. - // This is enforced to curb front running. - return Err(TransactionValidityError::Invalid( - InvalidTransaction::Custom(TransactionError::ZeroTip as u8), - )); - } + let tip = self.ensure_valid_tip(info)?; let (fee, imbalance) = self.withdraw_fee(call, who, info, len)?; - Ok((Zero::zero(), who.clone(), imbalance, fee)) + Ok((tip, who.clone(), imbalance, fee)) } fn post_dispatch( diff --git a/pallets/treasury/Cargo.toml b/pallets/treasury/Cargo.toml index e4e16a16c3..1ef67d3d16 100644 --- a/pallets/treasury/Cargo.toml +++ b/pallets/treasury/Cargo.toml @@ -17,18 +17,18 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false # Substrate codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Benchmarking -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } [features] equalize = [] diff --git a/pallets/treasury/src/benchmarking.rs b/pallets/treasury/src/benchmarking.rs index 6386aafdef..97595c31e4 100644 --- a/pallets/treasury/src/benchmarking.rs +++ b/pallets/treasury/src/benchmarking.rs @@ -12,14 +12,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg(feature = "runtime-benchmarks")] use crate::*; -use polymesh_common_utilities::benchs::UserBuilder; - use frame_benchmarking::benchmarks; use frame_system::RawOrigin; +use polymesh_common_utilities::benchs::UserBuilder; use sp_std::vec::Vec; const MAX_BENEFICIARIES: u32 = 128; @@ -32,14 +30,14 @@ benchmarks! { let b in 1..MAX_BENEFICIARIES; // Refill treasury - let refiller = UserBuilder::::default().balance(200 + REWARD * b).generate_did().build("refiller"); + let refiller = UserBuilder::::default().balance(200u32 + REWARD * b).generate_did().build("refiller"); Module::::reimbursement( refiller.origin().into(), (100 + (REWARD * b)).into()) .expect("Tresury cannot be refill"); // Create beneficiaries let beneficiaries = (0..b).map( |idx| { let user = UserBuilder::::default() - .balance(100) + .balance(100u32) .seed(idx) .generate_did() .build("beneficiary") @@ -50,14 +48,14 @@ benchmarks! { }: _(RawOrigin::Root, beneficiaries) verify { - assert_eq!(Module::::balance(), 100.into()); + assert_eq!(Module::::balance(), 100u32.into()); } reimbursement { - let caller = UserBuilder::::default().balance(1_000).generate_did().build("caller"); - let amount = 500.into(); + let caller = UserBuilder::::default().balance(1_000u32).generate_did().build("caller"); + let amount = 500u32.into(); }: _(caller.origin(), amount) verify { - assert_eq!(Module::::balance(), 500.into()); + assert_eq!(Module::::balance(), 500u32.into()); } } diff --git a/pallets/treasury/src/lib.rs b/pallets/treasury/src/lib.rs index 05a3c7496d..da809f07d3 100644 --- a/pallets/treasury/src/lib.rs +++ b/pallets/treasury/src/lib.rs @@ -116,7 +116,7 @@ decl_module! { ensure_root(origin)?; // Ensure treasury has enough balance. - let total_amount = beneficiaries.iter().fold( 0.into(), |acc,b| b.amount.saturating_add(acc)); + let total_amount = beneficiaries.iter().fold(0u32.into(), |acc,b| b.amount.saturating_add(acc)); ensure!( Self::balance() >= total_amount, Error::::InsufficientBalance diff --git a/pallets/utility/Cargo.toml b/pallets/utility/Cargo.toml index e5c64a02ae..77260e8037 100644 --- a/pallets/utility/Cargo.toml +++ b/pallets/utility/Cargo.toml @@ -15,13 +15,13 @@ polymesh-primitives = { path = "../../primitives", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", tag = "v2.0.0", optional = true } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-benchmarking = { default-features = false, git = "https://github.com/PolymathNetwork/substrate", tag = "v2.0.1-1", optional = true } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Only for benchmarks hex-literal = "0.2.1" diff --git a/pallets/utility/src/benchmarking.rs b/pallets/utility/src/benchmarking.rs index 8a298cb752..db4b467f11 100644 --- a/pallets/utility/src/benchmarking.rs +++ b/pallets/utility/src/benchmarking.rs @@ -1,11 +1,9 @@ use crate::*; +use frame_benchmarking::benchmarks; use pallet_balances::{self as balances, Call as BalancesCall}; use polymesh_common_utilities::benchs::{User, UserBuilder}; - -use frame_benchmarking::benchmarks; -use sp_runtime::traits::StaticLookup; - use sp_core::sr25519::Signature; +use sp_runtime::traits::StaticLookup; use sp_runtime::MultiSignature; const MAX_CALLS: u32 = 30; @@ -35,11 +33,11 @@ fn verify_free_balance(account: &T::AccountId, expected_balance: u128) fn make_relay_tx_users() -> (User, User) { let alice = UserBuilder::::default() - .balance(1_000_000) + .balance(1_000_000u32) .generate_did() .build("Caller"); let bob = UserBuilder::::default() - .balance(1_000_000) + .balance(1_000_000u32) .generate_did() .build("Target"); @@ -107,8 +105,8 @@ benchmarks! { batch_transfer { let c in 0..MAX_CALLS; - let sender = UserBuilder::::default().balance(1_000_000).generate_did().build("SENDER"); - let receiver = UserBuilder::::default().balance(1_000_000).generate_did().build("RECEIVER"); + let sender = UserBuilder::::default().balance(1_000_000u32).generate_did().build("SENDER"); + let receiver = UserBuilder::::default().balance(1_000_000u32).generate_did().build("RECEIVER"); let transfer_calls = make_transfer_calls::(c, receiver.account(), 500); }: batch(sender.origin, transfer_calls) @@ -130,8 +128,8 @@ benchmarks! { batch_atomic_transfer { let c in 0..MAX_CALLS; - let alice = UserBuilder::::default().balance(1_000_000).generate_did().build("ALICE"); - let bob = UserBuilder::::default().balance(1_000_000).generate_did().build("BOB"); + let alice = UserBuilder::::default().balance(1_000_000u32).generate_did().build("ALICE"); + let bob = UserBuilder::::default().balance(1_000_000u32).generate_did().build("BOB"); let calls = make_transfer_calls::(c, bob.account(), 100); }: batch_atomic(alice.origin, calls) @@ -154,8 +152,8 @@ benchmarks! { batch_optimistic_transfer { let c in 0..MAX_CALLS; - let alice = UserBuilder::::default().balance(1_000_000).generate_did().build("ALICE"); - let bob = UserBuilder::::default().balance(1_000_000).generate_did().build("BOB"); + let alice = UserBuilder::::default().balance(1_000_000u32).generate_did().build("ALICE"); + let bob = UserBuilder::::default().balance(1_000_000u32).generate_did().build("BOB"); let calls = make_transfer_calls::(c, bob.account(), 100); }: batch_optimistic(alice.origin, calls) diff --git a/pallets/weights/Cargo.toml b/pallets/weights/Cargo.toml index 778db2b198..cf68f639b1 100644 --- a/pallets/weights/Cargo.toml +++ b/pallets/weights/Cargo.toml @@ -6,50 +6,65 @@ edition = "2018" [dependencies] # substrate pallets -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-babe = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-indices = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-grandpa = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-scheduler = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # our pallets +pallet-asset = { path = "../asset", default-features = false } +pallet-balances = { path = "../balances", default-features = false } +pallet-staking = { path = "../staking", default-features = false } +pallet-committee = { path = "../committee", default-features = false } +pallet-compliance-manager = { path = "../compliance-manager", default-features = false } +pallet-confidential = { path = "../confidential", default-features = false } pallet-corporate-actions = { path = "../corporate-actions", default-features = false } -pallet-identity = { path = "../identity", default-features = false } -pallet-pips = { path = "../pips", default-features = false } +pallet-group = { path = "../group", default-features = false } +pallet-identity = { path = "../identity", default-features = false } +pallet-im-online = { path = "../im-online", default-features = false } pallet-multisig = { path = "../multisig", default-features = false } +pallet-pips = { path = "../pips", default-features = false } pallet-portfolio = { path = "../portfolio", default-features = false } pallet-protocol-fee = { path = "../protocol-fee", default-features = false } pallet-settlement = { path = "../settlement", default-features = false } -pallet-compliance-manager = { path = "../compliance-manager", default-features = false } -polymesh-contracts = { path = "../contracts", default-features = false } -pallet-utility = { path = "../utility", default-features = false } -pallet-asset = { path = "../asset", default-features = false } -pallet-confidential = { path = "../confidential", default-features = false } -pallet-balances = { path = "../balances", default-features = false } -pallet-treasury = { path = "../treasury", default-features = false } -pallet-im-online = { path = "../im-online", default-features = false } -pallet-group = { path = "../group", default-features = false } pallet-statistics = { path = "../statistics", default-features = false } +pallet-sto = { path = "../sto", default-features = false } +pallet-treasury = { path = "../treasury", default-features = false } +pallet-utility = { path = "../utility", default-features = false } +polymesh-contracts = { path = "../contracts", default-features = false } +polymesh-runtime-common = { path = "../runtime/common", default-features = false } [features] default = ["std"] no_std = [] std = [ - "frame-support/std", "frame-system/std", + "pallet-asset/std", + "pallet-babe/std", + "pallet-staking/std", + "pallet-balances/std", + "pallet-compliance-manager/std", + "pallet-confidential/std", "pallet-corporate-actions/std", + "pallet-grandpa/std", + "pallet-group/std", "pallet-identity/std", - "pallet-pips/std", + "pallet-im-online/std", + "pallet-indices/std", "pallet-multisig/std", + "pallet-pips/std", "pallet-portfolio/std", "pallet-protocol-fee/std", + "pallet-scheduler/std", + "pallet-session/std", "pallet-settlement/std", + "pallet-sto/std", "pallet-timestamp/std", - "polymesh-contracts/std", - "pallet-compliance-manager/std", - "pallet-utility/std", - "pallet-asset/std", - "pallet-confidential/std", - "pallet-balances/std", "pallet-treasury/std", - "pallet-im-online/std", - "pallet-group/std", + "pallet-utility/std", + "polymesh-contracts/std", ] diff --git a/pallets/weights/src/frame_system.rs b/pallets/weights/src/frame_system.rs index a84900bade..e812a36abb 100644 --- a/pallets/weights/src/frame_system.rs +++ b/pallets/weights/src/frame_system.rs @@ -1,40 +1,40 @@ -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl frame_system::WeightInfo for WeightInfo { // WARNING! Some components were not used: ["b"] fn remark() -> Weight { - (516000 as Weight) + (2_828_000 as Weight) } fn set_heap_pages() -> Weight { - (1207000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + (4_253_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) } fn set_changes_trie_config() -> Weight { - (6928000 as Weight) + (17_616_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn set_storage(i: u32) -> Weight { (0 as Weight) - .saturating_add((495000 as Weight).saturating_mul(i as Weight)) + .saturating_add((1_289_000 as Weight).saturating_mul(i as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) } fn kill_storage(i: u32) -> Weight { - (0 as Weight) - .saturating_add((456000 as Weight).saturating_mul(i as Weight)) + (3_425_000 as Weight) + .saturating_add((883_000 as Weight).saturating_mul(i as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) } fn kill_prefix(p: u32) -> Weight { - (5109000 as Weight) - .saturating_add((988000 as Weight).saturating_mul(p as Weight)) + (4_859_000 as Weight) + .saturating_add((1_309_000 as Weight).saturating_mul(p as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) } fn suicide() -> Weight { - (18711000 as Weight) + (53_564_000 as Weight) } } diff --git a/pallets/weights/src/lib.rs b/pallets/weights/src/lib.rs index 2b063bea8d..d50a0bbe5b 100644 --- a/pallets/weights/src/lib.rs +++ b/pallets/weights/src/lib.rs @@ -19,21 +19,30 @@ pub mod frame_system; pub mod pallet_asset; +pub mod pallet_babe; pub mod pallet_balances; pub mod pallet_capital_distribution; +pub mod pallet_checkpoint; +pub mod pallet_committee; pub mod pallet_compliance_manager; pub mod pallet_confidential; pub mod pallet_corporate_actions; pub mod pallet_corporate_ballot; +pub mod pallet_grandpa; pub mod pallet_group; pub mod pallet_identity; pub mod pallet_im_online; +pub mod pallet_indices; pub mod pallet_multisig; pub mod pallet_pips; pub mod pallet_portfolio; pub mod pallet_protocol_fee; +pub mod pallet_scheduler; +pub mod pallet_session; pub mod pallet_settlement; +pub mod pallet_staking; pub mod pallet_statistics; +pub mod pallet_sto; pub mod pallet_timestamp; pub mod pallet_treasury; pub mod pallet_utility; diff --git a/pallets/weights/src/pallet_asset.rs b/pallets/weights/src/pallet_asset.rs index fa63086d9e..75d21dfb4d 100644 --- a/pallets/weights/src/pallet_asset.rs +++ b/pallets/weights/src/pallet_asset.rs @@ -3,127 +3,132 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_asset::WeightInfo for WeightInfo { fn register_ticker() -> Weight { - (3_776_977_000 as Weight) - .saturating_add(DbWeight::get().reads(11 as Weight)) + (160_588_000 as Weight) + .saturating_add(DbWeight::get().reads(13 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn accept_ticker_transfer() -> Weight { - (4_724_986_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) + (203_172_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(6 as Weight)) } fn accept_asset_ownership_transfer() -> Weight { - (5_164_167_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) + (217_044_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(6 as Weight)) } fn create_asset(n: u32, i: u32, f: u32) -> Weight { - (285_386_000 as Weight) - .saturating_add((8_000 as Weight).saturating_mul(n as Weight)) - .saturating_add((159_000 as Weight).saturating_mul(i as Weight)) - .saturating_add((26_000 as Weight).saturating_mul(f as Weight)) - .saturating_add(DbWeight::get().reads(14 as Weight)) + (458_026_000 as Weight) + .saturating_add((20_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((150_000 as Weight).saturating_mul(i as Weight)) + .saturating_add((33_000 as Weight).saturating_mul(f as Weight)) + .saturating_add(DbWeight::get().reads(22 as Weight)) .saturating_add(DbWeight::get().writes(11 as Weight)) } fn freeze() -> Weight { - (2_578_276_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (136_638_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn unfreeze() -> Weight { - (2_800_973_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (136_133_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn rename_asset(n: u32) -> Weight { - (2_573_905_000 as Weight) - .saturating_add((18_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (139_234_000 as Weight) + .saturating_add((4_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn issue() -> Weight { - (7_391_238_000 as Weight) - .saturating_add(DbWeight::get().reads(17 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + (278_225_000 as Weight) + .saturating_add(DbWeight::get().reads(18 as Weight)) + .saturating_add(DbWeight::get().writes(5 as Weight)) } fn redeem() -> Weight { - (6_607_622_000 as Weight) - .saturating_add(DbWeight::get().reads(14 as Weight)) + (289_971_000 as Weight) + .saturating_add(DbWeight::get().reads(16 as Weight)) .saturating_add(DbWeight::get().writes(6 as Weight)) } fn make_divisible() -> Weight { - (2_727_055_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (132_758_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn add_documents(d: u32) -> Weight { - (2_249_285_000 as Weight) - .saturating_add((849_501_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (117_746_000 as Weight) + .saturating_add((95_770_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(d as Weight))) } fn remove_documents(d: u32) -> Weight { - (1_094_729_000 as Weight) - .saturating_add((634_328_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (77_447_000 as Weight) + .saturating_add((21_861_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(d as Weight))) } fn set_funding_round(f: u32) -> Weight { - (83_968_000 as Weight) - .saturating_add((7_000 as Weight).saturating_mul(f as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (122_651_000 as Weight) + .saturating_add((9_000 as Weight).saturating_mul(f as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn update_identifiers(i: u32) -> Weight { - (92_044_000 as Weight) - .saturating_add((102_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (124_618_000 as Weight) + .saturating_add((135_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn add_extension() -> Weight { - (3_457_672_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) + (157_444_000 as Weight) + .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn archive_extension() -> Weight { - (2_898_236_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (134_570_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn unarchive_extension() -> Weight { - (2_741_949_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (133_931_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn remove_smart_extension() -> Weight { - (2_991_734_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) + (143_172_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn remove_primary_issuance_agent() -> Weight { - (2_409_384_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (126_381_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn claim_classic_ticker() -> Weight { - (6_974_275_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) + (424_504_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn reserve_classic_ticker() -> Weight { - (2_114_787_000 as Weight) + (91_914_000 as Weight) .saturating_add(DbWeight::get().reads(3 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn accept_primary_issuance_agent_transfer() -> Weight { - (4_233_043_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (198_593_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } + fn controller_transfer() -> Weight { + (309_999_000 as Weight) + .saturating_add(DbWeight::get().reads(18 as Weight)) + .saturating_add(DbWeight::get().writes(8 as Weight)) + } } diff --git a/pallets/weights/src/pallet_babe.rs b/pallets/weights/src/pallet_babe.rs new file mode 100644 index 0000000000..5b0e5b9a63 --- /dev/null +++ b/pallets/weights/src/pallet_babe.rs @@ -0,0 +1,49 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Default weights for the Babe Pallet +//! This file was not auto-generated. + +use polymesh_runtime_common::{ + RocksDbWeight as DbWeight, Weight, WEIGHT_PER_MICROS, WEIGHT_PER_NANOS, +}; + +pub struct WeightInfo; +impl pallet_babe::WeightInfo for WeightInfo { + // WARNING! Some components were not used: ["x"] + fn report_equivocation(validator_count: u32) -> Weight { + // we take the validator set count from the membership proof to + // calculate the weight but we set a floor of 100 validators. + let validator_count = validator_count.max(100) as u64; + + // worst case we are considering is that the given offender + // is backed by 200 nominators + const MAX_NOMINATORS: u64 = 200; + + // checking membership proof + (35 * WEIGHT_PER_MICROS) + .saturating_add((175 * WEIGHT_PER_NANOS).saturating_mul(validator_count)) + .saturating_add(DbWeight::get().reads(5)) + // check equivocation proof + .saturating_add(110 * WEIGHT_PER_MICROS) + // report offence + .saturating_add(110 * WEIGHT_PER_MICROS) + .saturating_add(25 * WEIGHT_PER_MICROS * MAX_NOMINATORS) + .saturating_add(DbWeight::get().reads(14 + 3 * MAX_NOMINATORS)) + .saturating_add(DbWeight::get().writes(10 + 3 * MAX_NOMINATORS)) + } +} diff --git a/pallets/weights/src/pallet_balances.rs b/pallets/weights/src/pallet_balances.rs index 8605e523c1..9ce6dc99a9 100644 --- a/pallets/weights/src/pallet_balances.rs +++ b/pallets/weights/src/pallet_balances.rs @@ -3,37 +3,37 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_balances::WeightInfo for WeightInfo { fn transfer() -> Weight { - (151_316_000 as Weight) + (182_678_000 as Weight) .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn transfer_with_memo() -> Weight { - (152_944_000 as Weight) + (168_990_000 as Weight) .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn deposit_block_reward_reserve_balance() -> Weight { - (129_366_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) + (174_742_000 as Weight) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn set_balance() -> Weight { - (95_896_000 as Weight) + (115_936_000 as Weight) .saturating_add(DbWeight::get().reads(5 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn force_transfer() -> Weight { - (97_813_000 as Weight) + (116_926_000 as Weight) .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn burn_account_balance() -> Weight { - (107_402_000 as Weight) + (147_453_000 as Weight) .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } diff --git a/pallets/weights/src/pallet_capital_distribution.rs b/pallets/weights/src/pallet_capital_distribution.rs index 96a76b6f22..cba34dc2e3 100644 --- a/pallets/weights/src/pallet_capital_distribution.rs +++ b/pallets/weights/src/pallet_capital_distribution.rs @@ -3,37 +3,37 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { fn distribute() -> Weight { - (63_053_000 as Weight) - .saturating_add(DbWeight::get().reads(15 as Weight)) + (228_327_000 as Weight) + .saturating_add(DbWeight::get().reads(17 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } - fn claim(i: u32, j: u32) -> Weight { - (205_654_000 as Weight) - .saturating_add((246_000 as Weight).saturating_mul(i as Weight)) - .saturating_add((128_000 as Weight).saturating_mul(j as Weight)) + fn claim(t: u32, w: u32) -> Weight { + (730_892_000 as Weight) + .saturating_add((427_000 as Weight).saturating_mul(t as Weight)) + .saturating_add((214_000 as Weight).saturating_mul(w as Weight)) .saturating_add(DbWeight::get().reads(31 as Weight)) .saturating_add(DbWeight::get().writes(11 as Weight)) } - fn push_benefit(i: u32, j: u32) -> Weight { - (210_363_000 as Weight) - .saturating_add((240_000 as Weight).saturating_mul(i as Weight)) - .saturating_add((128_000 as Weight).saturating_mul(j as Weight)) - .saturating_add(DbWeight::get().reads(31 as Weight)) + fn push_benefit(t: u32, w: u32) -> Weight { + (721_582_000 as Weight) + .saturating_add((473_000 as Weight).saturating_mul(t as Weight)) + .saturating_add((217_000 as Weight).saturating_mul(w as Weight)) + .saturating_add(DbWeight::get().reads(32 as Weight)) .saturating_add(DbWeight::get().writes(11 as Weight)) } fn reclaim() -> Weight { - (40_246_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) + (155_556_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn remove_distribution() -> Weight { - (47_413_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) + (163_289_000 as Weight) + .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } } diff --git a/pallets/weights/src/pallet_checkpoint.rs b/pallets/weights/src/pallet_checkpoint.rs new file mode 100644 index 0000000000..a45dfc1d26 --- /dev/null +++ b/pallets/weights/src/pallet_checkpoint.rs @@ -0,0 +1,30 @@ +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; + +pub struct WeightInfo; +impl pallet_asset::checkpoint::WeightInfo for WeightInfo { + fn set_schedules_max_complexity() -> Weight { + (10_655_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn create_checkpoint() -> Weight { + (45_191_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) + } + fn create_schedule(s: u32) -> Weight { + (71_700_000 as Weight) + .saturating_add((73_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(15 as Weight)) + .saturating_add(DbWeight::get().writes(7 as Weight)) + } + fn remove_schedule(s: u32) -> Weight { + (44_085_000 as Weight) + .saturating_add((84_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(9 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } +} diff --git a/pallets/weights/src/pallet_committee.rs b/pallets/weights/src/pallet_committee.rs new file mode 100644 index 0000000000..481265bd82 --- /dev/null +++ b/pallets/weights/src/pallet_committee.rs @@ -0,0 +1,41 @@ +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; + +pub struct WeightInfo; +impl pallet_committee::WeightInfo for WeightInfo { + fn set_vote_threshold() -> Weight { + (30_228_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_release_coordinator() -> Weight { + (202_048_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_expires_after() -> Weight { + (30_934_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn vote_or_propose_new_proposal() -> Weight { + (612_282_000 as Weight) + .saturating_add(DbWeight::get().reads(11 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) + } + fn vote_or_propose_existing_proposal() -> Weight { + (576_980_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn vote_aye() -> Weight { + (1_368_903_000 as Weight) + .saturating_add(DbWeight::get().reads(10 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) + } + fn vote_nay() -> Weight { + (571_001_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } +} diff --git a/pallets/weights/src/pallet_compliance_manager.rs b/pallets/weights/src/pallet_compliance_manager.rs index ed113750df..71e5573dad 100644 --- a/pallets/weights/src/pallet_compliance_manager.rs +++ b/pallets/weights/src/pallet_compliance_manager.rs @@ -3,58 +3,58 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_compliance_manager::WeightInfo for WeightInfo { fn add_compliance_requirement(s: u32, r: u32) -> Weight { - (130_697_000 as Weight) - .saturating_add((2_857_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((1_255_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(9 as Weight)) + (179_972_000 as Weight) + .saturating_add((4_937_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((4_321_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn remove_compliance_requirement() -> Weight { - (116_759_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (193_357_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn pause_asset_compliance() -> Weight { - (119_788_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (181_875_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn resume_asset_compliance() -> Weight { - (97_387_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (142_372_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn add_default_trusted_claim_issuer() -> Weight { - (111_144_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (145_855_000 as Weight) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn remove_default_trusted_claim_issuer() -> Weight { - (93_236_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (137_782_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } - fn change_compliance_requirement(s: u32, r: u32) -> Weight { - (134_277_000 as Weight) - .saturating_add((1_384_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((2_267_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) + // WARNING! Some components were not used: ["s"] + fn change_compliance_requirement(r: u32, _s: u32) -> Weight { + (199_636_000 as Weight) + .saturating_add((10_080_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn replace_asset_compliance(c: u32) -> Weight { - (123_159_000 as Weight) - .saturating_add((29_228_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) + (192_722_000 as Weight) + .saturating_add((42_981_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn reset_asset_compliance() -> Weight { - (87_000_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (143_884_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } } diff --git a/pallets/weights/src/pallet_confidential.rs b/pallets/weights/src/pallet_confidential.rs index 7d8b299f33..7db4df6cce 100644 --- a/pallets/weights/src/pallet_confidential.rs +++ b/pallets/weights/src/pallet_confidential.rs @@ -3,18 +3,18 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_confidential::WeightInfo for WeightInfo { fn add_range_proof() -> Weight { - (84_751_646_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) + (85_051_475_000 as Weight) + .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn add_verify_range_proof() -> Weight { - (23_559_125_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (22_456_772_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } } diff --git a/pallets/weights/src/pallet_corporate_actions.rs b/pallets/weights/src/pallet_corporate_actions.rs index 0cc5b17e6e..b9d240c236 100644 --- a/pallets/weights/src/pallet_corporate_actions.rs +++ b/pallets/weights/src/pallet_corporate_actions.rs @@ -3,74 +3,74 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_corporate_actions::WeightInfo for WeightInfo { fn set_max_details_length() -> Weight { - (9_740_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + (27_328_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) } fn reset_caa() -> Weight { - (35_354_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (153_578_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } - fn set_default_targets(i: u32) -> Weight { - (43_850_000 as Weight) - .saturating_add((144_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) + fn set_default_targets(t: u32) -> Weight { + (195_590_000 as Weight) + .saturating_add((695_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn set_default_withholding_tax() -> Weight { - (35_105_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) + (135_218_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } - fn set_did_withholding_tax(i: u32) -> Weight { - (39_678_000 as Weight) - .saturating_add((186_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) + fn set_did_withholding_tax(w: u32) -> Weight { + (186_392_000 as Weight) + .saturating_add((396_000 as Weight).saturating_mul(w as Weight)) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } - fn initiate_corporate_action_use_defaults(j: u32, k: u32) -> Weight { - (103_340_000 as Weight) - .saturating_add((171_000 as Weight).saturating_mul(j as Weight)) - .saturating_add((127_000 as Weight).saturating_mul(k as Weight)) - .saturating_add(DbWeight::get().reads(17 as Weight)) + fn initiate_corporate_action_use_defaults(w: u32, t: u32) -> Weight { + (424_252_000 as Weight) + .saturating_add((550_000 as Weight).saturating_mul(w as Weight)) + .saturating_add((370_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(DbWeight::get().reads(19 as Weight)) .saturating_add(DbWeight::get().writes(5 as Weight)) } - fn initiate_corporate_action_provided(j: u32, k: u32) -> Weight { - (101_926_000 as Weight) - .saturating_add((150_000 as Weight).saturating_mul(j as Weight)) - .saturating_add((97_000 as Weight).saturating_mul(k as Weight)) - .saturating_add(DbWeight::get().reads(14 as Weight)) + fn initiate_corporate_action_provided(w: u32, t: u32) -> Weight { + (388_825_000 as Weight) + .saturating_add((547_000 as Weight).saturating_mul(w as Weight)) + .saturating_add((541_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(DbWeight::get().reads(16 as Weight)) .saturating_add(DbWeight::get().writes(5 as Weight)) } - fn link_ca_doc(i: u32) -> Weight { + fn link_ca_doc(d: u32) -> Weight { (0 as Weight) - .saturating_add((4_891_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) + .saturating_add((13_381_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(DbWeight::get().reads(10 as Weight)) + .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(d as Weight))) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn remove_ca_with_ballot() -> Weight { - (50_362_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) + (225_479_000 as Weight) + .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(6 as Weight)) } fn remove_ca_with_dist() -> Weight { - (53_469_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) + (211_714_000 as Weight) + .saturating_add(DbWeight::get().reads(12 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } fn change_record_date_with_ballot() -> Weight { - (64_885_000 as Weight) - .saturating_add(DbWeight::get().reads(14 as Weight)) + (241_643_000 as Weight) + .saturating_add(DbWeight::get().reads(16 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } fn change_record_date_with_dist() -> Weight { - (66_906_000 as Weight) - .saturating_add(DbWeight::get().reads(14 as Weight)) + (250_851_000 as Weight) + .saturating_add(DbWeight::get().reads(16 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } } diff --git a/pallets/weights/src/pallet_corporate_ballot.rs b/pallets/weights/src/pallet_corporate_ballot.rs index f056ff590b..e9dd540513 100644 --- a/pallets/weights/src/pallet_corporate_ballot.rs +++ b/pallets/weights/src/pallet_corporate_ballot.rs @@ -3,42 +3,42 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_corporate_actions::ballot::WeightInfo for WeightInfo { - fn attach_ballot(j: u32) -> Weight { - (50_541_000 as Weight) - .saturating_add((17_000 as Weight).saturating_mul(j as Weight)) - .saturating_add(DbWeight::get().reads(11 as Weight)) + fn attach_ballot(c: u32) -> Weight { + (195_816_000 as Weight) + .saturating_add((69_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(DbWeight::get().reads(13 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } - fn vote(j: u32, k: u32) -> Weight { - (53_634_000 as Weight) - .saturating_add((48_000 as Weight).saturating_mul(j as Weight)) - .saturating_add((291_000 as Weight).saturating_mul(k as Weight)) - .saturating_add(DbWeight::get().reads(13 as Weight)) + fn vote(c: u32, t: u32) -> Weight { + (233_490_000 as Weight) + .saturating_add((425_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((482_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(DbWeight::get().reads(15 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn change_end() -> Weight { - (39_831_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (138_579_000 as Weight) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } - fn change_meta(j: u32) -> Weight { - (41_678_000 as Weight) - .saturating_add((18_000 as Weight).saturating_mul(j as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) + fn change_meta(c: u32) -> Weight { + (164_691_000 as Weight) + .saturating_add((53_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn change_rcv() -> Weight { - (39_658_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (136_151_000 as Weight) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn remove_ballot() -> Weight { - (41_601_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (152_330_000 as Weight) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } } diff --git a/pallets/weights/src/pallet_grandpa.rs b/pallets/weights/src/pallet_grandpa.rs new file mode 100644 index 0000000000..21959e9f27 --- /dev/null +++ b/pallets/weights/src/pallet_grandpa.rs @@ -0,0 +1,58 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Default weights for the GRANDPA Pallet +//! This file was not auto-generated. +//! +//! Only the following functions were auto-generated: +//! - `fn note_stalled`. +//! + +use polymesh_runtime_common::{ + RocksDbWeight as DbWeight, Weight, WEIGHT_PER_MICROS, WEIGHT_PER_NANOS, +}; + +pub struct WeightInfo; +impl pallet_grandpa::WeightInfo for WeightInfo { + fn report_equivocation(validator_count: u32) -> Weight { + // we take the validator set count from the membership proof to + // calculate the weight but we set a floor of 100 validators. + let validator_count = validator_count.max(100) as u64; + + // worst case we are considering is that the given offender + // is backed by 200 nominators + const MAX_NOMINATORS: u64 = 200; + + // checking membership proof + (35 * WEIGHT_PER_MICROS) + .saturating_add((175 * WEIGHT_PER_NANOS).saturating_mul(validator_count)) + .saturating_add(DbWeight::get().reads(5)) + // check equivocation proof + .saturating_add(95 * WEIGHT_PER_MICROS) + // report offence + .saturating_add(110 * WEIGHT_PER_MICROS) + .saturating_add(25 * WEIGHT_PER_MICROS * MAX_NOMINATORS) + .saturating_add(DbWeight::get().reads(14 + 3 * MAX_NOMINATORS)) + .saturating_add(DbWeight::get().writes(10 + 3 * MAX_NOMINATORS)) + // fetching set id -> session index mappings + .saturating_add(DbWeight::get().reads(2)) + } + + fn note_stalled() -> Weight { + (4_370_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + } +} diff --git a/pallets/weights/src/pallet_group.rs b/pallets/weights/src/pallet_group.rs index 66a80b25a2..f7dbe26fe4 100644 --- a/pallets/weights/src/pallet_group.rs +++ b/pallets/weights/src/pallet_group.rs @@ -3,45 +3,45 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_group::WeightInfo for WeightInfo { fn set_active_members_limit() -> Weight { - (13_856_000 as Weight) + (41_819_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn add_member() -> Weight { - (466_408_000 as Weight) + (1_568_976_000 as Weight) .saturating_add(DbWeight::get().reads(5 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn remove_member() -> Weight { - (302_678_000 as Weight) + (533_296_000 as Weight) .saturating_add(DbWeight::get().reads(3 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn disable_member() -> Weight { - (325_857_000 as Weight) + (503_416_000 as Weight) .saturating_add(DbWeight::get().reads(5 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn swap_member() -> Weight { - (481_729_000 as Weight) + (1_490_737_000 as Weight) .saturating_add(DbWeight::get().reads(5 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn reset_members(m: u32) -> Weight { (0 as Weight) - .saturating_add((162_848_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((1_116_540_000 as Weight).saturating_mul(m as Weight)) .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(m as Weight))) .saturating_add(DbWeight::get().writes(5 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(m as Weight))) } fn abdicate_membership() -> Weight { - (322_324_000 as Weight) + (474_919_000 as Weight) .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } diff --git a/pallets/weights/src/pallet_identity.rs b/pallets/weights/src/pallet_identity.rs index 6be0f3b071..73932506d7 100644 --- a/pallets/weights/src/pallet_identity.rs +++ b/pallets/weights/src/pallet_identity.rs @@ -3,120 +3,119 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_identity::WeightInfo for WeightInfo { fn register_did(i: u32) -> Weight { - (1_046_105_000 as Weight) - .saturating_add((46_470_000 as Weight).saturating_mul(i as Weight)) + (1_314_848_000 as Weight) + .saturating_add((52_299_000 as Weight).saturating_mul(i as Weight)) .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(i as Weight))) .saturating_add(DbWeight::get().writes(4 as Weight)) .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) } fn cdd_register_did(i: u32) -> Weight { - (122_273_000 as Weight) - .saturating_add((43_383_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(13 as Weight)) + (265_141_000 as Weight) + .saturating_add((50_433_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(DbWeight::get().reads(15 as Weight)) .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(i as Weight))) .saturating_add(DbWeight::get().writes(3 as Weight)) .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) } fn mock_cdd_register_did() -> Weight { - (1_008_860_000 as Weight) - .saturating_add(DbWeight::get().reads(15 as Weight)) + (1_208_967_000 as Weight) + .saturating_add(DbWeight::get().reads(17 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } fn invalidate_cdd_claims() -> Weight { - (120_502_000 as Weight) + (149_596_000 as Weight) .saturating_add(DbWeight::get().reads(5 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn remove_secondary_keys(i: u32) -> Weight { - (103_237_000 as Weight) - .saturating_add((35_247_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) + (118_564_000 as Weight) + .saturating_add((29_835_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(i as Weight))) .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) } fn accept_primary_key() -> Weight { - (197_964_000 as Weight) + (243_410_000 as Weight) .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(7 as Weight)) } fn change_cdd_requirement_for_mk_rotation() -> Weight { - (22_594_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + (26_117_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) } fn join_identity_as_key() -> Weight { - (132_735_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + (200_087_000 as Weight) + .saturating_add(DbWeight::get().reads(11 as Weight)) + .saturating_add(DbWeight::get().writes(5 as Weight)) } fn join_identity_as_identity() -> Weight { - (137_389_000 as Weight) + (167_555_000 as Weight) .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn leave_identity_as_key() -> Weight { - (124_625_000 as Weight) + (151_650_000 as Weight) .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn leave_identity_as_identity() -> Weight { - (88_599_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (120_568_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn add_claim() -> Weight { - (114_218_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) + (166_878_000 as Weight) + .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn forwarded_call() -> Weight { - (137_447_000 as Weight) + (193_571_000 as Weight) .saturating_add(DbWeight::get().reads(14 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn revoke_claim() -> Weight { - (91_988_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (147_402_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn set_permission_to_signer() -> Weight { - (90_823_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) + (125_935_000 as Weight) + .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn freeze_secondary_keys() -> Weight { - (97_326_000 as Weight) + (131_948_000 as Weight) .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn unfreeze_secondary_keys() -> Weight { - (103_487_000 as Weight) + (160_394_000 as Weight) .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn add_authorization() -> Weight { - (85_823_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (152_064_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn remove_authorization() -> Weight { - (91_029_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (127_741_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn revoke_offchain_authorization() -> Weight { - (73_080_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) + (111_695_000 as Weight) + .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn add_investor_uniqueness_claim() -> Weight { - (1_559_696_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) + (2_067_866_000 as Weight) + .saturating_add(DbWeight::get().reads(12 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } } diff --git a/pallets/weights/src/pallet_im_online.rs b/pallets/weights/src/pallet_im_online.rs index 22b61b0beb..63d6836802 100644 --- a/pallets/weights/src/pallet_im_online.rs +++ b/pallets/weights/src/pallet_im_online.rs @@ -3,18 +3,18 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_im_online::WeightInfo for WeightInfo { fn heartbeat(k: u32, e: u32) -> Weight { - (92_568_000 as Weight) - .saturating_add((120_000 as Weight).saturating_mul(k as Weight)) - .saturating_add((860_000 as Weight).saturating_mul(e as Weight)) + (88_105_000 as Weight) + .saturating_add((189_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((1_038_000 as Weight).saturating_mul(e as Weight)) .saturating_add(DbWeight::get().reads(3 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn set_slashing_params() -> Weight { - (41_453_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + (32_278_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) } } diff --git a/pallets/weights/src/pallet_indices.rs b/pallets/weights/src/pallet_indices.rs new file mode 100644 index 0000000000..d6f2dea49c --- /dev/null +++ b/pallets/weights/src/pallet_indices.rs @@ -0,0 +1,35 @@ +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; + +pub struct WeightInfo; +impl pallet_indices::WeightInfo for WeightInfo { + fn claim() -> Weight { + (77_883_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn transfer() -> Weight { + (87_479_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + fn free() -> Weight { + (69_858_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn force_transfer() -> Weight { + (66_749_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + fn freeze() -> Weight { + (64_130_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } +} diff --git a/pallets/weights/src/pallet_multisig.rs b/pallets/weights/src/pallet_multisig.rs index a42960ad5e..9749a7b817 100644 --- a/pallets/weights/src/pallet_multisig.rs +++ b/pallets/weights/src/pallet_multisig.rs @@ -3,109 +3,109 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_multisig::WeightInfo for WeightInfo { fn create_multisig(i: u32) -> Weight { - (153_090_000 as Weight) - .saturating_add((29_605_000 as Weight).saturating_mul(i as Weight)) + (104_336_000 as Weight) + .saturating_add((38_405_000 as Weight).saturating_mul(i as Weight)) .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) } fn create_or_approve_proposal_as_identity() -> Weight { - (220_924_000 as Weight) + (277_096_000 as Weight) .saturating_add(DbWeight::get().reads(12 as Weight)) .saturating_add(DbWeight::get().writes(7 as Weight)) } fn create_or_approve_proposal_as_key() -> Weight { - (456_470_000 as Weight) + (247_915_000 as Weight) .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(7 as Weight)) } fn create_proposal_as_identity() -> Weight { - (343_001_000 as Weight) + (280_110_000 as Weight) .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(7 as Weight)) } fn create_proposal_as_key() -> Weight { - (260_906_000 as Weight) + (251_242_000 as Weight) .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().writes(7 as Weight)) } fn approve_as_identity() -> Weight { - (184_369_000 as Weight) + (214_165_000 as Weight) .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } fn approve_as_key() -> Weight { - (160_576_000 as Weight) + (186_123_000 as Weight) .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } fn reject_as_identity() -> Weight { - (127_077_000 as Weight) + (141_560_000 as Weight) .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn reject_as_key() -> Weight { - (105_077_000 as Weight) + (114_781_000 as Weight) .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn accept_multisig_signer_as_identity() -> Weight { - (147_207_000 as Weight) + (180_363_000 as Weight) .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } fn accept_multisig_signer_as_key() -> Weight { - (141_689_000 as Weight) + (160_814_000 as Weight) .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(5 as Weight)) } fn add_multisig_signer() -> Weight { - (84_198_000 as Weight) + (88_138_000 as Weight) .saturating_add(DbWeight::get().reads(2 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn remove_multisig_signer() -> Weight { - (81_636_000 as Weight) + (105_736_000 as Weight) .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn add_multisig_signers_via_creator(i: u32) -> Weight { (0 as Weight) - .saturating_add((45_151_000 as Weight).saturating_mul(i as Weight)) + .saturating_add((56_157_000 as Weight).saturating_mul(i as Weight)) .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) } fn remove_multisig_signers_via_creator(i: u32) -> Weight { - (162_217_000 as Weight) - .saturating_add((33_020_000 as Weight).saturating_mul(i as Weight)) + (142_465_000 as Weight) + .saturating_add((42_409_000 as Weight).saturating_mul(i as Weight)) .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) .saturating_add(DbWeight::get().writes(1 as Weight)) .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) } fn change_sigs_required() -> Weight { - (74_364_000 as Weight) + (74_539_000 as Weight) .saturating_add(DbWeight::get().reads(4 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn make_multisig_signer() -> Weight { - (95_135_000 as Weight) + (98_102_000 as Weight) .saturating_add(DbWeight::get().reads(5 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn make_multisig_primary() -> Weight { - (113_158_000 as Weight) + (150_241_000 as Weight) .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn execute_scheduled_proposal() -> Weight { - (124_830_000 as Weight) + (156_292_000 as Weight) .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } diff --git a/pallets/weights/src/pallet_pips.rs b/pallets/weights/src/pallet_pips.rs index cebed91556..466f398737 100644 --- a/pallets/weights/src/pallet_pips.rs +++ b/pallets/weights/src/pallet_pips.rs @@ -3,94 +3,106 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_pips::WeightInfo for WeightInfo { fn set_prune_historical_pips() -> Weight { - (67_677_000 as Weight) + (50_355_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn set_min_proposal_deposit() -> Weight { - (69_150_000 as Weight) + (51_155_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn set_default_enactment_period() -> Weight { - (68_348_000 as Weight) + (49_892_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn set_pending_pip_expiry() -> Weight { - (69_299_000 as Weight) + (58_089_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn set_max_pip_skip_count() -> Weight { - (67_736_000 as Weight) + (49_843_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn set_active_pip_limit() -> Weight { - (67_536_000 as Weight) + (50_705_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn propose_from_community() -> Weight { - (501_489_000 as Weight) + (381_663_000 as Weight) .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(9 as Weight)) + .saturating_add(DbWeight::get().writes(10 as Weight)) } fn propose_from_committee() -> Weight { - (303_359_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (213_730_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(5 as Weight)) } fn vote() -> Weight { - (247_883_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + (513_931_000 as Weight) + .saturating_add(DbWeight::get().reads(6 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) } fn approve_committee_proposal() -> Weight { - (250_670_000 as Weight) + (247_313_000 as Weight) .saturating_add(DbWeight::get().reads(4 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } fn reject_proposal() -> Weight { - (309_279_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + (344_515_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) + .saturating_add(DbWeight::get().writes(10 as Weight)) } fn prune_proposal() -> Weight { - (173_764_000 as Weight) + (185_066_000 as Weight) .saturating_add(DbWeight::get().reads(2 as Weight)) .saturating_add(DbWeight::get().writes(5 as Weight)) } fn reschedule_execution() -> Weight { - (300_242_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (326_310_000 as Weight) + .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().writes(6 as Weight)) } fn clear_snapshot() -> Weight { - (60_694_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) + (111_949_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn snapshot() -> Weight { - (1_012_000 as Weight) + (1_537_755_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) } - fn enact_snapshot_results() -> Weight { - (1_031_000 as Weight) + fn enact_snapshot_results(a: u32, r: u32, s: u32) -> Weight { + (0 as Weight) + .saturating_add((1_129_852_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((32_682_393_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(DbWeight::get().reads(688 as Weight)) + .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(a as Weight))) + .saturating_add(DbWeight::get().reads((405 as Weight).saturating_mul(r as Weight))) + .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) + .saturating_add(DbWeight::get().writes(684 as Weight)) + .saturating_add(DbWeight::get().writes((4 as Weight).saturating_mul(a as Weight))) + .saturating_add(DbWeight::get().writes((404 as Weight).saturating_mul(r as Weight))) + .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight))) } fn execute_scheduled_pip() -> Weight { - (27_295_612_000 as Weight) + (34_533_173_000 as Weight) .saturating_add(DbWeight::get().reads(1205 as Weight)) - .saturating_add(DbWeight::get().writes(1203 as Weight)) + .saturating_add(DbWeight::get().writes(1606 as Weight)) } fn expire_scheduled_pip() -> Weight { - (27_159_358_000 as Weight) - .saturating_add(DbWeight::get().reads(1204 as Weight)) - .saturating_add(DbWeight::get().writes(1202 as Weight)) + (32_083_813_000 as Weight) + .saturating_add(DbWeight::get().reads(1207 as Weight)) + .saturating_add(DbWeight::get().writes(1607 as Weight)) } } diff --git a/pallets/weights/src/pallet_portfolio.rs b/pallets/weights/src/pallet_portfolio.rs index fedd316e03..4b0ed0958d 100644 --- a/pallets/weights/src/pallet_portfolio.rs +++ b/pallets/weights/src/pallet_portfolio.rs @@ -3,32 +3,32 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_portfolio::WeightInfo for WeightInfo { - fn create_portfolio(i: u32) -> Weight { - (90_961_000 as Weight) - .saturating_add((8_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) + // WARNING! Some components were not used: ["i"] + fn create_portfolio(_i: u32) -> Weight { + (135_558_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn delete_portfolio() -> Weight { - (77_040_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (125_649_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } - fn move_portfolio_funds(i: u32) -> Weight { + fn move_portfolio_funds(a: u32) -> Weight { (0 as Weight) - .saturating_add((57_327_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(i as Weight))) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) + .saturating_add((66_353_000 as Weight).saturating_mul(a as Weight)) + .saturating_add(DbWeight::get().reads(8 as Weight)) + .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(a as Weight))) + .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(a as Weight))) } fn rename_portfolio(i: u32) -> Weight { - (99_192_000 as Weight) - .saturating_add((35_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (149_813_000 as Weight) + .saturating_add((33_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } } diff --git a/pallets/weights/src/pallet_protocol_fee.rs b/pallets/weights/src/pallet_protocol_fee.rs index a7ef8dffff..3561c1d701 100644 --- a/pallets/weights/src/pallet_protocol_fee.rs +++ b/pallets/weights/src/pallet_protocol_fee.rs @@ -3,20 +3,19 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_protocol_fee::WeightInfo for WeightInfo { // WARNING! Some components were not used: ["n", "d"] fn change_coefficient() -> Weight { - (166_338_000 as Weight) + (36_847_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } - // WARNING! Some components were not used: ["b"] fn change_base_fee() -> Weight { - (146_871_000 as Weight) + (39_973_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } diff --git a/pallets/weights/src/pallet_scheduler.rs b/pallets/weights/src/pallet_scheduler.rs new file mode 100644 index 0000000000..f36f448e41 --- /dev/null +++ b/pallets/weights/src/pallet_scheduler.rs @@ -0,0 +1,34 @@ +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; + +pub struct WeightInfo; +impl pallet_scheduler::WeightInfo for WeightInfo { + fn schedule(s: u32) -> Weight { + (48_941_000 as Weight) + .saturating_add((175_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn cancel(s: u32) -> Weight { + (44_143_000 as Weight) + .saturating_add((6_825_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + fn schedule_named(s: u32) -> Weight { + (62_871_000 as Weight) + .saturating_add((198_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + fn cancel_named(s: u32) -> Weight { + (52_205_000 as Weight) + .saturating_add((6_616_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } +} diff --git a/pallets/weights/src/pallet_session.rs b/pallets/weights/src/pallet_session.rs new file mode 100644 index 0000000000..d65f9f4fdb --- /dev/null +++ b/pallets/weights/src/pallet_session.rs @@ -0,0 +1,20 @@ +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; + +pub struct WeightInfo; +impl pallet_session::WeightInfo for WeightInfo { + fn set_keys() -> Weight { + (154_660_000 as Weight) + .saturating_add(DbWeight::get().reads(6 as Weight)) + .saturating_add(DbWeight::get().writes(5 as Weight)) + } + fn purge_keys() -> Weight { + (115_473_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(5 as Weight)) + } +} diff --git a/pallets/weights/src/pallet_settlement.rs b/pallets/weights/src/pallet_settlement.rs index 33a331fb5e..faa216626e 100644 --- a/pallets/weights/src/pallet_settlement.rs +++ b/pallets/weights/src/pallet_settlement.rs @@ -3,145 +3,145 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_settlement::WeightInfo for WeightInfo { fn create_venue(d: u32, s: u32) -> Weight { - (35_964_000 as Weight) - .saturating_add((8_000 as Weight).saturating_mul(d as Weight)) - .saturating_add((9_949_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (118_442_000 as Weight) + .saturating_add((10_000 as Weight).saturating_mul(d as Weight)) + .saturating_add((7_107_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) } fn update_venue(d: u32) -> Weight { - (97_675_000 as Weight) - .saturating_add((9_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (105_721_000 as Weight) + .saturating_add((11_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn add_instruction(l: u32) -> Weight { - (152_295_000 as Weight) - .saturating_add((43_097_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (134_326_000 as Weight) + .saturating_add((32_767_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(l as Weight))) .saturating_add(DbWeight::get().writes(1 as Weight)) .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(l as Weight))) } fn add_instruction_with_settle_on_block_type(l: u32) -> Weight { - (294_553_000 as Weight) - .saturating_add((64_472_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (205_421_000 as Weight) + .saturating_add((31_716_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(l as Weight))) .saturating_add(DbWeight::get().writes(3 as Weight)) .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(l as Weight))) } fn add_and_affirm_instruction(l: u32) -> Weight { - (395_808_000 as Weight) - .saturating_add((267_614_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (239_157_000 as Weight) + .saturating_add((135_911_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(l as Weight))) .saturating_add(DbWeight::get().writes(4 as Weight)) .saturating_add(DbWeight::get().writes((6 as Weight).saturating_mul(l as Weight))) } fn add_and_affirm_instruction_with_settle_on_block_type(l: u32) -> Weight { - (473_229_000 as Weight) - .saturating_add((154_220_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(10 as Weight)) + (326_808_000 as Weight) + .saturating_add((138_816_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(12 as Weight)) .saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(l as Weight))) .saturating_add(DbWeight::get().writes(6 as Weight)) .saturating_add(DbWeight::get().writes((6 as Weight).saturating_mul(l as Weight))) } fn set_venue_filtering() -> Weight { - (175_328_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (121_493_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn set_venue_filtering_disallow() -> Weight { - (175_828_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (130_614_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn allow_venues(v: u32) -> Weight { - (272_932_000 as Weight) - .saturating_add((8_668_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (119_918_000 as Weight) + .saturating_add((6_411_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(v as Weight))) } fn disallow_venues(v: u32) -> Weight { - (246_220_000 as Weight) - .saturating_add((6_935_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (112_796_000 as Weight) + .saturating_add((6_329_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(v as Weight))) } fn withdraw_affirmation(l: u32) -> Weight { - (23_476_000 as Weight) - .saturating_add((209_523_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (119_739_000 as Weight) + .saturating_add((117_028_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(l as Weight))) .saturating_add(DbWeight::get().writes(1 as Weight)) .saturating_add(DbWeight::get().writes((4 as Weight).saturating_mul(l as Weight))) } fn withdraw_affirmation_with_receipt(l: u32) -> Weight { - (140_720_000 as Weight) - .saturating_add((113_833_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (151_539_000 as Weight) + .saturating_add((113_121_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(l as Weight))) .saturating_add(DbWeight::get().writes(1 as Weight)) .saturating_add(DbWeight::get().writes((4 as Weight).saturating_mul(l as Weight))) } fn unclaim_receipt() -> Weight { - (170_668_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) + (193_393_000 as Weight) + .saturating_add(DbWeight::get().reads(12 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn reject_instruction(l: u32) -> Weight { - (173_449_000 as Weight) - .saturating_add((139_795_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(9 as Weight)) + (219_654_000 as Weight) + .saturating_add((130_999_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(l as Weight))) .saturating_add(DbWeight::get().writes(3 as Weight)) .saturating_add(DbWeight::get().writes((4 as Weight).saturating_mul(l as Weight))) } fn reject_instruction_with_no_pre_affirmations(l: u32) -> Weight { - (177_026_000 as Weight) - .saturating_add((54_983_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(9 as Weight)) + (237_721_000 as Weight) + .saturating_add((46_777_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(11 as Weight)) .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(l as Weight))) .saturating_add(DbWeight::get().writes(3 as Weight)) .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(l as Weight))) } fn affirm_instruction(l: u32) -> Weight { - (0 as Weight) - .saturating_add((147_286_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(l as Weight))) + (184_867_000 as Weight) + .saturating_add((71_840_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(11 as Weight)) + .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(l as Weight))) .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(l as Weight))) + .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(l as Weight))) } fn claim_receipt() -> Weight { - (582_962_000 as Weight) - .saturating_add(DbWeight::get().reads(11 as Weight)) + (290_864_000 as Weight) + .saturating_add(DbWeight::get().reads(13 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } fn affirm_with_receipts(r: u32) -> Weight { - (909_386_000 as Weight) - .saturating_add((209_440_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) + (173_739_000 as Weight) + .saturating_add((197_611_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(r as Weight))) .saturating_add(DbWeight::get().writes(1 as Weight)) .saturating_add(DbWeight::get().writes((4 as Weight).saturating_mul(r as Weight))) } - fn execute_scheduled_instruction(l: u32, s: u32, c: u32) -> Weight { + fn execute_scheduled_instruction(l: u32) -> Weight { (0 as Weight) - .saturating_add((4_097_117_000 as Weight).saturating_mul(l as Weight)) - .saturating_add((3_695_656_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((213_719_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().reads((13 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(c as Weight))) - .saturating_add(DbWeight::get().writes(7 as Weight)) - .saturating_add(DbWeight::get().writes((10 as Weight).saturating_mul(l as Weight))) + .saturating_add((2_698_678_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(4 as Weight)) + .saturating_add(DbWeight::get().reads((76 as Weight).saturating_mul(l as Weight))) + .saturating_add(DbWeight::get().writes(3 as Weight)) + .saturating_add(DbWeight::get().writes((14 as Weight).saturating_mul(l as Weight))) + } + fn change_receipt_validity() -> Weight { + (200_000_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) } } diff --git a/pallets/weights/src/pallet_staking.rs b/pallets/weights/src/pallet_staking.rs new file mode 100644 index 0000000000..36c0bf1a43 --- /dev/null +++ b/pallets/weights/src/pallet_staking.rs @@ -0,0 +1,218 @@ +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; + +pub struct WeightInfo; +impl pallet_staking::WeightInfo for WeightInfo { + fn bond() -> Weight { + (117_920_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(5 as Weight)) + } + fn bond_extra() -> Weight { + (103_834_000 as Weight) + .saturating_add(DbWeight::get().reads(6 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) + } + fn unbond() -> Weight { + (102_511_000 as Weight) + .saturating_add(DbWeight::get().reads(6 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) + } + fn withdraw_unbonded_update(s: u32) -> Weight { + (76_821_000 as Weight) + .saturating_add((253_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(5 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) + } + fn withdraw_unbonded_kill(s: u32) -> Weight { + (140_836_000 as Weight) + .saturating_add((1_496_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(7 as Weight)) + .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn set_min_bond_threshold() -> Weight { + (24_065_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn add_permissioned_validator() -> Weight { + (124_643_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn remove_permissioned_validator() -> Weight { + (42_399_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_commission_cap(m: u32) -> Weight { + (56_300_000 as Weight) + .saturating_add((25_053_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(m as Weight))) + .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(m as Weight))) + } + fn validate() -> Weight { + (80_160_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) + } + fn nominate(n: u32) -> Weight { + (136_451_000 as Weight) + .saturating_add((4_769_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(DbWeight::get().reads(11 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) + } + fn chill() -> Weight { + (57_444_000 as Weight) + .saturating_add(DbWeight::get().reads(5 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) + } + fn set_payee() -> Weight { + (29_842_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_controller() -> Weight { + (70_035_000 as Weight) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) + } + fn set_validator_count() -> Weight { + (1_941_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn force_no_eras() -> Weight { + (1_873_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn force_new_era() -> Weight { + (1_854_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn force_new_era_always() -> Weight { + (1_854_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_invulnerables(v: u32) -> Weight { + (2_109_000 as Weight) + .saturating_add((11_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn force_unstake(s: u32) -> Weight { + (50_902_000 as Weight) + .saturating_add((1_932_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(4 as Weight)) + .saturating_add(DbWeight::get().writes(7 as Weight)) + .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn cancel_deferred_slash(s: u32) -> Weight { + (782_599_000 as Weight) + .saturating_add((1_743_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn payout_stakers(n: u32) -> Weight { + (267_975_000 as Weight) + .saturating_add((123_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(DbWeight::get().reads(13 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) + } + // WARNING! Some components were not used: ["n"] + fn payout_stakers_alive_controller() -> Weight { + (466_343_000 as Weight) + .saturating_add(DbWeight::get().reads(13 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) + } + fn rebond(l: u32) -> Weight { + (28_015_000 as Weight) + .saturating_add((4_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(4 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) + } + fn set_history_depth(e: u32) -> Weight { + (0 as Weight) + .saturating_add((30_172_000 as Weight).saturating_mul(e as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) + .saturating_add(DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight))) + } + fn reap_stash(s: u32) -> Weight { + (43_183_000 as Weight) + .saturating_add((822_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(4 as Weight)) + .saturating_add(DbWeight::get().writes(8 as Weight)) + .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn new_era(v: u32, n: u32) -> Weight { + (0 as Weight) + .saturating_add((1_886_613_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((212_212_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(DbWeight::get().reads(19 as Weight)) + .saturating_add(DbWeight::get().reads((9 as Weight).saturating_mul(v as Weight))) + .saturating_add(DbWeight::get().reads((7 as Weight).saturating_mul(n as Weight))) + .saturating_add(DbWeight::get().writes(8 as Weight)) + .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight))) + } + fn do_slash(l: u32) -> Weight { + (72_382_000 as Weight) + .saturating_add((21_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + fn payout_all(v: u32, n: u32) -> Weight { + (0 as Weight) + .saturating_add((3_222_276_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((288_148_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(DbWeight::get().reads((58 as Weight).saturating_mul(v as Weight))) + .saturating_add(DbWeight::get().reads((6 as Weight).saturating_mul(n as Weight))) + .saturating_add(DbWeight::get().writes((34 as Weight).saturating_mul(v as Weight))) + .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight))) + } + // WARNING! Some components were not used: ["n"] + fn submit_solution_initial(v: u32, a: u32, w: u32) -> Weight { + (0 as Weight) + .saturating_add((1_114_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((64_658_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((135_090_000 as Weight).saturating_mul(w as Weight)) + .saturating_add(DbWeight::get().reads(6 as Weight)) + .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight))) + .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight))) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + fn submit_solution_better(v: u32, n: u32, a: u32, w: u32) -> Weight { + (0 as Weight) + .saturating_add((16_556_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((16_923_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((121_063_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((69_411_000 as Weight).saturating_mul(w as Weight)) + .saturating_add(DbWeight::get().reads(6 as Weight)) + .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight))) + .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight))) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + // WARNING! Some components were not used: ["v"] + fn submit_solution_weaker(n: u32) -> Weight { + (72_872_000 as Weight) + .saturating_add((21_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(DbWeight::get().reads(3 as Weight)) + } + fn change_slashing_allowed_for() -> Weight { + (85_940_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn update_permissioned_validator_intended_count() -> Weight { + (44_183_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn increase_validator_count() -> Weight { + (12_443_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn scale_validator_count() -> Weight { + (22_453_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } +} diff --git a/pallets/weights/src/pallet_statistics.rs b/pallets/weights/src/pallet_statistics.rs index 6a48b4251e..741cec4662 100644 --- a/pallets/weights/src/pallet_statistics.rs +++ b/pallets/weights/src/pallet_statistics.rs @@ -3,30 +3,30 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_statistics::WeightInfo for WeightInfo { fn add_transfer_manager() -> Weight { - (86_020_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (149_632_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn remove_transfer_manager() -> Weight { - (84_504_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (132_138_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn add_exempted_entities(i: u32) -> Weight { - (71_697_000 as Weight) - .saturating_add((6_229_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (109_251_000 as Weight) + .saturating_add((8_187_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) } fn remove_exempted_entities(i: u32) -> Weight { - (74_563_000 as Weight) - .saturating_add((6_024_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (89_088_000 as Weight) + .saturating_add((8_008_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) } } diff --git a/pallets/weights/src/pallet_sto.rs b/pallets/weights/src/pallet_sto.rs new file mode 100644 index 0000000000..7952058de4 --- /dev/null +++ b/pallets/weights/src/pallet_sto.rs @@ -0,0 +1,41 @@ +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; + +pub struct WeightInfo; +impl pallet_sto::WeightInfo for WeightInfo { + // WARNING! Some components were not used: ["i"] + fn create_fundraiser(_i: u32) -> Weight { + (233_299_000 as Weight) + .saturating_add(DbWeight::get().reads(13 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) + } + fn invest() -> Weight { + (5_744_445_000 as Weight) + .saturating_add(DbWeight::get().reads(159 as Weight)) + .saturating_add(DbWeight::get().writes(30 as Weight)) + } + fn freeze_fundraiser() -> Weight { + (155_155_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn unfreeze_fundraiser() -> Weight { + (166_632_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn modify_fundraiser_window() -> Weight { + (135_027_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn stop() -> Weight { + (160_263_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } +} diff --git a/pallets/weights/src/pallet_timestamp.rs b/pallets/weights/src/pallet_timestamp.rs index fe069cb118..c7b3daf9c0 100644 --- a/pallets/weights/src/pallet_timestamp.rs +++ b/pallets/weights/src/pallet_timestamp.rs @@ -1,19 +1,19 @@ -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_timestamp::WeightInfo for WeightInfo { fn set() -> Weight { - (5191000 as Weight) + (14_821_000 as Weight) .saturating_add(DbWeight::get().reads(2 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } // WARNING! Some components were not used: ["t"] fn on_finalize() -> Weight { - (3693000 as Weight) + (8_108_000 as Weight) } } diff --git a/pallets/weights/src/pallet_treasury.rs b/pallets/weights/src/pallet_treasury.rs index 682dfcb413..03dd970e5d 100644 --- a/pallets/weights/src/pallet_treasury.rs +++ b/pallets/weights/src/pallet_treasury.rs @@ -3,20 +3,20 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl pallet_treasury::WeightInfo for WeightInfo { fn disbursement(b: u32) -> Weight { - (15_798_000 as Weight) - .saturating_add((66_933_000 as Weight).saturating_mul(b as Weight)) + (59_030_000 as Weight) + .saturating_add((77_892_000 as Weight).saturating_mul(b as Weight)) .saturating_add(DbWeight::get().reads(3 as Weight)) .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(b as Weight))) .saturating_add(DbWeight::get().writes(2 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight))) } fn reimbursement() -> Weight { - (200_441_000 as Weight) + (265_900_000 as Weight) .saturating_add(DbWeight::get().reads(10 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } diff --git a/pallets/weights/src/pallet_utility.rs b/pallets/weights/src/pallet_utility.rs index 38e583c5f1..3953e81446 100644 --- a/pallets/weights/src/pallet_utility.rs +++ b/pallets/weights/src/pallet_utility.rs @@ -8,7 +8,7 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, GetDispatchInfo, Weight}; +use polymesh_runtime_common::{GetDispatchInfo, RocksDbWeight as DbWeight, Weight}; fn sum_weights(calls: &[impl GetDispatchInfo]) -> Weight { calls @@ -20,30 +20,30 @@ fn sum_weights(calls: &[impl GetDispatchInfo]) -> Weight { pub struct WeightInfo; impl pallet_utility::WeightInfo for WeightInfo { fn batch(calls: &[impl GetDispatchInfo]) -> Weight { - (1_626_631_000 as Weight) + (32_338_000 as Weight) .saturating_add(sum_weights(calls)) - .saturating_add(DbWeight::get().reads(4 as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn batch_atomic(calls: &[impl GetDispatchInfo]) -> Weight { - (2_199_621_000 as Weight) + (53_986_000 as Weight) .saturating_add(sum_weights(calls)) - .saturating_add(DbWeight::get().reads(4 as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn batch_optimistic(calls: &[impl GetDispatchInfo]) -> Weight { - (1_644_681_000 as Weight) + (44_239_000 as Weight) .saturating_add(sum_weights(calls)) - .saturating_add(DbWeight::get().reads(4 as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn relay_tx(call: &impl GetDispatchInfo) -> Weight { - (4_165_502_000 as Weight) + (245_921_000 as Weight) .saturating_add(call.get_dispatch_info().weight) - .saturating_add(DbWeight::get().reads(12 as Weight)) + .saturating_add(DbWeight::get().reads(14 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } } diff --git a/pallets/weights/src/polymesh_contracts.rs b/pallets/weights/src/polymesh_contracts.rs index 9860813351..0fd1418aad 100644 --- a/pallets/weights/src/polymesh_contracts.rs +++ b/pallets/weights/src/polymesh_contracts.rs @@ -3,51 +3,51 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; pub struct WeightInfo; impl polymesh_contracts::WeightInfo for WeightInfo { - // WARNING! Some components were not used: ["d"] - fn put_code(l: u32, u: u32, _d: u32) -> Weight { - (2_377_166_000 as Weight) - .saturating_add((306_000 as Weight).saturating_mul(l as Weight)) - .saturating_add((6_000 as Weight).saturating_mul(u as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) + fn put_code(l: u32, u: u32, d: u32) -> Weight { + (0 as Weight) + .saturating_add((254_000 as Weight).saturating_mul(l as Weight)) + .saturating_add((16_000 as Weight).saturating_mul(u as Weight)) + .saturating_add((18_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(DbWeight::get().reads(9 as Weight)) .saturating_add(DbWeight::get().writes(4 as Weight)) } fn instantiate() -> Weight { - (840_235_000 as Weight) - .saturating_add(DbWeight::get().reads(18 as Weight)) + (1_661_897_000 as Weight) + .saturating_add(DbWeight::get().reads(19 as Weight)) .saturating_add(DbWeight::get().writes(6 as Weight)) } fn freeze_instantiation() -> Weight { - (189_935_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (120_473_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn unfreeze_instantiation() -> Weight { - (216_966_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) + (129_928_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn transfer_template_ownership() -> Weight { - (277_409_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) + (199_388_000 as Weight) + .saturating_add(DbWeight::get().reads(12 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn change_template_fees() -> Weight { - (208_510_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (2_470_203_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } fn change_template_meta_url(u: u32) -> Weight { - (1_131_628_000 as Weight) - .saturating_add((8_000 as Weight).saturating_mul(u as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) + (2_278_567_000 as Weight) + .saturating_add((10_000 as Weight).saturating_mul(u as Weight)) + .saturating_add(DbWeight::get().reads(8 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } fn update_schedule() -> Weight { - (38_993_000 as Weight) + (36_380_000 as Weight) .saturating_add(DbWeight::get().reads(1 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } diff --git a/polymesh_schema.json b/polymesh_schema.json index 47a0bc9404..914454fa71 100644 --- a/polymesh_schema.json +++ b/polymesh_schema.json @@ -1,5 +1,11 @@ { "types": { + "AccountInfo": "AccountInfoWithRefCount", + "Address": "IndicesLookupSource", + "LookupSource": "IndicesLookupSource", + "ValidatorPrefsWithBlocked": { + "commission": "Compact" + }, "IdentityId": "[u8; 32]", "EventDid": "IdentityId", "InvestorUid": "[u8; 16]", @@ -391,7 +397,7 @@ "Custom": "Vec" } }, - "InvestorZKProofData": "[u8;64]", + "InvestorZKProofData": "Signature", "Claim": { "_enum": { "Accredited": "Scope", @@ -882,10 +888,6 @@ "CddVerified": "" } }, - "IssueAssetItem": { - "identity_did": "IdentityId", - "value": "Balance" - }, "PortfolioName": "Text", "PortfolioNumber": "u64", "PortfolioKind": { @@ -932,11 +934,13 @@ "StoredSchedule": { "schedule": "CheckpointSchedule", "id": "ScheduleId", - "at": "Moment" + "at": "Moment", + "remaining": "u32" }, "ScheduleSpec": { "start": "Option", - "period": "CalendarPeriod" + "period": "CalendarPeriod", + "remaining": "u32" }, "InstructionStatus": { "_enum": { @@ -1026,7 +1030,8 @@ "_enum": [ "Live", "Frozen", - "Closed" + "Closed", + "ClosedEarly" ] }, "FundraiserTier": { @@ -1087,7 +1092,7 @@ "CADetails": "Text", "CACheckpoint": { "_enum": { - "Scheduled": "ScheduleId", + "Scheduled": "(ScheduleId, u64)", "Existing": "CheckpointId" } }, @@ -1357,7 +1362,7 @@ "isOptional": true } ], - "type": "HistoricalVoting" + "type": "HistoricalVotingByAddress" }, "votingHistoryById": { "description": "Retrieve historical voting of `id` identity", @@ -1373,7 +1378,7 @@ "isOptional": true } ], - "type": "HistoricalVotingByAddress" + "type": "HistoricalVotingById" } }, "protocolFee": { @@ -1454,30 +1459,6 @@ ], "type": "CanTransferResult" } - }, - "portfolio": { - "getPortfolios": { - "description": "Gets all user-defined portfolio names of an identity", - "params": [ - { - "name": "did", - "type": "IdentityId", - "isOptional": false - } - ], - "type": "GetPortfoliosResult" - }, - "getPortfolioAssets": { - "description": "Gets the balances of all assets in a given portfolio", - "params": [ - { - "name": "portfolio_id", - "type": "PortfolioId", - "isOptional": false - } - ], - "type": "GetPortfolioAssetsResult" - } } } } diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index bbe84271b7..fa8e9f1c0c 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -14,23 +14,23 @@ polymesh-primitives-derive = { path = "../primitives_derive", default-features = serde = { version = "1.0.104", optional = true, default-features = false, features = ["derive"] } # Crypto -confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "v2.2.0" } +confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "v2.2.2" } schnorrkel = { git = "https://github.com/PolymathNetwork/schnorrkel.git", branch = "fix-simd-issue", default-features = false } blake2 = { version = "0.9.0", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } -sp-core = { package = "sp-core", git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime = { package = "sp-runtime", git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-runtime-interface = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { package = "sp-core", git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-std = { package = "sp-std", git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime = { package = "sp-runtime", git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-runtime-interface = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-application-crypto = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, optional = true, tag = "v2.0.1-1" } [dev-dependencies] hex = { version = "^0.4.0", default-features = false } diff --git a/primitives/src/asset.rs b/primitives/src/asset.rs new file mode 100644 index 0000000000..74e95fcb3c --- /dev/null +++ b/primitives/src/asset.rs @@ -0,0 +1,72 @@ +// This file is part of the Polymesh distribution (https://github.com/PolymathNetwork/Polymesh). +// Copyright (c) 2020 Polymath + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3. + +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use codec::{Decode, Encode}; +use polymesh_primitives_derive::VecU8StrongTyped; +use sp_std::prelude::Vec; + +/// A wrapper for a token name. +#[derive( + Decode, Encode, Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord, VecU8StrongTyped, +)] +pub struct AssetName(pub Vec); + +/// The type of security represented by a token. +#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq)] +pub enum AssetType { + /// Common stock - a security that represents ownership in a corporation. + EquityCommon, + /// Preferred stock. Preferred stockholders have a higher claim to dividends or asset + /// distribution than common stockholders. + EquityPreferred, + /// Commodity - a basic good used in commerce that is interchangeable with other commodities of + /// the same type. + Commodity, + /// Fixed income security - an investment that provides a return in the form of fixed periodic + /// interest payments and the eventual return of principal at maturity. Examples: bonds, + /// treasury bills, certificates of deposit. + FixedIncome, + /// Real estate investment trust - a company that owns, operates, or finances income-producing + /// properties. + REIT, + /// Investment fund - a supply of capital belonging to numerous investors used to collectively + /// purchase securities while each investor retains ownership and control of his own shares. + Fund, + /// Revenue share partnership agreement - a document signed by all partners in a partnership + /// that has procedures when distributing business profits or losses. + RevenueShareAgreement, + /// Structured product, aka market-linked investment - a pre-packaged structured finance + /// investment strategy based on a single security, a basket of securities, options, indices, + /// commodities, debt issuance or foreign currencies, and to a lesser extent, derivatives. + StructuredProduct, + /// Derivative contract - a contract between two parties for buying or selling a security at a + /// predetermined price within a specific time period. Examples: forwards, futures, options or + /// swaps. + Derivative, + /// Anything else. + Custom(Vec), +} + +impl Default for AssetType { + fn default() -> Self { + Self::Custom(b"undefined".to_vec()) + } +} + +/// A wrapper for a funding round name. +#[derive( + Decode, Encode, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Default, VecU8StrongTyped, +)] +pub struct FundingRoundName(pub Vec); diff --git a/primitives/src/asset_identifier.rs b/primitives/src/asset_identifier.rs index 99fe5442d5..e73c22500a 100644 --- a/primitives/src/asset_identifier.rs +++ b/primitives/src/asset_identifier.rs @@ -82,18 +82,18 @@ impl AssetIdentifier { }) .rev() .enumerate() - .fold((0, 0), |(mut s1, mut s2), (i, digit)| { + .fold((0u8, 0u8), |(mut s1, mut s2), (i, digit)| { if i % 2 == 0 { - s1 += digit; + s1 = s1.wrapping_add(digit); } else { - s2 += 2 * digit; + s2 = s2.wrapping_add(2u8.wrapping_mul(digit)); if digit >= 5 { - s2 -= 9; + s2 = s2.wrapping_sub(9); } } (s1, s2) }); - ((s1 + s2) % 10 == 0).then_some(AssetIdentifier::ISIN(bytes)) + (s1.wrapping_add(s2) % 10 == 0).then_some(AssetIdentifier::ISIN(bytes)) } /// Validate `bytes` is a valid LEI identifier, returns an instance of `Identifier` if successful @@ -102,7 +102,12 @@ impl AssetIdentifier { .try_into() .ok() .map(lei_checksum) - .filter(|hash| *hash == (bytes[18] - b'0') * 10 + (bytes[19] - b'0')) + .filter(|hash| { + *hash + == (bytes[18].wrapping_sub(b'0')) + .wrapping_mul(10) + .wrapping_add(bytes[19].wrapping_sub(b'0')) + }) .map(|_| AssetIdentifier::LEI(bytes)) } @@ -125,7 +130,7 @@ fn cusip_checksum(bytes: &[u8]) -> u8 { .map(byte_value) .enumerate() .map(|(i, v)| v << (i % 2)) - .map(|v| (v / 10) + v % 10) + .map(|v| (v / 10).wrapping_add(v % 10)) .map(|x| x as usize) .sum(); ((10 - (total % 10)) % 10) as u8 @@ -139,12 +144,12 @@ fn lei_checksum(bytes: [u8; 18]) -> u8 { .rev() .map(byte_value) .map(|x| x as u128) - .fold(0, |mut total, b| { - total += b * 10u128.pow(i as u32); + .fold(0u128, |total, b| { + let total = total.wrapping_add(b.wrapping_mul(10u128.wrapping_pow(i as u32))); i += if b > 9 { 2 } else { 1 }; total }); - (98 - (total * 100 % 97)) as u8 + (98 - (total.wrapping_mul(100) % 97)) as u8 } fn byte_value(b: u8) -> u8 { diff --git a/primitives/src/jurisdiction.rs b/primitives/src/jurisdiction.rs index 9b9e95d37c..4e90a943c9 100644 --- a/primitives/src/jurisdiction.rs +++ b/primitives/src/jurisdiction.rs @@ -16,7 +16,6 @@ //! Data types and definitions of jurisdictions. use codec::{Decode, Encode}; -use core::str; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; use sp_std::prelude::*; diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 2074731344..2c7c1f6b62 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -62,7 +62,7 @@ pub type Index = u32; /// App-specific crypto used for reporting equivocation/misbehavior in BABE and /// GRANDPA. Any rewards for misbehavior reporting will be paid out to this /// account. -// #[cfg(feature = "std")] +#[cfg(feature = "std")] pub mod report { use super::{Signature, Verify}; use frame_system::offchain::AppCrypto; @@ -240,6 +240,9 @@ pub mod calendar; /// Runtime crypto tools. pub mod crypto; +/// Asset type definitions. +pub mod asset; + /// Represents custom transaction errors. #[repr(u8)] pub enum TransactionError { @@ -317,11 +320,11 @@ macro_rules! storage_migration_ver { /// It also updates `StorageVersion` in the current pallet to `$ver`. #[macro_export] macro_rules! storage_migrate_on { - ($curr: expr, $ver:literal, $body: block) => {{ + ($curr: expr, $ver:literal, $([$($targ:ty),*])? $body: block) => {{ const TARGET_VERSION: Version = Version::new($ver).unwrap(); if $curr < TARGET_VERSION { $body; - StorageVersion::put(TARGET_VERSION); + StorageVersion::< $($($targ),*)? >::put(TARGET_VERSION); } }}; } diff --git a/primitives/src/migrate.rs b/primitives/src/migrate.rs index 30d8eb079b..5416c46477 100644 --- a/primitives/src/migrate.rs +++ b/primitives/src/migrate.rs @@ -68,6 +68,18 @@ where } } +impl Migrate for Option { + type Into = Option; + type Context = T::Context; + + fn migrate(self, context: Self::Context) -> Option { + match self { + None => None, + Some(val) => Some(val.migrate(context)), + } + } +} + /// Migrate the values with old type `T` in `module::item` to `T::Into`. /// /// Migrations resulting in `old.migrate() == None` are silently dropped from storage. diff --git a/primitives/src/ticker.rs b/primitives/src/ticker.rs index 984412713d..320193dec4 100644 --- a/primitives/src/ticker.rs +++ b/primitives/src/ticker.rs @@ -41,6 +41,12 @@ impl Default for Ticker { } } +impl AsRef<[u8]> for Ticker { + fn as_ref(&self) -> &[u8] { + &self.0 + } +} + impl TryFrom<&[u8]> for Ticker { type Error = Error; @@ -107,6 +113,18 @@ impl Ticker { } } +#[cfg(feature = "runtime-benchmarks")] +impl Ticker { + /// Create ticker by repeating `b` for `TICKER_LEN` + pub const fn repeating(b: u8) -> Ticker { + // TODO: replace with u8::to_ascii_uppercase when it's const + const fn to_ascii_uppercase(b: u8) -> u8 { + b & !((b.is_ascii_lowercase() as u8) << 5) + } + Self([to_ascii_uppercase(b); TICKER_LEN]) + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/primitives_derive/Cargo.toml b/primitives_derive/Cargo.toml index 4ac21870c8..b9a30ef287 100644 --- a/primitives_derive/Cargo.toml +++ b/primitives_derive/Cargo.toml @@ -8,8 +8,9 @@ edition = "2018" proc-macro = true [dependencies] -syn = { version = "1.0.41", features = ["visit-mut"] } +syn = { version = "1.0.58", features = ["visit-mut"] } quote = "1.0.7" +proc-macro2 = "1.0.24" [features] default = ["std"] diff --git a/primitives_derive/src/migrate.rs b/primitives_derive/src/migrate.rs index 64120cb250..0695b421d6 100755 --- a/primitives_derive/src/migrate.rs +++ b/primitives_derive/src/migrate.rs @@ -1,4 +1,4 @@ -use syn::export::TokenStream2; +use proc_macro2::TokenStream as TokenStream2; use syn::parse::{Parse, ParseStream}; use syn::spanned::Spanned as _; use syn::{ diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index ab645c8948..566980be08 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -17,14 +17,14 @@ pallet-transaction-payment = { path = "../pallets/transaction-payment", default- # Substrate codec = { package = "parity-scale-codec", version = "1.2.0" } -sp-core = {git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } -sp-std = {git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -sp-api = { git = 'https://github.com/paritytech/substrate', default-features = false, tag = "v2.0.0" } -sp-blockchain = { git = 'https://github.com/paritytech/substrate', tag = "v2.0.0" } -sp-rpc = { git = 'https://github.com/paritytech/substrate', tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = {git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } +sp-std = {git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +sp-api = { git = 'https://github.com/PolymathNetwork/substrate', default-features = false, tag = "v2.0.1-1" } +sp-blockchain = { git = 'https://github.com/PolymathNetwork/substrate', tag = "v2.0.1-1" } +sp-rpc = { git = 'https://github.com/PolymathNetwork/substrate', tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } # Others jsonrpc-core = "15.0.0" diff --git a/rpc/runtime-api/Cargo.toml b/rpc/runtime-api/Cargo.toml index b9684a7502..76ce7a0a22 100644 --- a/rpc/runtime-api/Cargo.toml +++ b/rpc/runtime-api/Cargo.toml @@ -18,11 +18,11 @@ serde = { version = "1.0.104", optional = true, features = ["derive"] } # Substrate codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] } -sp-api = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } -sp-std = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } -sp-runtime = { git = 'https://github.com/paritytech/substrate', default_features = false, tag = "v2.0.0" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-api = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } +sp-std = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } +sp-runtime = { git = 'https://github.com/PolymathNetwork/substrate', default_features = false, tag = "v2.0.1-1" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, tag = "v2.0.1-1" } [dev-dependencies] serde_json = "1.0.41" diff --git a/rpc/runtime-api/src/compliance_manager.rs b/rpc/runtime-api/src/compliance_manager.rs index 265d2dcedf..2fa3be64c1 100644 --- a/rpc/runtime-api/src/compliance_manager.rs +++ b/rpc/runtime-api/src/compliance_manager.rs @@ -14,7 +14,6 @@ // along with this program. If not, see . //! Runtime API definition for Identity module. -#![cfg_attr(not(feature = "std"), no_std)] use codec::Codec; use frame_support::traits::Currency; diff --git a/rpc/runtime-api/src/lib.rs b/rpc/runtime-api/src/lib.rs index 5ca3f208d7..0eff0c173f 100644 --- a/rpc/runtime-api/src/lib.rs +++ b/rpc/runtime-api/src/lib.rs @@ -20,5 +20,4 @@ pub mod asset; pub mod compliance_manager; pub mod identity; pub mod pips; -pub mod portfolio; pub mod transaction_payment; diff --git a/rpc/runtime-api/src/portfolio.rs b/rpc/runtime-api/src/portfolio.rs deleted file mode 100644 index ca8e7fc875..0000000000 --- a/rpc/runtime-api/src/portfolio.rs +++ /dev/null @@ -1,37 +0,0 @@ -// This file is part of the Polymesh distribution (https://github.com/PolymathNetwork/Polymesh). -// Copyright (c) 2020 Polymath - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 3. - -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Runtime API definition for the Portfolio module. - -use codec::Codec; -use polymesh_primitives::{IdentityId, PortfolioId, PortfolioName, PortfolioNumber, Ticker}; -use sp_std::vec::Vec; - -pub type Error = Vec; -pub type GetPortfoliosResult = Result, Error>; -pub type GetPortfolioAssetsResult = Result, Error>; - -sp_api::decl_runtime_apis! { - /// The API to interact with Asset. - pub trait PortfolioApi where - Balance: Codec - { - /// Gets all user-defined portfolio names of an identity. - fn get_portfolios(did: IdentityId) -> GetPortfoliosResult; - - /// Gets the balances of all assets in a given portfolio. - fn get_portfolio_assets(portfolio_id: PortfolioId) -> GetPortfolioAssetsResult; - } -} diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index a1fe900d20..d9acda5ae1 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -42,5 +42,4 @@ pub mod asset; pub mod compliance_manager; pub mod identity; pub mod pips; -pub mod portfolio; pub mod transaction_payment; diff --git a/rpc/src/portfolio.rs b/rpc/src/portfolio.rs deleted file mode 100644 index f0d95d147d..0000000000 --- a/rpc/src/portfolio.rs +++ /dev/null @@ -1,96 +0,0 @@ -// This file is part of the Polymesh distribution (https://github.com/PolymathNetwork/Polymesh). -// Copyright (c) 2020 Polymath - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 3. - -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pub use node_rpc_runtime_api::portfolio::{ - GetPortfolioAssetsResult, GetPortfoliosResult, PortfolioApi as PortfolioRuntimeApi, -}; - -use codec::Codec; -use jsonrpc_core::{Error as RpcError, ErrorCode, Result}; -use jsonrpc_derive::rpc; -use polymesh_primitives::{IdentityId, PortfolioId}; -use sp_api::{ApiRef, ProvideRuntimeApi}; -use sp_blockchain::HeaderBackend; -use sp_runtime::{generic::BlockId, traits::Block as BlockT}; -use std::sync::Arc; - -#[rpc] -pub trait PortfolioApi { - /// Gets all user-defined portfolio names of an identity. - #[rpc(name = "portfolio_getPortfolios")] - fn get_portfolios(&self, did: IdentityId, at: Option) - -> Result; - - /// Gets the balances of all assets in a given portfolio. - #[rpc(name = "portfolio_getPortfolioAssets")] - fn get_portfolio_assets( - &self, - portfolio_id: PortfolioId, - at: Option, - ) -> Result>; -} - -/// An implementation of portfolio-specific RPC methods. -pub struct Portfolio { - client: Arc, - _marker: std::marker::PhantomData, -} - -impl Portfolio { - /// Create new `Asset` with the given reference to the client. - pub fn new(client: Arc) -> Self { - Self { - client, - _marker: Default::default(), - } - } -} - -impl PortfolioApi<::Hash, Balance> for Portfolio -where - Block: BlockT, - C: Send + Sync + 'static, - C: ProvideRuntimeApi, - C: HeaderBackend, - C::Api: PortfolioRuntimeApi, - Balance: Codec, -{ - fn get_portfolios( - &self, - did: IdentityId, - at: Option<::Hash>, - ) -> Result { - rpc_forward_call!( - self, - at, - |api: ApiRef<>::Api>, at| api.get_portfolios(at, did), - "Unable to get portfolios" - ) - } - - fn get_portfolio_assets( - &self, - portfolio_id: PortfolioId, - at: Option<::Hash>, - ) -> Result> { - rpc_forward_call!( - self, - at, - |api: ApiRef<>::Api>, at| api - .get_portfolio_assets(at, portfolio_id), - "Unable to get portfolio assets" - ) - } -} diff --git a/rust-toolchain b/rust-toolchain index 2a9bf37611..ff83b6a698 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2020-09-28 \ No newline at end of file +nightly-2021-01-25 \ No newline at end of file diff --git a/scripts/bd.sh b/scripts/bd.sh index 72d4e22db0..9382745dd8 100755 --- a/scripts/bd.sh +++ b/scripts/bd.sh @@ -1,10 +1,15 @@ #! /bin/bash pallet=$1 +extrinsic=$2 if [[ -z "${pallet}" ]]; then pallet="*" fi -cargo build --release --features=runtime-benchmarks && \ -./target/release/polymesh benchmark -p=${pallet} -e=* +if [[ -z "${extrinsic}" ]]; then + extrinsic="*" +fi + +SKIP_WASM_BUILD=1 cargo build --release --features=runtime-benchmarks && \ +./target/release/polymesh benchmark -p=${pallet} -e=${extrinsic} -r=1 -s=1 diff --git a/scripts/check.sh b/scripts/check.sh index e79730793d..deeedfd976 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -1 +1 @@ -SKIP_WASM_BUILD=true cargo check +BUILD_DUMMY_WASM_BINARY=true cargo check diff --git a/scripts/cli/package-lock.json b/scripts/cli/package-lock.json index 447c0a4123..8859622917 100644 --- a/scripts/cli/package-lock.json +++ b/scripts/cli/package-lock.json @@ -5,27 +5,31 @@ "requires": true, "dependencies": { "@babel/runtime": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.11.2.tgz", - "integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==", + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", + "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", "requires": { "regenerator-runtime": "^0.13.4" } }, "@liftr/tscov": { - "version": "1.4.7", - "resolved": "https://registry.npmjs.org/@liftr/tscov/-/tscov-1.4.7.tgz", - "integrity": "sha512-IpPm5Ew3/CmBeOeAOyKsG+qYvTUDUnnhII8KeJHHg+bI27Y/guHBi1r50UCxrkwOMTCwf9YD28v0jkZefMq/7g==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@liftr/tscov/-/tscov-2.0.0.tgz", + "integrity": "sha512-A1udAbqqHSNxeZACfGYmotMKH366rEqt9HxoT8f2HeB9RDBwBBgNcdEmDv2qxVudap/4Xdgdoq5QxNHQK4sV4Q==", "requires": { - "color-support": "^1.1.3", - "commander": "^5.1.0", - "figlet": "^1.4.0", + "commander": "^6.0.0", + "figlet": "^1.5.0", "glob": "7.1.6", - "inversify": "^5.0.1", "minimist": "1.2.5", "prompts": "^2.3.2", - "reflect-metadata": "^0.1.13", - "tslib": "2.0.0" + "tslib": "2.0.1" + }, + "dependencies": { + "commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==" + } } }, "@opencensus/core": { @@ -112,9 +116,48 @@ } }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "pm2-axon": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/pm2-axon/-/pm2-axon-3.3.0.tgz", + "integrity": "sha512-dAFlFYRuFbFjX7oAk41zT+dx86EuaFX/TgOp5QpUKRKwxb946IM6ydnoH5sSTkdI2pHSVZ+3Am8n/l0ocr7jdQ==", + "requires": { + "amp": "~0.3.1", + "amp-message": "~0.1.1", + "debug": "^3.0", + "escape-regexp": "0.0.1" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "pm2-axon-rpc": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/pm2-axon-rpc/-/pm2-axon-rpc-0.5.2.tgz", + "integrity": "sha512-o4u1jO1EYBgBUVlraE1aeGWB5DvClJFB2+v7ytqLypNfgYeT6eJ/B+WMh5NcvRnexAYL5kblcRgNgSbgGEobvA==", + "requires": { + "debug": "^3.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "requires": { + "ms": "^2.1.1" + } + } + } }, "semver": { "version": "7.2.3", @@ -135,17 +178,17 @@ }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "requires": { "ms": "^2.1.1" } }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "ws": { "version": "6.2.1", @@ -197,9 +240,9 @@ "integrity": "sha512-t0A2msp6BzOf+QAcI6z9XMktLj52OjGQg+8SJH6v5+3uxNpWYRR3wQmfA+6xtMU9kOC59qk9licus5dYcrYkMQ==" }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "semver": { "version": "6.3.0", @@ -214,13 +257,13 @@ } }, "@pm2/js-api": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@pm2/js-api/-/js-api-0.6.0.tgz", - "integrity": "sha512-ZgM/0yI8s3FRyxP01wI5UzDrVTecS/SmD98z25C9fsHo2Wz3JB1DtS4uIBlPopq2/R5HIQynTUJPDNn4qo1d/Q==", + "version": "0.6.7", + "resolved": "https://registry.npmjs.org/@pm2/js-api/-/js-api-0.6.7.tgz", + "integrity": "sha512-jiJUhbdsK+5C4zhPZNnyA3wRI01dEc6a2GhcQ9qI38DyIk+S+C8iC3fGjcjUbt/viLYKPjlAaE+hcT2/JMQPXw==", "requires": { "async": "^2.6.3", - "axios": "^0.19.0", - "debug": "~3.2.6", + "axios": "^0.21.0", + "debug": "~4.3.1", "eventemitter2": "^6.3.1", "ws": "^7.0.0" }, @@ -234,11 +277,11 @@ } }, "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "eventemitter2": { @@ -262,11 +305,11 @@ }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { @@ -277,458 +320,268 @@ } }, "@polkadot/api": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-1.34.1.tgz", - "integrity": "sha512-3gCibNRchH+XbEdULS1bwiV1RgarZW1PDw1Y1mAQBVqPrUpkYqntp1D52SQOpAbRzldkwk296Sj+mx9/IeDRXA==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/api-derive": "1.34.1", - "@polkadot/keyring": "^3.4.1", - "@polkadot/metadata": "1.34.1", - "@polkadot/rpc-core": "1.34.1", - "@polkadot/rpc-provider": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/types-known": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "bn.js": "^5.1.3", - "eventemitter3": "^4.0.7", - "rxjs": "^6.6.3" - }, - "dependencies": { - "@polkadot/keyring": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-3.4.1.tgz", - "integrity": "sha512-x8FxzDzyFX5ai+tnPaxAFUBV/2Mw/om8sRoMh+fT6Jzh3nC7pXfecH5ticJPKe73v/y42hn9xM0tiAI5P8Ohcw==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/util": "3.4.1", - "@polkadot/util-crypto": "3.4.1" - } - }, - "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "camelcase": "^5.3.1", - "chalk": "^4.1.0", - "ip-regex": "^4.1.0" - } - }, - "@polkadot/util-crypto": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.4.1.tgz", - "integrity": "sha512-RdTAiJ6dFE8nQJ7/wQkvYa6aNZG3Lusf/r7UmPJ56dZldvDTP3OdekzcfYdogU8hSJrE/xX84ii4DrHLnXXfAQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/util": "3.4.1", - "@polkadot/wasm-crypto": "^1.4.1", - "base-x": "^3.0.8", - "bip39": "^3.0.2", - "blakejs": "^1.1.0", - "bn.js": "^5.1.3", - "elliptic": "^6.5.3", - "js-sha3": "^0.8.0", - "pbkdf2": "^3.1.1", - "scryptsy": "^2.1.0", - "tweetnacl": "^1.0.3", - "xxhashjs": "^0.2.2" - } - }, - "@polkadot/wasm-crypto": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-1.4.1.tgz", - "integrity": "sha512-GPBCh8YvQmA5bobI4rqRkUhrEHkEWU1+lcJVPbZYsa7jiHFaZpzCLrGQfiqW/vtbU1aBS2wmJ0x1nlt33B9QqQ==" - }, - "rxjs": { - "version": "6.6.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", - "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", - "requires": { - "tslib": "^1.9.0" - } - }, - "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" - } + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-3.7.1.tgz", + "integrity": "sha512-mRQqyn/M8dSbEWnoMOQCzXIPtRgTthzVg/69kn9Kl+ocxR9doW/cFeQTCHdk8i/hRnlV1qulmOqntrMXjeNuoQ==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/api-derive": "3.7.1", + "@polkadot/keyring": "^5.5.1", + "@polkadot/metadata": "3.7.1", + "@polkadot/rpc-core": "3.7.1", + "@polkadot/rpc-provider": "3.7.1", + "@polkadot/types": "3.7.1", + "@polkadot/types-known": "3.7.1", + "@polkadot/util": "^5.5.1", + "@polkadot/util-crypto": "^5.5.1", + "@polkadot/x-rxjs": "^5.5.1", + "bn.js": "^4.11.9", + "eventemitter3": "^4.0.7" } }, "@polkadot/api-derive": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-1.34.1.tgz", - "integrity": "sha512-LMlCkNJRp29MwKa36crYuY6cZpnkHCFrPCv9dmJEuDbMqrK+EAhXM9/6sTDYJ4uKNhyetJKe9rXslkXdI6pidA==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/api": "1.34.1", - "@polkadot/rpc-core": "1.34.1", - "@polkadot/rpc-provider": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "bn.js": "^5.1.3", - "memoizee": "^0.4.14", - "rxjs": "^6.6.3" - }, - "dependencies": { - "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "camelcase": "^5.3.1", - "chalk": "^4.1.0", - "ip-regex": "^4.1.0" - } - }, - "@polkadot/util-crypto": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.4.1.tgz", - "integrity": "sha512-RdTAiJ6dFE8nQJ7/wQkvYa6aNZG3Lusf/r7UmPJ56dZldvDTP3OdekzcfYdogU8hSJrE/xX84ii4DrHLnXXfAQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/util": "3.4.1", - "@polkadot/wasm-crypto": "^1.4.1", - "base-x": "^3.0.8", - "bip39": "^3.0.2", - "blakejs": "^1.1.0", - "bn.js": "^5.1.3", - "elliptic": "^6.5.3", - "js-sha3": "^0.8.0", - "pbkdf2": "^3.1.1", - "scryptsy": "^2.1.0", - "tweetnacl": "^1.0.3", - "xxhashjs": "^0.2.2" - } - }, - "@polkadot/wasm-crypto": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-1.4.1.tgz", - "integrity": "sha512-GPBCh8YvQmA5bobI4rqRkUhrEHkEWU1+lcJVPbZYsa7jiHFaZpzCLrGQfiqW/vtbU1aBS2wmJ0x1nlt33B9QqQ==" - }, - "rxjs": { - "version": "6.6.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", - "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", - "requires": { - "tslib": "^1.9.0" - } - }, - "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" - } + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-3.7.1.tgz", + "integrity": "sha512-Tj7hiQyDe1a76jfzmkgRspMqrmqVs2eNq61sy9WS1U2X8cNWByf1GPBwaqwPrlFwa37zgp5DRvCuiwEZui8/Uw==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/api": "3.7.1", + "@polkadot/rpc-core": "3.7.1", + "@polkadot/types": "3.7.1", + "@polkadot/util": "^5.5.1", + "@polkadot/util-crypto": "^5.5.1", + "@polkadot/x-rxjs": "^5.5.1", + "bn.js": "^4.11.9" + } + }, + "@polkadot/keyring": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-5.5.1.tgz", + "integrity": "sha512-26O8A62rJzJhpuXquuOX0jfIlrpP+8BaKThJhm5w3TLNCdVAk5pktSyu140w6MctOQ39CEZ2wK1Kvr3rw1KFJw==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/util": "5.5.1", + "@polkadot/util-crypto": "5.5.1" } }, "@polkadot/metadata": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz", - "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/types-known": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "bn.js": "^5.1.3" - }, - "dependencies": { - "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "camelcase": "^5.3.1", - "chalk": "^4.1.0", - "ip-regex": "^4.1.0" - } - }, - "@polkadot/util-crypto": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.4.1.tgz", - "integrity": "sha512-RdTAiJ6dFE8nQJ7/wQkvYa6aNZG3Lusf/r7UmPJ56dZldvDTP3OdekzcfYdogU8hSJrE/xX84ii4DrHLnXXfAQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/util": "3.4.1", - "@polkadot/wasm-crypto": "^1.4.1", - "base-x": "^3.0.8", - "bip39": "^3.0.2", - "blakejs": "^1.1.0", - "bn.js": "^5.1.3", - "elliptic": "^6.5.3", - "js-sha3": "^0.8.0", - "pbkdf2": "^3.1.1", - "scryptsy": "^2.1.0", - "tweetnacl": "^1.0.3", - "xxhashjs": "^0.2.2" - } - }, - "@polkadot/wasm-crypto": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-1.4.1.tgz", - "integrity": "sha512-GPBCh8YvQmA5bobI4rqRkUhrEHkEWU1+lcJVPbZYsa7jiHFaZpzCLrGQfiqW/vtbU1aBS2wmJ0x1nlt33B9QqQ==" - } + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-3.7.1.tgz", + "integrity": "sha512-3cWNu6wJ9s/Bk7a00goaCsL1aIQsuP5m05pwRQPBPTAaJmI/IE8Ax+FbmDxJjsWMK7zFSucGy6s1OUmT8a3SCg==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/types": "3.7.1", + "@polkadot/types-known": "3.7.1", + "@polkadot/util": "^5.5.1", + "@polkadot/util-crypto": "^5.5.1", + "bn.js": "^4.11.9" + } + }, + "@polkadot/networks": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-5.5.1.tgz", + "integrity": "sha512-vykFflT2BrFqhm0BEAStrw7JhwmLQo7x25ulabzAxr5tUpbjgDajJ9S3J/REPJKsWFtsIFwsFEgI+QksbbFBfw==", + "requires": { + "@babel/runtime": "^7.12.5" } }, "@polkadot/rpc-core": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-1.34.1.tgz", - "integrity": "sha512-BVQDyBEkbRe5b/u8p9UPpTCj0sDZ32sTmPEP43Klc4s9+oHtiNvOFYvkjK5oyW9dlcOwXi8HpLsQxGAeMtM7Tw==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/rpc-provider": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "memoizee": "^0.4.14", - "rxjs": "^6.6.3" - }, - "dependencies": { - "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "camelcase": "^5.3.1", - "chalk": "^4.1.0", - "ip-regex": "^4.1.0" - } - }, - "rxjs": { - "version": "6.6.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", - "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", - "requires": { - "tslib": "^1.9.0" - } - }, - "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" - } + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-3.7.1.tgz", + "integrity": "sha512-Z2NBm5FzToUED5KYnx9WUVjTcKjXXsi6pXb3G1cWx1KxyTVXJylV5wczQ8AxVFUFqmf4coeq13a5/KZX9EYUcw==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/metadata": "3.7.1", + "@polkadot/rpc-provider": "3.7.1", + "@polkadot/types": "3.7.1", + "@polkadot/util": "^5.5.1", + "@polkadot/x-rxjs": "^5.5.1" } }, "@polkadot/rpc-provider": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-1.34.1.tgz", - "integrity": "sha512-bebeis9mB4LS9Spk1WSHoadZHsyHmK4gyyC6uKSLZxHZmnopWna6zWnOBIrYHRz7qDHSZC5eNTseuU8NJXtscA==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "@polkadot/x-fetch": "^0.3.2", - "@polkadot/x-ws": "^0.3.2", - "bn.js": "^5.1.3", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-3.7.1.tgz", + "integrity": "sha512-o3gh+OQf1DDs0Q3td6VXgO6i8RPrUovZcrqk9skC3VdJCOlKv6knc66v5Cwdpi5m0wMGsd89qlvdgioLfDvhnQ==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/types": "3.7.1", + "@polkadot/util": "^5.5.1", + "@polkadot/util-crypto": "^5.5.1", + "@polkadot/x-fetch": "^5.5.1", + "@polkadot/x-global": "^5.5.1", + "@polkadot/x-ws": "^5.5.1", + "bn.js": "^4.11.9", "eventemitter3": "^4.0.7" - }, - "dependencies": { - "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "camelcase": "^5.3.1", - "chalk": "^4.1.0", - "ip-regex": "^4.1.0" - } - }, - "@polkadot/util-crypto": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.4.1.tgz", - "integrity": "sha512-RdTAiJ6dFE8nQJ7/wQkvYa6aNZG3Lusf/r7UmPJ56dZldvDTP3OdekzcfYdogU8hSJrE/xX84ii4DrHLnXXfAQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/util": "3.4.1", - "@polkadot/wasm-crypto": "^1.4.1", - "base-x": "^3.0.8", - "bip39": "^3.0.2", - "blakejs": "^1.1.0", - "bn.js": "^5.1.3", - "elliptic": "^6.5.3", - "js-sha3": "^0.8.0", - "pbkdf2": "^3.1.1", - "scryptsy": "^2.1.0", - "tweetnacl": "^1.0.3", - "xxhashjs": "^0.2.2" - } - }, - "@polkadot/wasm-crypto": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-1.4.1.tgz", - "integrity": "sha512-GPBCh8YvQmA5bobI4rqRkUhrEHkEWU1+lcJVPbZYsa7jiHFaZpzCLrGQfiqW/vtbU1aBS2wmJ0x1nlt33B9QqQ==" - } } }, "@polkadot/types": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz", - "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-3.7.1.tgz", + "integrity": "sha512-szkUMSYklSiwEinyAggRUXTuFU2Xq7Wy+5+I18ngFh4AgQiDLIDhhGzPas5upHFpaQe9GPtTWi07h6/DUHZM5Q==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/metadata": "3.7.1", + "@polkadot/util": "^5.5.1", + "@polkadot/util-crypto": "^5.5.1", + "@polkadot/x-rxjs": "^5.5.1", "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "memoizee": "^0.4.14", - "rxjs": "^6.6.3" - }, - "dependencies": { - "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "camelcase": "^5.3.1", - "chalk": "^4.1.0", - "ip-regex": "^4.1.0" - } - }, - "@polkadot/util-crypto": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.4.1.tgz", - "integrity": "sha512-RdTAiJ6dFE8nQJ7/wQkvYa6aNZG3Lusf/r7UmPJ56dZldvDTP3OdekzcfYdogU8hSJrE/xX84ii4DrHLnXXfAQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/util": "3.4.1", - "@polkadot/wasm-crypto": "^1.4.1", - "base-x": "^3.0.8", - "bip39": "^3.0.2", - "blakejs": "^1.1.0", - "bn.js": "^5.1.3", - "elliptic": "^6.5.3", - "js-sha3": "^0.8.0", - "pbkdf2": "^3.1.1", - "scryptsy": "^2.1.0", - "tweetnacl": "^1.0.3", - "xxhashjs": "^0.2.2" - } - }, - "@polkadot/wasm-crypto": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-1.4.1.tgz", - "integrity": "sha512-GPBCh8YvQmA5bobI4rqRkUhrEHkEWU1+lcJVPbZYsa7jiHFaZpzCLrGQfiqW/vtbU1aBS2wmJ0x1nlt33B9QqQ==" - }, - "rxjs": { - "version": "6.6.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", - "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", - "requires": { - "tslib": "^1.9.0" - } - }, - "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" - } + "bn.js": "^4.11.9" } }, "@polkadot/types-known": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz", - "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "bn.js": "^5.1.3" - }, - "dependencies": { - "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", - "requires": { - "@babel/runtime": "^7.11.2", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "camelcase": "^5.3.1", - "chalk": "^4.1.0", - "ip-regex": "^4.1.0" - } - } + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-3.7.1.tgz", + "integrity": "sha512-gEDRK1x4p5BVac6cDCmLcWKF3NDXPOoTZN8oBsWBvCbLn8lCV9haO15t7r/6tI7NfYAbwBQvPocrCEvZKMHswg==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/types": "3.7.1", + "@polkadot/util": "^5.5.1", + "bn.js": "^4.11.9" } }, "@polkadot/util": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-2.18.1.tgz", - "integrity": "sha512-0KAojJMR5KDaaobIyvHVuW9vBP5LG3S0vpRSovB4UPlGDok3ETJSm5lMhA0t2KM8C4gXGBakCotFVGSOvWGgjA==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-5.5.1.tgz", + "integrity": "sha512-XcnJTh4lLvVD452pNOSWT5wgvjYWFItCjU5/Mf5yasV64gFTBz0242vHAu+RMMCDpj62tIaBrdHPtCzrFtsvQA==", "requires": { - "@babel/runtime": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@polkadot/x-textdecoder": "5.5.1", + "@polkadot/x-textencoder": "5.5.1", "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.2", + "bn.js": "^4.11.9", "camelcase": "^5.3.1", - "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.3.0" } }, "@polkadot/util-crypto": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-2.18.1.tgz", - "integrity": "sha512-RqCIv+WKLStJXhZcE+pT3V/xQvt7V74laqhLyLKIsVXPpeuKDiTxt0E5EB+gkuW1eTC4A03kitULcNA5w4JtFw==", - "requires": { - "@babel/runtime": "^7.10.4", - "@polkadot/util": "2.18.1", - "@polkadot/wasm-crypto": "^1.2.1", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-5.5.1.tgz", + "integrity": "sha512-0eAv9YnpOfDaiyItEgqizOrMqy7i/BDUDMuMoIg9/HjjTRGFXW7htzYRnNwxh6yCRH5MNoz05JPlzCZTqyg7Rw==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/networks": "5.5.1", + "@polkadot/util": "5.5.1", + "@polkadot/wasm-crypto": "^3.2.2", + "@polkadot/x-randomvalues": "5.5.1", "base-x": "^3.0.8", - "bip39": "^3.0.2", "blakejs": "^1.1.0", - "bn.js": "^5.1.2", + "bn.js": "^4.11.9", + "create-hash": "^1.2.0", "elliptic": "^6.5.3", + "hash.js": "^1.1.7", "js-sha3": "^0.8.0", - "pbkdf2": "^3.1.1", + "scryptsy": "^2.1.0", "tweetnacl": "^1.0.3", "xxhashjs": "^0.2.2" } }, "@polkadot/wasm-crypto": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-1.3.1.tgz", - "integrity": "sha512-AI90G2y9EXpjdWFfmxNRmhhei1OaWcNyuYferg/MEtqDQpkif+RlDw3sXfOHzdlIiWtL+IvXXltJPPbkhS0ycg==" + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-3.2.2.tgz", + "integrity": "sha512-dffdBQvFHbP0WLvpCf2fJ5mEWavXj75ykuFR16WIduhTRnI7fVYqYRaiJioUHWvPR34ik/VKlATWG7WPYiF5ZQ==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/wasm-crypto-asmjs": "^3.2.2", + "@polkadot/wasm-crypto-wasm": "^3.2.2" + } + }, + "@polkadot/wasm-crypto-asmjs": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-3.2.2.tgz", + "integrity": "sha512-OD6Ejzq0II+VuMLbs7nvGILO9b7PbK8F74uglDXQIaAl2YXuSEWbpE4S3RY7mRp+1Xg0igeNBhgMdRRUg5vDVg==", + "requires": { + "@babel/runtime": "^7.12.5" + } + }, + "@polkadot/wasm-crypto-wasm": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-3.2.2.tgz", + "integrity": "sha512-kU0m5X68NA8g7OKu0f0C+M1TmTy+hBEmGZ+7jbGBdDqkogc01sUR6qNtmPiT9g9Qsi1bhCoYVaVqtetpiD+CUw==", + "requires": { + "@babel/runtime": "^7.12.5" + } }, "@polkadot/x-fetch": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-0.3.2.tgz", - "integrity": "sha512-lk9M8ql/kBBqiZ8KOWj7LFK7P9OxDgVn2fZPNELJzQbfFZwFF8umBPDIWlQIK7wTnlRsQlzOuf6MGEyMK5p42w==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-5.5.1.tgz", + "integrity": "sha512-x0H/vS9qcuAAyO+e85OrMkGRgS/LIF/A5uJXFaif1/xopjhwrf4eDFFcj1UeC6KNB3dK1TKcihWjeySHldlUpA==", "requires": { - "@babel/runtime": "^7.11.2", - "@types/node-fetch": "^2.5.7", + "@babel/runtime": "^7.12.5", + "@polkadot/x-global": "5.5.1", + "@types/node-fetch": "^2.5.8", "node-fetch": "^2.6.1" } }, + "@polkadot/x-global": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-5.5.1.tgz", + "integrity": "sha512-GcczW6v1F4LTrp/lNlGmRvuXtMRzca5JOJCqdAX9a/ZpKCqHRrqCNTVxIks+C5hXeCPv0UgPPRqMnCbV/GztiQ==", + "requires": { + "@babel/runtime": "^7.12.5", + "@types/node-fetch": "^2.5.8", + "node-fetch": "^2.6.1" + } + }, + "@polkadot/x-randomvalues": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-5.5.1.tgz", + "integrity": "sha512-QyGLr1+ECAgQcy/YoEI3MeWBKlzbkycE6qfp/O4k9qYBJEiHaC0KwY1qNt57Ol3LYmOXWwv0rIbGaEpw1EwHNQ==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/x-global": "5.5.1" + } + }, + "@polkadot/x-rxjs": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-rxjs/-/x-rxjs-5.5.1.tgz", + "integrity": "sha512-jF33ZzvodIE27/QAyDBauhhENAr13rYe8t3L2A11wQ7ahMoEanzSu3BtfCZnXTxtukSV3XLQtzOq1yqNMC53RA==", + "requires": { + "@babel/runtime": "^7.12.5", + "rxjs": "^6.6.3" + }, + "dependencies": { + "rxjs": { + "version": "6.6.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", + "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@polkadot/x-textdecoder": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-5.5.1.tgz", + "integrity": "sha512-km8+dIPCi3yRsYFR4tZpo3XRWeR/2RLLgsd+4UfiH7TV2M1OWn6tX/FH2YfxgP6W5ovfnt5eWG4d3AJCyZEZMA==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/x-global": "5.5.1" + } + }, + "@polkadot/x-textencoder": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-5.5.1.tgz", + "integrity": "sha512-OmkVRXc8yhABZV5HgcPD7Ali+9EnwV8Nb0qg3uzwaTkshc5KBwcAyxi6Pvj+IREjo/oTEGzOYlb/y+DqHutkag==", + "requires": { + "@babel/runtime": "^7.12.5", + "@polkadot/x-global": "5.5.1" + } + }, "@polkadot/x-ws": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-0.3.2.tgz", - "integrity": "sha512-1aiG11Py8sgzJsz19melMzvBOn5zeMmfjCPoMryX4//063E0mcfnkujg4O6pTMygxJdFGAV1INB9wvMU9Dg9Wg==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-5.5.1.tgz", + "integrity": "sha512-juVjb0bK6RubqOZc3t4YdjaX58p/swEXk6TdDFRMzhRFc3rqE2jyweYIBb4zIXJjSsVmcIaYNgBINxHPONFnyg==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.5", + "@polkadot/x-global": "5.5.1", "@types/websocket": "^1.0.1", - "websocket": "^1.0.32" + "websocket": "^1.0.33" } }, "@sindresorhus/is": { @@ -755,9 +608,9 @@ } }, "@types/clear": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@types/clear/-/clear-0.1.0.tgz", - "integrity": "sha512-b2VgNzu3BxxM2nGhZSMzkiaTaCClevKkBCtgpV2Al0eGaEeQgTk5qHedzNxi/SgsvmDbqxWKDAIrxZNVKyDCXw==" + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@types/clear/-/clear-0.1.1.tgz", + "integrity": "sha512-Wu6DxCnSjFiqymbTeyb63VdU1oKYW0qCnmOSBjpMyuvcuvI9keXfS6RbEcKYqUY0dPOLa34qV+XHAdgiRzPBtg==" }, "@types/color-name": { "version": "1.1.1", @@ -765,28 +618,28 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" }, "@types/figlet": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@types/figlet/-/figlet-1.2.0.tgz", - "integrity": "sha512-TDZkNpYfkc3X8yv7w1QBziZmmxzNfGKX+YjeNkMpmSiNV0QOdNf9G5cEZB3FH1/oaqpSQEdxuDzURdju2L3lng==" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/figlet/-/figlet-1.2.1.tgz", + "integrity": "sha512-uw+Xmam7sMFHYyVGq5CGH/6Lu0T792bf4T6+jPFtPkWnJ9YVjLKqOLzF7DHuSo/LEHtLWleUO7Zi7EKkg6rSIg==" }, "@types/inquirer": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-6.5.0.tgz", - "integrity": "sha512-rjaYQ9b9y/VFGOpqBEXRavc3jh0a+e6evAbI31tMda8VlPaSy0AZJfXsvmIe3wklc7W6C3zCSfleuMXR7NOyXw==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-7.3.1.tgz", + "integrity": "sha512-osD38QVIfcdgsPCT0V3lD7eH0OFurX71Jft18bZrsVQWVRt6TuxRzlr0GJLrxoHZR2V5ph7/qP8se/dcnI7o0g==", "requires": { "@types/through": "*", "rxjs": "^6.4.0" } }, "@types/node": { - "version": "14.6.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.0.tgz", - "integrity": "sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==" + "version": "14.14.22", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.22.tgz", + "integrity": "sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw==" }, "@types/node-fetch": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz", - "integrity": "sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==", + "version": "2.5.8", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.8.tgz", + "integrity": "sha512-fbjI6ja0N5ZA8TV53RUqzsKNkl9fv8Oj3T7zxW7FGv1GSH7gwJaNF8dzCjrqKaxKeUpTz4yT1DaJFq/omNpGfw==", "requires": { "@types/node": "*", "form-data": "^3.0.0" @@ -885,9 +738,9 @@ } }, "ansi-colors": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", - "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==" + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==" }, "ansi-escapes": { "version": "4.3.1", @@ -952,9 +805,12 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==" }, "ast-types": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.3.tgz", - "integrity": "sha512-XTZ7xGML849LkQP86sWdQzfhwbt3YwIO6MqbX9mUNYY98VKaaVZP7YNNm70IpwecbkkxmfC5IYAzOQ/2p29zRA==" + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.14.2.tgz", + "integrity": "sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA==", + "requires": { + "tslib": "^2.0.1" + } }, "async": { "version": "3.2.0", @@ -988,11 +844,11 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "axios": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", - "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", "requires": { - "follow-redirects": "1.5.10" + "follow-redirects": "^1.10.0" } }, "balanced-match": { @@ -1009,27 +865,9 @@ } }, "binary-extensions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", - "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==" - }, - "bip39": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.2.tgz", - "integrity": "sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ==", - "requires": { - "@types/node": "11.11.6", - "create-hash": "^1.1.0", - "pbkdf2": "^3.0.9", - "randombytes": "^2.0.1" - }, - "dependencies": { - "@types/node": { - "version": "11.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", - "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==" - } - } + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" }, "blakejs": { "version": "1.1.0", @@ -1042,9 +880,14 @@ "integrity": "sha1-+WLWh+wsNpVwrnGvhDJW5tDKESk=" }, "bn.js": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz", - "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" + }, + "bodec": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bodec/-/bodec-0.1.0.tgz", + "integrity": "sha1-vIUVVUMPI8n3ZQp172TGqUw0GMw=" }, "boxen": { "version": "4.2.0", @@ -1108,11 +951,11 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" }, "bufferutil": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.1.tgz", - "integrity": "sha512-xowrxvpxojqkagPcWRQVXZl0YXhRhAtBEIq3VoER1NH5Mw1n1o0ojdspp+GS2J//2gCVyrzQDApQ4unGF+QOoA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.3.tgz", + "integrity": "sha512-yEYTwGndELGvfXsImMBLop58eaGW+YdONi1fNjTINSY98tmMmFijBG6WXgdkfuLNt4imzQNtIE+eBp1PVpMCSw==", "requires": { - "node-gyp-build": "~3.7.0" + "node-gyp-build": "^4.2.0" } }, "bytes": { @@ -1195,18 +1038,18 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=" }, "chokidar": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", - "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.2", + "fsevents": "~2.3.1", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.4.0" + "readdirp": "~3.5.0" } }, "ci-info": { @@ -1230,9 +1073,9 @@ "integrity": "sha512-qMjRnoL+JDPJHeLePZJuao6+8orzHMGP04A8CdwCNsKhRbOnKRjefxONR7bwILT3MHecxKBjHkKL/tkZ8r4Uzw==" }, "cli-boxes": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", - "integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", "dev": true }, "cli-cursor": { @@ -1244,9 +1087,9 @@ } }, "cli-progress": { - "version": "3.8.2", - "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.8.2.tgz", - "integrity": "sha512-qRwBxLldMSfxB+YGFgNRaj5vyyHe1yMpVeDL79c+7puGujdKJHQHydgqXDcrkvQgJ5U/d3lpf6vffSoVVUftVQ==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.9.0.tgz", + "integrity": "sha512-g7rLWfhAo/7pF+a/STFH/xPyosaL1zgADhI0OM83hl3c7S43iGvJWEAV2QuDOnQ8i6EMBj/u4+NTd0d5L+4JfA==", "requires": { "colors": "^1.1.2", "string-width": "^4.2.0" @@ -1303,11 +1146,6 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, - "color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==" - }, "colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", @@ -1333,9 +1171,9 @@ } }, "commander": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", - "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==" + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.0.0.tgz", + "integrity": "sha512-ovx/7NkTrnPuIV8sqk/GjUIIM1+iUQeqA3ye2VNpq9sVoiZsooObWlQy+OPWGI17GDaEoybuAGJm6U8yC077BA==" }, "concat-map": { "version": "0.0.1", @@ -1382,18 +1220,11 @@ "sha.js": "^2.4.0" } }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true }, "cron": { "version": "1.8.2", @@ -1423,6 +1254,11 @@ "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz", "integrity": "sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs=" }, + "culvert": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/culvert/-/culvert-0.1.2.tgz", + "integrity": "sha1-lQL18BVKLVoioCPnn3HMk2+m728=" + }, "d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", @@ -1438,9 +1274,9 @@ "integrity": "sha512-vKQ9DTQPN1FLYiiEEOQ6IBGFqvjCa5rSK3cWMy/Nespm5d/x3dGFT9UBZnkLxCwua/IXBi2TYnwTEpsOvhC4UQ==" }, "dayjs": { - "version": "1.8.34", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.8.34.tgz", - "integrity": "sha512-Olb+E6EoMvdPmAMq2QoucuyZycKHjTlBXmRx8Ada+wGtq4SIXuDCdtoaX4KkK0yjf1fJLnwXQURr8gQKWKaybw==" + "version": "1.8.36", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.8.36.tgz", + "integrity": "sha512-3VmRXEtw7RZKAf+4Tv1Ym9AGeo8r8+CjDi26x+7SYQil1UqtqdaokhzoEJohqlzt0m5kacJSDhJQkG/LWhpRBw==" }, "debug": { "version": "2.6.9", @@ -1511,9 +1347,9 @@ "dev": true }, "dot-prop": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", - "integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", "dev": true, "requires": { "is-obj": "^2.0.0" @@ -1537,13 +1373,6 @@ "inherits": "^2.0.1", "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.0" - }, - "dependencies": { - "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" - } } }, "emitter-listener": { @@ -1569,11 +1398,11 @@ } }, "enquirer": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.5.tgz", - "integrity": "sha512-BNT1C08P9XD0vNg3J475yIUG+mVdp9T6towYFHUv897X0KoHBjB1shyrNmhmtHWKP17iSWgo7Gqh7BBuzLZMSA==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", "requires": { - "ansi-colors": "^3.2.1" + "ansi-colors": "^4.1.1" } }, "es5-ext": { @@ -1584,13 +1413,6 @@ "es6-iterator": "~2.0.3", "es6-symbol": "~3.1.3", "next-tick": "~1.0.0" - }, - "dependencies": { - "next-tick": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", - "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" - } } }, "es6-iterator": { @@ -1625,17 +1447,6 @@ "ext": "^1.1.2" } }, - "es6-weak-map": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", - "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", - "requires": { - "d": "1", - "es5-ext": "^0.10.46", - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.1" - } - }, "escape-goat": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", @@ -1691,15 +1502,6 @@ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" }, - "event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", - "requires": { - "d": "1", - "es5-ext": "~0.10.14" - } - }, "eventemitter2": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-5.0.1.tgz", @@ -1795,22 +1597,9 @@ } }, "follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", - "requires": { - "debug": "=3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - } - } + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.2.tgz", + "integrity": "sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA==" }, "form-data": { "version": "3.0.0", @@ -1828,9 +1617,9 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.1.tgz", + "integrity": "sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw==", "optional": true }, "ftp": { @@ -1860,6 +1649,11 @@ } } }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", @@ -1921,6 +1715,16 @@ } } }, + "git-node-fs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/git-node-fs/-/git-node-fs-1.0.0.tgz", + "integrity": "sha1-SbIV4kLr5Dqkx1Ybu6SZUhdSCA8=" + }, + "git-sha1": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/git-sha1/-/git-sha1-0.1.2.tgz", + "integrity": "sha1-WZrBkrcYdYJeE6RF86bgURjC90U=" + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -1943,12 +1747,20 @@ } }, "global-dirs": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-2.0.1.tgz", - "integrity": "sha512-5HqUqdhkEovj2Of/ms3IeS/EekcO54ytHRLV4PEY2rhRwrHXLQjeVEES0Lhka0xwNDtGYn58wyC4s5+MHsOO6A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-2.1.0.tgz", + "integrity": "sha512-MG6kdOUh/xBnyo9cJFeIKkLEc1AyFq42QTU4XiX51i2NEdxLxLWXIjEjmqKeSuKR7pAZjTqUVoT2b2huxVLgYQ==", "dev": true, "requires": { - "ini": "^1.3.5" + "ini": "1.3.7" + }, + "dependencies": { + "ini": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz", + "integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==", + "dev": true + } } }, "got": { @@ -1976,6 +1788,14 @@ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "dev": true }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2063,20 +1883,28 @@ }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "requires": { "ms": "^2.1.1" } }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" } } }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, "ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", @@ -2112,8 +1940,7 @@ "ini": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "inquirer": { "version": "7.3.3", @@ -2135,20 +1962,15 @@ "through": "^2.3.6" } }, - "inversify": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/inversify/-/inversify-5.0.1.tgz", - "integrity": "sha512-Ieh06s48WnEYGcqHepdsJUIJUXpwH5o5vodAX+DK2JA/gjy4EbEcQZxw+uFfzysmKjiLXGYwNG3qDZsKVMcINQ==" - }, "ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" }, "ip-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.1.0.tgz", - "integrity": "sha512-pKnZpbgCTfH/1NLIlOduP/V+WRXzC2MOz3Qo8xmxk8C5GudJLgK5QyLVXOSWy3ParAH7Eemurl3xjv/WXYFvMA==" + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==" }, "is-binary-path": { "version": "2.1.0", @@ -2167,6 +1989,14 @@ "ci-info": "^2.0.0" } }, + "is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "requires": { + "has": "^1.0.3" + } + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -2218,11 +2048,6 @@ "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", "dev": true }, - "is-promise": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", - "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==" - }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -2239,6 +2064,17 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" }, + "js-git": { + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/js-git/-/js-git-0.7.8.tgz", + "integrity": "sha1-UvplWrYYd9bxB578ZTS1VPMeVEQ=", + "requires": { + "bodec": "^0.1.0", + "culvert": "^0.1.2", + "git-sha1": "^0.1.2", + "pako": "^0.2.5" + } + }, "js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", @@ -2316,14 +2152,6 @@ "yallist": "^3.0.2" } }, - "lru-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz", - "integrity": "sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM=", - "requires": { - "es5-ext": "~0.10.2" - } - }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -2357,32 +2185,17 @@ "safe-buffer": "^5.1.2" } }, - "memoizee": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.14.tgz", - "integrity": "sha512-/SWFvWegAIYAO4NQMpcX+gcra0yEZu4OntmUdrBaWrJncxOqAziGFlHxc7yjKVK2uu3lpPW27P27wkR82wA8mg==", - "requires": { - "d": "1", - "es5-ext": "^0.10.45", - "es6-weak-map": "^2.0.2", - "event-emitter": "^0.3.5", - "is-promise": "^2.1", - "lru-queue": "0.1", - "next-tick": "1", - "timers-ext": "^0.1.5" - } - }, "mime-db": { - "version": "1.44.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" + "version": "1.45.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz", + "integrity": "sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w==" }, "mime-types": { - "version": "2.1.27", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", - "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "version": "2.1.28", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.28.tgz", + "integrity": "sha512-0TO2yJ5YHYr7M2zzT7gDU1tbwHxEUWBCLt0lscSNpcdAfFyJOVEpRYNS7EXVcTLNj/25QO8gulHC5JtTzSE2UQ==", "requires": { - "mime-db": "1.44.0" + "mime-db": "1.45.0" } }, "mimic-fn": { @@ -2435,14 +2248,14 @@ "integrity": "sha1-Yz3wgzRDya2FlvTELlI3NINVr4g=" }, "moment": { - "version": "2.27.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz", - "integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==" + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" }, "moment-timezone": { - "version": "0.5.31", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.31.tgz", - "integrity": "sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA==", + "version": "0.5.32", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.32.tgz", + "integrity": "sha512-Z8QNyuQHQAmWucp8Knmgei8YNo28aLjJq6Ma+jy1ZSpSk5nyfRT8xgUbSQvD2+2UajISfenndwvFuH3NGS+nvA==", "requires": { "moment": ">= 2.9.0" } @@ -2468,25 +2281,17 @@ }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "requires": { "ms": "^2.1.1" } }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" } } }, @@ -2496,9 +2301,9 @@ "integrity": "sha1-ICl+idhvb2QA8lDZ9Pa0wZRfzTU=" }, "next-tick": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, "node-fetch": { "version": "2.6.1", @@ -2506,9 +2311,9 @@ "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, "node-gyp-build": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-3.7.0.tgz", - "integrity": "sha512-L/Eg02Epx6Si2NXmedx+Okg+4UHqmaf3TNcxd50SF9NQGcJaON3AtU++kax69XV7YWz4tUspqZSAsVofhFKG2w==" + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", + "integrity": "sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg==" }, "nodejs-fs-utils": { "version": "1.2.5", @@ -2519,9 +2324,9 @@ } }, "nodemon": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.4.tgz", - "integrity": "sha512-Ltced+hIfTmaS28Zjv1BM552oQ3dbwPqI4+zI0SLgq+wpJhSyqgYude/aZa/3i31VCQWMfXJVxvu86abcam3uQ==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.7.tgz", + "integrity": "sha512-XHzK69Awgnec9UzHr1kc8EomQh4sjTQ8oRf8TsGrSmHDx9/UmiGG9E/mM3BuTfNeFwdNBvrqQq/RHL0xIeyFOA==", "dev": true, "requires": { "chokidar": "^3.2.2", @@ -2532,14 +2337,14 @@ "semver": "^5.7.1", "supports-color": "^5.5.0", "touch": "^3.1.0", - "undefsafe": "^2.0.2", - "update-notifier": "^4.0.0" + "undefsafe": "^2.0.3", + "update-notifier": "^4.1.0" }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "requires": { "ms": "^2.1.1" @@ -2552,9 +2357,9 @@ "dev": true }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "semver": { @@ -2666,11 +2471,11 @@ }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { @@ -2712,6 +2517,11 @@ } } }, + "pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=" + }, "path": { "version": "0.12.7", "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", @@ -2736,66 +2546,54 @@ "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=" }, - "pbkdf2": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", - "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" }, "pidusage": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/pidusage/-/pidusage-2.0.18.tgz", - "integrity": "sha512-Y/VfKfh3poHjMEINxU+gJTeVOBjiThQeFAmzR7z56HSNiMx+etl+yBhk42nRPciPYt/VZl8DQLVXNC6P5vH11A==", + "version": "2.0.21", + "resolved": "https://registry.npmjs.org/pidusage/-/pidusage-2.0.21.tgz", + "integrity": "sha512-cv3xAQos+pugVX+BfXpHsbyz/dLzX+lr44zNMsYiGxUw+kV5sgQCIcLd1z+0vq+KyC7dJ+/ts2PsfgWfSC3WXA==", "requires": { - "safe-buffer": "^5.1.2" + "safe-buffer": "^5.2.1" } }, "pm2": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/pm2/-/pm2-4.4.1.tgz", - "integrity": "sha512-ece2zqVvSg29tIGdznKqk07IwVaO4mX7zLBMVxbJQMfvxpQUotLLERDW0v/RYMHtzj1bX8MLsDUsmPiIbEszKg==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/pm2/-/pm2-4.5.4.tgz", + "integrity": "sha512-2xKXrKz21i1R3BK2XxVIPq5Iy9fKHBVgZ+KMfRrx72mc7bq84SG/D+iTO32ihLf2Qe+N1o8rDskAt4M30JWyiA==", "requires": { - "@pm2/agent": "~1.0.2", + "@pm2/agent": "~1.0.4", "@pm2/io": "~4.3.5", - "@pm2/js-api": "~0.6.0", + "@pm2/js-api": "~0.6.7", "@pm2/pm2-version-check": "^1.0.3", "async": "~3.2.0", "blessed": "0.1.81", "chalk": "3.0.0", - "chokidar": "^3.3.0", + "chokidar": "^3.5.1", "cli-tableau": "^2.0.0", "commander": "2.15.1", "cron": "1.8.2", "dayjs": "~1.8.25", - "debug": "4.1.1", - "enquirer": "2.3.5", + "debug": "^4.3.0", + "enquirer": "2.3.6", "eventemitter2": "5.0.1", "fclone": "1.0.11", "mkdirp": "1.0.4", "needle": "2.4.0", - "pidusage": "2.0.18", - "pm2-axon": "3.3.0", - "pm2-axon-rpc": "0.5.1", + "pidusage": "2.0.21", + "pm2-axon": "4.0.0", + "pm2-axon-rpc": "0.6.0", "pm2-deploy": "~1.0.2", "pm2-multimeter": "^0.1.2", "promptly": "^2", "ps-list": "6.3.0", "semver": "^7.2", - "source-map-support": "0.5.16", + "source-map-support": "0.5.19", "sprintf-js": "1.1.2", - "systeminformation": "^4.23.3", - "vizion": "0.2.13", + "systeminformation": "^4.32", + "vizion": "2.2.1", "yamljs": "0.3.0" }, "dependencies": { @@ -2814,11 +2612,11 @@ "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { @@ -2829,24 +2627,29 @@ } }, "pm2-axon": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/pm2-axon/-/pm2-axon-3.3.0.tgz", - "integrity": "sha512-dAFlFYRuFbFjX7oAk41zT+dx86EuaFX/TgOp5QpUKRKwxb946IM6ydnoH5sSTkdI2pHSVZ+3Am8n/l0ocr7jdQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pm2-axon/-/pm2-axon-4.0.0.tgz", + "integrity": "sha512-A8dy0C57cRIm+kX58HrMcnvUdg8EdwCuCmavDdmFE4eoUE+5zfwGbDfZKCBVLNpDwjXPuXQQYZi3wQt/5xC8DQ==", "requires": { "amp": "~0.3.1", "amp-message": "~0.1.1", - "debug": "^3.0", - "escape-regexp": "0.0.1" + "debug": "^4.2", + "escape-string-regexp": "^4.0.0" }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -2855,25 +2658,25 @@ } }, "pm2-axon-rpc": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/pm2-axon-rpc/-/pm2-axon-rpc-0.5.1.tgz", - "integrity": "sha512-hT8gN3/j05895QLXpwg+Ws8PjO4AVID6Uf9StWpud9HB2homjc1KKCcI0vg9BNOt56FmrqKDT1NQgheIz35+sA==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pm2-axon-rpc/-/pm2-axon-rpc-0.6.0.tgz", + "integrity": "sha512-xjYR0y1HpOopJ09VL2Qd5H1LajVN+QLPVZ1G+GesbORJDAZiStMhwECtOzm/Gx5ANQxL0usW8WZsElMfQq2hbw==", "requires": { "debug": "^3.0" }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "requires": { "ms": "^2.1.1" } }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" } } }, @@ -2924,12 +2727,12 @@ } }, "prompts": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", - "integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.0.tgz", + "integrity": "sha512-awZAKrk3vN6CroQukBL+R9051a4R3zCZBlJm/HBfrSZ8iTpYix3VX1vU4mveiLpiwmOJT4wokTF9m6HUk4KqWQ==", "requires": { "kleur": "^3.0.3", - "sisteransi": "^1.0.4" + "sisteransi": "^1.0.5" } }, "proxy-agent": { @@ -2948,11 +2751,11 @@ }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { @@ -2989,22 +2792,14 @@ } }, "pupa": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.0.1.tgz", - "integrity": "sha512-hEJH0s8PXLY/cdXh66tNEQGndDrIKNqNC5xmrysZy3i5C3oEoLna7YAOad+7u125+zH1HNXUmGEkrhb3c2VriA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", "dev": true, "requires": { "escape-goat": "^2.0.0" } }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "requires": { - "safe-buffer": "^5.1.0" - } - }, "raw-body": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz", @@ -3014,16 +2809,6 @@ "http-errors": "1.7.3", "iconv-lite": "0.4.24", "unpipe": "1.0.0" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - } } }, "rc": { @@ -3057,9 +2842,9 @@ } }, "readdirp": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", - "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", "requires": { "picomatch": "^2.2.1" } @@ -3069,20 +2854,15 @@ "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" }, - "reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" - }, "regenerator-runtime": { "version": "0.13.7", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==" }, "registry-auth-token": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.0.tgz", - "integrity": "sha512-P+lWzPrsgfN+UEpDS3U8AQKg/UjZX6mQSJueZj3EK+vNESoqBSpBUD3gmu4sF9lOsjXWjF11dQKUqemf3veq1w==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", "dev": true, "requires": { "rc": "^1.2.8" @@ -3098,9 +2878,9 @@ } }, "require-in-the-middle": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-5.0.3.tgz", - "integrity": "sha512-p/ICV8uMlqC4tjOYabLMxAWCIKa0YUQgZZ6KDM0xgXJNgdGQ1WmL2A07TwmrZw+wi6ITUFKzH5v3n+ENEyXVkA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-5.1.0.tgz", + "integrity": "sha512-M2rLKVupQfJ5lf9OvqFGIT+9iVLnTmjgbOmpil12hiSQNn5zJTKGPoIisETNjfK+09vP3rpm1zJajmErpr2sEQ==", "requires": { "debug": "^4.1.1", "module-details-from-path": "^1.0.3", @@ -3108,11 +2888,11 @@ }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { @@ -3123,10 +2903,11 @@ } }, "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", "requires": { + "is-core-module": "^2.1.0", "path-parse": "^1.0.6" } }, @@ -3163,9 +2944,9 @@ "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==" }, "run-series": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.8.tgz", - "integrity": "sha512-+GztYEPRpIsQoCSraWHDBs9WVy4eVME16zhOtDB4H9J4xN0XRhknnmLOl+4gRgZtu8dpp9N/utSPjKH/xmDzXg==" + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.9.tgz", + "integrity": "sha512-Arc4hUN896vjkqCYrUXquBFtRZdv1PfLbTYP71efP6butxyQ0kWpiNJyAgsxscmQg1cqvHY32/UCBzXedTpU2g==" }, "rxjs": { "version": "6.6.2", @@ -3203,9 +2984,27 @@ "integrity": "sha512-1CdSqHQowJBnMAFyPEBRfqag/YP9OF394FV+4YREIJX4ljD7OxvQRDayyoyyCk+senRjSkP6VnUNQmVQqB6g7w==" }, "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "requires": { + "lru-cache": "^6.0.0" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } }, "semver-diff": { "version": "3.1.1", @@ -3292,9 +3091,9 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-support": { - "version": "0.5.16", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", - "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -3351,14 +3150,15 @@ } }, "systeminformation": { - "version": "4.32.0", - "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-4.32.0.tgz", - "integrity": "sha512-8/LM0EvwhW34+n3fzmcl4swG7Ngx8h8s/5MooXlIJKyMbSiO9juCqftdQIpwa3NneKrca1uYO55JHZeYJUaSZw==" + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-4.34.9.tgz", + "integrity": "sha512-jvc4DlJeXazsen2riPDR97GSaHNCmoL+mgfB8IXxmpNpNd7kv5MfkuihXEmF1/prBFtqzUA2lxnt1qp4maOMQA==", + "optional": true }, "term-size": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.0.tgz", - "integrity": "sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", + "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==", "dev": true }, "through": { @@ -3371,15 +3171,6 @@ "resolved": "https://registry.npmjs.org/thunkify/-/thunkify-2.1.2.tgz", "integrity": "sha1-+qDp0jDFGsyVyhOjYawFyn4EVT0=" }, - "timers-ext": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz", - "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==", - "requires": { - "es5-ext": "~0.10.46", - "next-tick": "1" - } - }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -3417,34 +3208,23 @@ } }, "ts-node": { - "version": "8.10.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", - "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", + "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", "dev": true, "requires": { "arg": "^4.1.0", + "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "source-map-support": "^0.5.17", "yn": "3.1.1" - }, - "dependencies": { - "source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - } } }, "tslib": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.0.tgz", - "integrity": "sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", + "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==" }, "tv4": { "version": "1.3.0", @@ -3488,9 +3268,9 @@ } }, "typescript": { - "version": "3.9.7", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", - "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz", + "integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==", "dev": true }, "typical": { @@ -3530,9 +3310,9 @@ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, "update-notifier": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.1.tgz", - "integrity": "sha512-9y+Kds0+LoLG6yN802wVXoIfxYEwh3FlZwzMwpCZp62S2i1/Jzeqb9Eeeju3NSHccGGasfGlK5/vEHbAifYRDg==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz", + "integrity": "sha512-Yld6Z0RyCYGB6ckIjffGOSOmHXj1gMeE7aROz4MG+XMkmixBX4jUngrGXNYz7wPKBmtoD4MnBa2Anu7RSKht/A==", "dev": true, "requires": { "boxen": "^4.2.0", @@ -3572,11 +3352,11 @@ } }, "utf-8-validate": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.2.tgz", - "integrity": "sha512-SwV++i2gTD5qh2XqaPzBnNX88N6HdyhQrNNRykvcS0QKvItV9u3vPEJr+X5Hhfb1JC0r0e1alL0iB09rY8+nmw==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.4.tgz", + "integrity": "sha512-MEF05cPSq3AwJ2C7B7sHAA6i53vONoZbMGX8My5auEVm6W+dJ2Jd/TZPyGJ5CH42V2XtbI5FD28HeHeqlPzZ3Q==", "requires": { - "node-gyp-build": "~3.7.0" + "node-gyp-build": "^4.2.0" } }, "util": { @@ -3605,24 +3385,30 @@ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" }, "vizion": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/vizion/-/vizion-0.2.13.tgz", - "integrity": "sha1-ExTN7is0EW+fWxJIU2+V2/zW718=", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/vizion/-/vizion-2.2.1.tgz", + "integrity": "sha512-sfAcO2yeSU0CSPFI/DmZp3FsFE9T+8913nv1xWBOyzODv13fwkn6Vl7HqxGpkr9F608M+8SuFId3s+BlZqfXww==", "requires": { - "async": "1.5" + "async": "^2.6.3", + "git-node-fs": "^1.0.0", + "ini": "^1.3.5", + "js-git": "^0.7.8" }, "dependencies": { "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "requires": { + "lodash": "^4.17.14" + } } } }, "websocket": { - "version": "1.0.32", - "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.32.tgz", - "integrity": "sha512-i4yhcllSP4wrpoPMU2N0TQ/q0O94LRG/eUQjEAamRltjQ1oT1PFFKOG4i877OlJgCG8rw6LrrowJp+TYCEWF7Q==", + "version": "1.0.33", + "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.33.tgz", + "integrity": "sha512-XwNqM2rN5eh3G2CUQE3OHZj+0xfdH42+OFK6LdC2yqiC0YU8e5UK0nYre220T0IyyN031V/XOvtHvXozvJYFWA==", "requires": { "bufferutil": "^4.0.1", "debug": "^2.2.0", diff --git a/scripts/cli/package.json b/scripts/cli/package.json index afdb1f2bd3..2a1944dfba 100644 --- a/scripts/cli/package.json +++ b/scripts/cli/package.json @@ -7,10 +7,9 @@ "polymesh-cli": "./dist/polymesh_cli.js" }, "scripts": { - "start": "npm run build && npm run global", + "start": "npm run build", "create": "npm run build && npm run test", "build": "npm run clean:some && tsc -p .", - "global": "npm i -g && polymesh-cli", "clean:some": "rm -rf ./dist ./docs", "clean:all": "rm -rf ./node_modules ./yarn.lock ./dist ./docs", "tscov": "tscov --min-coverage 90", @@ -38,32 +37,33 @@ "author": "Polymath Network", "license": "UNLICENSED", "dependencies": { - "@liftr/tscov": "^1.4.7", - "@polkadot/api": "^1.32.1", - "@polkadot/util": "^2.6.2", - "@polkadot/util-crypto": "^2.6.2", - "@types/clear": "^0.1.0", - "@types/figlet": "^1.2.0", - "@types/inquirer": "^6.5.0", + "@liftr/tscov": "^2.0.0", + "@polkadot/api": "^3.7.1", + "@polkadot/util": "^5.5.1", + "@polkadot/util-crypto": "^5.5.1", + "@types/clear": "^0.1.1", + "@types/figlet": "^1.2.1", + "@types/inquirer": "^7.3.1", "chai": "^4.2.0", "chalk": "^4.1.0", "clear": "^0.1.0", - "cli-progress": "^3.6.0", + "cli-progress": "^3.9.0", "command-line-args": "^5.1.1", - "commander": "^5.1.0", + "commander": "^7.0.0", "crypto-random-string": "^3.3.0", "esm": "^3.2.25", - "figlet": "^1.4.0", - "inquirer": "^7.1.0", - "nodejs-fs-utils": "^1.2.4", + "figlet": "^1.5.0", + "inquirer": "^7.3.3", + "minimist": "^1.2.5", + "nodejs-fs-utils": "^1.2.5", "path": "^0.12.7", - "pm2": "^4.2.3", + "pm2": "^4.5.4", "readline-sync": "^1.4.10" }, "devDependencies": { - "@types/node": "^14.0.13", - "nodemon": "^2.0.4", - "ts-node": "^8.10.2", - "typescript": "^3.9.5" + "@types/node": "^14.14.22", + "nodemon": "^2.0.7", + "ts-node": "^9.1.1", + "typescript": "^4.1.3" } } diff --git a/scripts/cli/tests/11_governance_management.js b/scripts/cli/tests/11_governance_management.js index 756210a65e..b593ae02b3 100644 --- a/scripts/cli/tests/11_governance_management.js +++ b/scripts/cli/tests/11_governance_management.js @@ -25,7 +25,7 @@ async function main() { // Bob and Dave needs some funds to use. await reqImports.distributePolyBatch(api, [bob, dave], reqImports.transfer_amount, alice); - await sendTx(dave, api.tx.staking.bond(bob.publicKey, 20000, "Staked")); + await sendTx(dave, api.tx.staking.bond(bob.publicKey, 1000000, "Staked")); const setLimit = api.tx.pips.setActivePipLimit(42); let firstPipCount = await api.query.pips.pipIdSequence(); diff --git a/scripts/cli/tests/12_A_settlement.js b/scripts/cli/tests/12_A_settlement.js index 38a9f9d127..7c088d1102 100644 --- a/scripts/cli/tests/12_A_settlement.js +++ b/scripts/cli/tests/12_A_settlement.js @@ -31,7 +31,7 @@ async function main() { alice ); - await reqImports.issueTokenPerDid(api, [alice], ticker); + await reqImports.issueTokenPerDid(api, [alice], ticker, 1000000, null); await addComplianceRequirement(api, alice, ticker); @@ -55,8 +55,8 @@ async function main() { 100 ); - await affirmInstruction(api, alice, intructionCounterAB, alice_did); - await affirmInstruction(api, bob, intructionCounterAB, bob_did); + await affirmInstruction(api, alice, intructionCounterAB, alice_did, 1); + await affirmInstruction(api, bob, intructionCounterAB, bob_did, 0); //await rejectInstruction(api, bob, intructionCounter); //await unathorizeInstruction(api, alice, instructionCounter); @@ -142,22 +142,24 @@ async function addInstruction( return instructionCounter; } -async function affirmInstruction(api, sender, instructionCounter, did) { +async function affirmInstruction(api, sender, instructionCounter, did, leg_counts) { const transaction = await api.tx.settlement.affirmInstruction( instructionCounter, - [getDefaultPortfolio(did)] + [getDefaultPortfolio(did)], + leg_counts ); let tx = await reqImports.sendTx(sender, transaction); if(tx !== -1) reqImports.fail_count--; } -async function withdrawInstruction(api, sender, instructionCounter, did) { +async function withdrawInstruction(api, sender, instructionCounter, did, leg_counts) { const transaction = await api.tx.settlement.withdrawInstruction( instructionCounter, - [getDefaultPortfolio(did)] + [getDefaultPortfolio(did)], + leg_counts ); let tx = await reqImports.sendTx(sender, transaction); diff --git a/scripts/cli/tests/12_B_settlement.js b/scripts/cli/tests/12_B_settlement.js index db45f19938..e6b569570b 100644 --- a/scripts/cli/tests/12_B_settlement.js +++ b/scripts/cli/tests/12_B_settlement.js @@ -43,9 +43,9 @@ async function main() { alice ); - await reqImports.issueTokenPerDid(api, [alice], ticker); + await reqImports.issueTokenPerDid(api, [alice], ticker, 1000000, null); - await reqImports.issueTokenPerDid(api, [bob], ticker2); + await reqImports.issueTokenPerDid(api, [bob], ticker2, 1000000, null); await reqImports.addComplianceRequirement(api, alice, ticker); await reqImports.addComplianceRequirement(api, bob, ticker2); @@ -93,16 +93,16 @@ async function main() { 100 ); - await reqImports.affirmInstruction(api, alice, instructionCounter, alice_did); + await reqImports.affirmInstruction(api, alice, instructionCounter, alice_did, 4); - await reqImports.affirmInstruction(api, bob, instructionCounter, bob_did); + await reqImports.affirmInstruction(api, bob, instructionCounter, bob_did, 1); - await reqImports.affirmInstruction(api, charlie, instructionCounter, charlie_did); + await reqImports.affirmInstruction(api, charlie, instructionCounter, charlie_did, 0); - await reqImports.affirmInstruction(api, dave, instructionCounter, dave_did); + await reqImports.affirmInstruction(api, dave, instructionCounter, dave_did, 0); //await reqImports.rejectInstruction(api, eve, instructionCounter); - await reqImports.affirmInstruction(api, eve, instructionCounter, eve_did); + await reqImports.affirmInstruction(api, eve, instructionCounter, eve_did, 0); aliceACMEBalance = await api.query.asset.balanceOf(ticker, alice_did); bobACMEBalance = await api.query.asset.balanceOf(ticker, bob_did); diff --git a/scripts/cli/tests/7_create_claim_compliance.js b/scripts/cli/tests/7_create_claim_compliance.js index d07067f3db..7c9e75cb22 100644 --- a/scripts/cli/tests/7_create_claim_compliance.js +++ b/scripts/cli/tests/7_create_claim_compliance.js @@ -24,7 +24,7 @@ async function main() { await reqImports.distributePolyBatch( api, primary_keys, reqImports.transfer_amount, testEntities[0] ); - await reqImports.issueTokenPerDid( api, primary_keys, ticker ); + await reqImports.issueTokenPerDid( api, primary_keys, ticker, 1000000, null); await createClaimCompliance( api, primary_keys, issuer_dids, ticker ); diff --git a/scripts/cli/tests/8_asset_transfer.js b/scripts/cli/tests/8_asset_transfer.js index d3c2d5ac94..05dcc67c8e 100644 --- a/scripts/cli/tests/8_asset_transfer.js +++ b/scripts/cli/tests/8_asset_transfer.js @@ -22,7 +22,7 @@ async function main() { await reqImports.distributePolyBatch( api, primary_keys, reqImports.transfer_amount, testEntities[0] ); - await reqImports.issueTokenPerDid( api, primary_keys, ticker); + await reqImports.issueTokenPerDid( api, primary_keys, ticker, 1000000, null); // receiverRules Claim await reqImports.addClaimsToDids( api, primary_keys, issuer_dids[2], "Exempted", { "Ticker": ticker }, null ); diff --git a/scripts/cli/util/distributeALCY.js b/scripts/cli/util/distributeALCY.js new file mode 100644 index 0000000000..c8abea14e7 --- /dev/null +++ b/scripts/cli/util/distributeALCY.js @@ -0,0 +1,84 @@ +// Set options as a parameter, environment variable, or rc file. +require = require("esm")(module /*, options*/); +module.exports = require("./init.js"); + +let { reqImports } = require("./init.js"); +const minimist = require('minimist'); +const args = minimist(process.argv.slice(2), { + string: 'account' +}); + +async function main() { + + const api = await reqImports.createApi(); + const ticker = args.ticker; + const account = await reqImports.generateEntityFromUri(api, args.account); + const amount = args.amount; + const venueId = args.venueId; + + let empty_did = "0x0000000000000000000000000000000000000000000000000000000000000000" + const listOfDids = await api.query.identity.didRecords.entries(); + let all_dids = new Array(); + + for (let i = 0; i < listOfDids.length; i++) { + let pk = listOfDids[i][1]['primary_key']; + let did = await api.query.identity.keyToIdentityIds(pk); + if (did.toString() != empty_did) { + all_dids.push(did); + } + } + + await reqImports.issueTokenPerDid(api, [account], ticker, 100_000_000_000_000, null); + + await reqImports.addComplianceRequirement(api, account, ticker); + + await batchAtomic(api, account, all_dids, amount, ticker, venueId); + + process.exit(); +} + +async function batchAtomic(api, sender, receivers, amount, ticker, venueId) { + + let tx; + let txArray = []; + let batch; + let batchTx; + let senderDid = await api.query.identity.keyToIdentityIds(sender.publicKey); + let batchSize = 10; + + for (i = 0; i < receivers.length; i++) { + if (receivers[i] != senderDid.toString()) { + console.log("Prepping for DID: ", receivers[i].toString()); + tx = await addAndAffirmInstruction(api, venueId, senderDid, receivers[i], ticker, amount); + txArray.push(tx); + } else { + console.log("Skipping Sender"); + } + } + + + for (i = 0; i < txArray.length; i += batchSize) { + batch = txArray.slice(i, i + batchSize); + batchTx = await api.tx.utility.batchAtomic(batch); + await reqImports.sendTx(sender, batchTx); + } + +} + +async function addAndAffirmInstruction(api, venueId, senderDid, receiverDid, ticker, amount) { + + let senderPortfolio = reqImports.getDefaultPortfolio(senderDid); + let receiverPortfolio = reqImports.getDefaultPortfolio(receiverDid); + + let leg = { + from: senderPortfolio, + to: receiverPortfolio, + asset: ticker, + amount: amount, + }; + + return await api.tx.settlement.addAndAffirmInstruction(venueId, 0, null, null, [leg], [senderPortfolio]); +} + +main().catch(console.error); + diff --git a/scripts/cli/util/init.js b/scripts/cli/util/init.js index 903b220ae6..03d6716260 100644 --- a/scripts/cli/util/init.js +++ b/scripts/cli/util/init.js @@ -292,17 +292,25 @@ async function authorizeJoinToIdentities(api, accounts, dids, secondary_accounts } // Creates a token for a did -async function issueTokenPerDid(api, accounts, ticker) { - +async function issueTokenPerDid(api, accounts, ticker, amount, fundingRound) { + assert(ticker.length <= 12, "Ticker cannot be longer than 12 characters"); + let tickerExist = await api.query.asset.tickers(ticker); + + if (tickerExist.owner == 0) { - let nonceObj = { nonce: nonces.get(accounts[0].address) }; - const transaction = api.tx.asset.createAsset( - ticker, ticker, 1000000, true, 0, [], "abc" - ); - await sendTransaction(transaction, accounts[0], nonceObj); + let nonceObj = { nonce: nonces.get(accounts[0].address) }; + const transaction = api.tx.asset.createAsset( + ticker, ticker, amount, true, 0, [], fundingRound + ); + await sendTransaction(transaction, accounts[0], nonceObj); + + nonces.set(accounts[0].address, nonces.get(accounts[0].address).addn(1)); + + } else { + console.log("ticker exists already"); + } - nonces.set(accounts[0].address, nonces.get(accounts[0].address).addn(1)); } // Returns the asset did @@ -486,13 +494,20 @@ async function sendTx(signer, tx) { } async function addComplianceRequirement(api, sender, ticker) { - const transaction = await api.tx.complianceManager.addComplianceRequirement( - ticker, - [], - [] - ); - await sendTx(sender, transaction); + let assetCompliance = await api.query.complianceManager.assetCompliances(ticker); + + if (assetCompliance.requirements.length == 0) { + const transaction = await api.tx.complianceManager.addComplianceRequirement( + ticker, + [], + [] + ); + + await sendTx(sender, transaction); + } else { + console.log("Asset already has compliance."); + } } async function createVenue(api, sender) { @@ -512,10 +527,11 @@ function getDefaultPortfolio(did) { return { "did": did, "kind": "Default" }; } -async function affirmInstruction(api, sender, instructionCounter, did) { +async function affirmInstruction(api, sender, instructionCounter, did, leg_counts) { const transaction = await api.tx.settlement.affirmInstruction( instructionCounter, - [getDefaultPortfolio(did)] + [getDefaultPortfolio(did)], + leg_counts ); await sendTx(sender, transaction); @@ -669,6 +685,7 @@ let reqImports = { generateRandomEntity, generateRandomTicker, generateRandomKey, + getDefaultPortfolio, }; export { reqImports }; diff --git a/scripts/cli/yarn.lock b/scripts/cli/yarn.lock index f7b9994733..238d6495ff 100644 --- a/scripts/cli/yarn.lock +++ b/scripts/cli/yarn.lock @@ -1773,7 +1773,7 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@1.2.5, minimist@^1.2.0: +minimist@1.2.5, minimist@^1.2.0, minimist@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== diff --git a/scripts/coverage.sh b/scripts/coverage.sh new file mode 100755 index 0000000000..11b2163de0 --- /dev/null +++ b/scripts/coverage.sh @@ -0,0 +1,90 @@ +RUSTFLAGS="-Zinstrument-coverage" \ +LLVM_PROFILE_FILE="json5format-%m.profraw" \ +BUILD_DUMMY_WASM_BINARY=1 \ +cargo test --tests \ + --package pallet-staking \ + --package pallet-group \ + --package pallet-sudo \ + --package polymesh-primitives \ + --package node-rpc-runtime-api \ + --package pallet-transaction-payment \ + --package polymesh-runtime-tests \ + --package pallet-balances:0.1.0 \ + --features default_identity + +cargo profdata -- merge -sparse $(find . -name 'json5format-*.profraw') -o json5format.profdata + +if [[ -v CIRCLECI ]]; then + cargo cov -- export \ + $( \ + for file in \ + $( \ + RUSTFLAGS="-Zinstrument-coverage" BUILD_DUMMY_WASM_BINARY=1 LLVM_PROFILE_FILE="json5format-%m.profraw" \ + cargo test --tests \ + --package pallet-staking \ + --package pallet-group \ + --package pallet-sudo \ + --package polymesh-primitives \ + --package node-rpc-runtime-api \ + --package pallet-transaction-payment \ + --package polymesh-runtime-tests \ + --package pallet-balances:0.1.0 \ + --features default_identity \ + --no-run --message-format=json \ + | jq -r "select(.profile.test == true) | .filenames[]" \ + | grep -v dSYM - \ + ); \ + do \ + printf "%s %s " -object $file; \ + done \ + ) \ + --format='lcov' \ + --instr-profile=json5format.profdata \ + --ignore-filename-regex='/.cargo/registry/' \ + --ignore-filename-regex='/.cargo/git/' \ + --ignore-filename-regex='/target/debug/' \ + --ignore-filename-regex='/tests/' \ + --ignore-filename-regex='bin/' \ + --ignore-filename-regex='contracts/' \ + --ignore-filename-regex='rpc/' \ + --ignore-filename-regex='/rustc/' > coverage.txt + + bash <(curl -s https://codecov.io/bash) +else + cargo cov -- report \ + $( \ + for file in \ + $( \ + RUSTFLAGS="-Zinstrument-coverage" BUILD_DUMMY_WASM_BINARY=1 LLVM_PROFILE_FILE="json5format-%m.profraw" \ + cargo test --tests \ + --package pallet-staking \ + --package pallet-group \ + --package pallet-sudo \ + --package polymesh-primitives \ + --package node-rpc-runtime-api \ + --package pallet-transaction-payment \ + --package polymesh-runtime-tests \ + --package pallet-balances:0.1.0 \ + --features default_identity \ + --no-run --message-format=json \ + | jq -r "select(.profile.test == true) | .filenames[]" \ + | grep -v dSYM - \ + ); \ + do \ + printf "%s %s " -object $file; \ + done \ + ) \ + --instr-profile=json5format.profdata \ + --use-color \ + --ignore-filename-regex='/.cargo/registry/' \ + --ignore-filename-regex='/.cargo/git/' \ + --ignore-filename-regex='/target/debug/' \ + --ignore-filename-regex='/tests/' \ + --ignore-filename-regex='bin/' \ + --ignore-filename-regex='contracts/' \ + --ignore-filename-regex='rpc/' \ + --ignore-filename-regex='/rustc/' \ + --summary-only + + find . -name '*.profraw' -delete +fi diff --git a/scripts/migration-tests.sh b/scripts/migration-tests.sh new file mode 100755 index 0000000000..a7f114cb88 --- /dev/null +++ b/scripts/migration-tests.sh @@ -0,0 +1 @@ +BUILD_DUMMY_WASM_BINARY=1 cargo test -p migration-tests --lib -- --nocapture diff --git a/scripts/test.sh b/scripts/test.sh index a3587f7ba9..7c5f70bf9a 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1 +1 @@ -BUILD_DUMMY_WASM_BINARY=true cargo test --package polymesh-runtime-tests --features default_identity +BUILD_DUMMY_WASM_BINARY=1 cargo test --package polymesh-runtime-tests --features default_identity diff --git a/src/chain_spec.rs b/src/chain_spec.rs index 01b2e89433..f3839cb902 100644 --- a/src/chain_spec.rs +++ b/src/chain_spec.rs @@ -434,11 +434,13 @@ fn general_testnet_genesis( GeneralConfig::GenesisConfig { frame_system: Some(GeneralConfig::SystemConfig { - code: general::WASM_BINARY.to_vec(), + code: general::WASM_BINARY + .expect("WASM binary was not generated") + .to_vec(), changes_trie_config: Default::default(), }), asset: Some(asset!()), - checkpoint: Some(checkpoint!()), + pallet_checkpoint: Some(checkpoint!()), identity: Some(GeneralConfig::IdentityConfig { identities: all_identities, secondary_keys, @@ -620,11 +622,13 @@ fn alcyone_testnet_genesis( AlcyoneConfig::GenesisConfig { frame_system: Some(AlcyoneConfig::SystemConfig { - code: alcyone::WASM_BINARY.to_vec(), + code: alcyone::WASM_BINARY + .expect("WASM binary was not generated") + .to_vec(), changes_trie_config: Default::default(), }), asset: Some(asset!()), - checkpoint: Some(checkpoint!()), + pallet_checkpoint: Some(checkpoint!()), identity: Some(AlcyoneConfig::IdentityConfig { identities: all_identities, secondary_keys, diff --git a/src/service.rs b/src/service.rs index b3e1b89b3f..4323d9eacc 100644 --- a/src/service.rs +++ b/src/service.rs @@ -412,7 +412,7 @@ where } // Spawn authority discovery module. - if matches!(role, Role::Authority{..} | Role::Sentry {..}) { + if matches!(role, Role::Authority { .. } | Role::Sentry { .. }) { let (sentries, authority_discovery_role) = match role { sc_service::config::Role::Authority { ref sentry_nodes } => ( sentry_nodes.clone(), diff --git a/utils/permissions/Cargo.toml b/utils/permissions/Cargo.toml new file mode 100644 index 0000000000..f12b51b11c --- /dev/null +++ b/utils/permissions/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "permissions" +version = "0.1.0" +authors = ["Polymath"] +edition = "2018" + +[dependencies] +scraper = "0.12" +regex = "1" +lazy_static = "1" \ No newline at end of file diff --git a/utils/permissions/src/doc_parser/enums.rs b/utils/permissions/src/doc_parser/enums.rs new file mode 100644 index 0000000000..5f8ef7755d --- /dev/null +++ b/utils/permissions/src/doc_parser/enums.rs @@ -0,0 +1,68 @@ +use lazy_static::lazy_static; +use regex::Regex; +use scraper::{ElementRef, Html, Selector}; + +lazy_static! { + static ref VARIANT_REGEX: Regex = Regex::new(r#"variant\.(.+)"#).unwrap(); +} + +#[derive(Debug)] +pub struct EnumDoc { + pub variants: Vec, +} + +#[derive(Debug)] +pub struct Variant { + pub name: String, + pub doc_block: Html, +} + +pub struct EnumDocParser { + html: Html, +} + +impl EnumDocParser { + pub fn parse(html: Html) -> Option { + let parser = Self { html }; + Some(EnumDoc { + variants: parser.parse_all_variants(), + }) + } + + fn parse_all_variants(&self) -> Vec { + let all_div_selector = Selector::parse("div").unwrap(); + let all_divs: Vec = self.html.select(&all_div_selector).collect(); + + all_divs + .iter() + .enumerate() + .filter_map(|(i, _)| self.parse_variant(&all_divs, i)) + .collect() + } + + fn parse_variant(&self, all_divs: &[ElementRef], index: usize) -> Option { + let variant_div = all_divs[index]; + // Look for a variant div and parse the name + let name = VARIANT_REGEX + .captures(variant_div.value().id()?)? + .get(1)? + .as_str() + .to_owned(); + + // Check for a doc block associated with the above variant + let doc_block = all_divs[index + 1..] + .iter() + // Stop iterating once we hit the next variant + .take_while(|div| { + div.value() + .id() + .map(|id| !VARIANT_REGEX.is_match(id)) + .unwrap_or(true) + }) + .filter(|div| div.value().classes.iter().any(|s| s == "docblock")) + .map(|div| Html::parse_document(&div.html())) + .next()?; + + Some(Variant { name, doc_block }) + } +} diff --git a/utils/permissions/src/doc_parser/mod.rs b/utils/permissions/src/doc_parser/mod.rs new file mode 100644 index 0000000000..e4e9fda934 --- /dev/null +++ b/utils/permissions/src/doc_parser/mod.rs @@ -0,0 +1 @@ +pub mod enums; diff --git a/utils/permissions/src/main.rs b/utils/permissions/src/main.rs new file mode 100644 index 0000000000..3e6a232864 --- /dev/null +++ b/utils/permissions/src/main.rs @@ -0,0 +1,140 @@ +/// # Overview +/// The intended purpose of this script is to parse the permissions of individual extrinsics. +/// Extrinsics are documented as variants of a `Call` enum located at the root of the pallet. +/// The output is in CSV in the following format `, , , ...` +/// +/// # Usage +/// Build a fresh version of the rustdoc +/// ``` +/// cargo doc +/// ``` +/// +/// Run the script +/// ``` +/// cargo run --package permissions --bin permissions +/// ``` +use crate::doc_parser::enums::{EnumDoc, EnumDocParser}; +use regex::Regex; +use scraper::{Html, Selector}; +use std::collections::{BTreeMap, BTreeSet}; +use std::fs::{read_dir, File}; +use std::io::Read; +use std::path::PathBuf; + +mod doc_parser; + +fn main() { + assert!( + std::env::current_dir() + .ok() + .map(|dir| dir.join("target/doc").exists()) + .unwrap_or(false), + "can't find target directory! try running in project root" + ); + + let pallets_regex = Regex::new("target/doc/pallet_.*").unwrap(); + + let mut permission_mappings: BTreeMap>> = BTreeMap::new(); + + // read the docs of all crates in target that match a regex + read_dir("target/doc") + .expect("dir does not exist") + .into_iter() + .filter_map(|entry| entry.ok().map(|entry| entry.path())) + .collect::>() + .into_iter() + .filter(|path| { + path.to_str() + .map(|str| pallets_regex.is_match(str)) + .unwrap_or(false) + }) + .filter_map(|path| { + path.file_name() + .and_then(|name| name.to_str().map(|s| s.to_owned())) + .map(|name| (name, path.join("enum.Call.html"))) + }) + .filter(|(_, path)| path.exists()) + .filter_map(|(pallet, path)| File::open(&path).ok().map(|f| (pallet, f))) + .filter_map(|(pallet, mut file)| { + let mut text = String::new(); + file.read_to_string(&mut text).ok().map(|_| (pallet, text)) + }) + .filter(|(_, text)| !text.is_empty()) + .filter_map(|(pallet, text)| { + EnumDocParser::parse(Html::parse_document(&text)).map(|doc| (pallet, doc)) + }) + .map(|(pallet, doc)| (pallet, parse_permissions(doc))) + .for_each(|(pallet, permissions)| { + for (extrinsic, permission) in permissions { + permission_mappings + .entry(pallet.clone()) + .or_insert(Default::default()) + .entry(extrinsic.clone()) + .or_insert(Default::default()) + .push(permission); + } + }); + + permission_mappings + .into_iter() + .for_each(|(pallet, mapping)| { + mapping.into_iter().for_each(|(extrinsic, permissions)| { + println!("{},{},{}", pallet, extrinsic, permissions.join(",")) + }) + }); +} + +fn parse_permissions(doc: EnumDoc) -> Vec<(String, String)> { + let h1_selector = Selector::parse("h1").unwrap(); + let h2_selector = Selector::parse("h2").unwrap(); + let ul_selector = Selector::parse("ul").unwrap(); + let li_selector = Selector::parse("li").unwrap(); + let is_heading = |child| h1_selector.matches(&child) || h2_selector.matches(&child); + + let mut permissions = Vec::new(); + doc.variants + .iter() + // Find the div that contains the content of the doc block + .filter_map(|variant| { + variant + .doc_block + .select(&Selector::parse("div.docblock").unwrap()) + .next() + .map(|div| (variant.name.clone(), div)) + }) + .for_each(|(name, doc_block_div)| { + // Collect all children of the doc block, which in practice is the content of the doc block + let children: Vec<_> = doc_block_div + .select(&Selector::parse("*").unwrap()) + .collect(); + + children + .iter() + .enumerate() + .filter(|(_, child)| is_heading(**child)) + // Check if the heading is `Permissions` + .filter(|(_, child)| { + child + .value() + .id() + .map(|s| s.starts_with("permissions")) + .unwrap_or(false) + }) + // Look for a ul in the contents before the next h1/h2 + .for_each(|(i, _)| { + children[i + 1..] + .iter() + // Stop once we hit another h1 + .take_while(|element| !is_heading(**element)) + .filter(|element| ul_selector.matches(element)) + .next() + .map(|ul| { + ul.select(&li_selector) + .map(|element| element.text().collect()) + .for_each(|li| permissions.push((name.clone(), li))) + }); + }) + }); + + permissions +} diff --git a/utils/wasm-builder/Cargo.toml b/utils/wasm-builder/Cargo.toml deleted file mode 100644 index ea0343fc14..0000000000 --- a/utils/wasm-builder/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "substrate-wasm-builder" -version = "1.0.11" -authors = ["Parity Technologies "] -description = "Utility for building WASM binaries" -edition = "2018" -readme = "README.md" -repository = "https://github.com/PolymathNetwork/substrate" -license = "Apache-2.0" -homepage = "https://substrate.dev" - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -build-helper = "0.1.1" -cargo_metadata = "0.10.0" -tempfile = "3.1.0" -toml = "0.5.4" -walkdir = "2.3.1" -fs2 = "0.4.3" -wasm-gc-api = "0.1.11" -atty = "0.2.13" -itertools = "0.8.2" diff --git a/utils/wasm-builder/README.md b/utils/wasm-builder/README.md deleted file mode 100644 index b72e7e16d4..0000000000 --- a/utils/wasm-builder/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# Wasm builder is a utility for building a project as a Wasm binary - -The Wasm builder is a tool that integrates the process of building the WASM binary of your project into the main -`cargo` build process. - -## Project setup - -A project that should be compiled as a Wasm binary needs to: - -1. Add a `build.rs` file. -2. Add `substrate-wasm-builder` as dependency into `build-dependencies`. - -The `build.rs` file needs to contain the following code: - -```rust -use wasm_builder_runner::{build_current_project, WasmBuilderSource}; - -fn main() { - build_current_project( - // The name of the file being generated in out-dir. - "wasm_binary.rs", - // How to include wasm-builder, in this case from crates.io. - WasmBuilderSource::Crates("1.0.0"), - ); -} -``` - -As the final step, you need to add the following to your project: - -```rust -include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -``` - -This will include the generated Wasm binary as two constants `WASM_BINARY` and `WASM_BINARY_BLOATY`. -The former is a compact Wasm binary and the latter is not compacted. - -### Feature - -Wasm builder supports to enable cargo features while building the Wasm binary. By default it will -enable all features in the wasm build that are enabled for the native build except the -`default` and `std` features. Besides that, wasm builder supports the special `runtime-wasm` -feature. This `runtime-wasm` feature will be enabled by the wasm builder when it compiles the -Wasm binary. If this feature is not present, it will not be enabled. - -## Environment variables - -By using environment variables, you can configure which Wasm binaries are built and how: - -- `SKIP_WASM_BUILD` - Skips building any wasm binary. This is useful when only native should be recompiled. -- `BUILD_DUMMY_WASM_BINARY` - Builds dummy wasm binaries. These dummy binaries are empty and useful - for `cargo check` runs. -- `WASM_BUILD_TYPE` - Sets the build type for building wasm binaries. Supported values are `release` or `debug`. - By default the build type is equal to the build type used by the main build. -- `TRIGGER_WASM_BUILD` - Can be set to trigger a wasm build. On subsequent calls the value of the variable - needs to change. As wasm builder instructs `cargo` to watch for file changes - this environment variable should only be required in certain circumstances. -- `WASM_BUILD_RUSTFLAGS` - Extend `RUSTFLAGS` given to `cargo build` while building the wasm binary. -- `WASM_BUILD_NO_COLOR` - Disable color output of the wasm build. -- `WASM_TARGET_DIRECTORY` - Will copy any build wasm binary to the given directory. The path needs - to be absolute. -- `WASM_BUILD_TOOLCHAIN` - The toolchain that should be used to build the wasm binaries. The - format needs to be the same as used by cargo, e.g. `nightly-2020-02-20`. - -Each project can be skipped individually by using the environment variable `SKIP_PROJECT_NAME_WASM_BUILD`. -Where `PROJECT_NAME` needs to be replaced by the name of the cargo project, e.g. `node-runtime` will -be `NODE_RUNTIME`. - -## Prerequisites: - -Wasm builder requires the following prerequisites for building the Wasm binary: - -- rust nightly + `wasm32-unknown-unknown` toolchain - -If a specific rust nightly is installed with `rustup`, it is important that the wasm target is installed -as well. For example if installing the rust nightly from 20.02.2020 using `rustup install nightly-2020-02-20`, -the wasm target needs to be installed as well `rustup target add wasm32-unknown-unknown --toolchain nightly-2020-02-20`. - -License: Apache-2.0 diff --git a/utils/wasm-builder/src/lib.rs b/utils/wasm-builder/src/lib.rs deleted file mode 100644 index 978de20cb5..0000000000 --- a/utils/wasm-builder/src/lib.rs +++ /dev/null @@ -1,321 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! # Wasm builder is a utility for building a project as a Wasm binary -//! -//! The Wasm builder is a tool that integrates the process of building the WASM binary of your project into the main -//! `cargo` build process. -//! -//! ## Project setup -//! -//! A project that should be compiled as a Wasm binary needs to: -//! -//! 1. Add a `build.rs` file. -//! 2. Add `substrate-wasm-builder` as dependency into `build-dependencies`. -//! -//! The `build.rs` file needs to contain the following code: -//! -//! ```ignore -//! use wasm_builder_runner::{build_current_project, WasmBuilderSource}; -//! -//! fn main() { -//! build_current_project( -//! // The name of the file being generated in out-dir. -//! "wasm_binary.rs", -//! // How to include wasm-builder, in this case from crates.io. -//! WasmBuilderSource::Crates("1.0.0"), -//! ); -//! } -//! ``` -//! -//! As the final step, you need to add the following to your project: -//! -//! ```ignore -//! include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -//! ``` -//! -//! This will include the generated Wasm binary as two constants `WASM_BINARY` and `WASM_BINARY_BLOATY`. -//! The former is a compact Wasm binary and the latter is not compacted. -//! -//! ### Feature -//! -//! Wasm builder supports to enable cargo features while building the Wasm binary. By default it will -//! enable all features in the wasm build that are enabled for the native build except the -//! `default` and `std` features. Besides that, wasm builder supports the special `runtime-wasm` -//! feature. This `runtime-wasm` feature will be enabled by the wasm builder when it compiles the -//! Wasm binary. If this feature is not present, it will not be enabled. -//! -//! ## Environment variables -//! -//! By using environment variables, you can configure which Wasm binaries are built and how: -//! -//! - `SKIP_WASM_BUILD` - Skips building any wasm binary. This is useful when only native should be recompiled. -//! - `BUILD_DUMMY_WASM_BINARY` - Builds dummy wasm binaries. These dummy binaries are empty and useful -//! for `cargo check` runs. -//! - `WASM_BUILD_TYPE` - Sets the build type for building wasm binaries. Supported values are `release` or `debug`. -//! By default the build type is equal to the build type used by the main build. -//! - `TRIGGER_WASM_BUILD` - Can be set to trigger a wasm build. On subsequent calls the value of the variable -//! needs to change. As wasm builder instructs `cargo` to watch for file changes -//! this environment variable should only be required in certain circumstances. -//! - `WASM_BUILD_RUSTFLAGS` - Extend `RUSTFLAGS` given to `cargo build` while building the wasm binary. -//! - `WASM_BUILD_NO_COLOR` - Disable color output of the wasm build. -//! - `WASM_TARGET_DIRECTORY` - Will copy any build wasm binary to the given directory. The path needs -//! to be absolute. -//! - `WASM_BUILD_TOOLCHAIN` - The toolchain that should be used to build the wasm binaries. The -//! format needs to be the same as used by cargo, e.g. `nightly-2020-02-20`. -//! -//! Each project can be skipped individually by using the environment variable `SKIP_PROJECT_NAME_WASM_BUILD`. -//! Where `PROJECT_NAME` needs to be replaced by the name of the cargo project, e.g. `node-runtime` will -//! be `NODE_RUNTIME`. -//! -//! ## Prerequisites: -//! -//! Wasm builder requires the following prerequisites for building the Wasm binary: -//! -//! - rust nightly + `wasm32-unknown-unknown` toolchain -//! -//! If a specific rust nightly is installed with `rustup`, it is important that the wasm target is installed -//! as well. For example if installing the rust nightly from 20.02.2020 using `rustup install nightly-2020-02-20`, -//! the wasm target needs to be installed as well `rustup target add wasm32-unknown-unknown --toolchain nightly-2020-02-20`. - -use std::{ - env, fs, - io::BufRead, - path::PathBuf, - process::{self, Command}, -}; - -mod prerequisites; -mod wasm_project; - -/// Environment variable that tells us to skip building the wasm binary. -const SKIP_BUILD_ENV: &str = "SKIP_WASM_BUILD"; - -/// Environment variable to force a certain build type when building the wasm binary. -/// Expects "debug" or "release" as value. -/// -/// By default the WASM binary uses the same build type as the main cargo build. -const WASM_BUILD_TYPE_ENV: &str = "WASM_BUILD_TYPE"; - -/// Environment variable to extend the `RUSTFLAGS` variable given to the wasm build. -const WASM_BUILD_RUSTFLAGS_ENV: &str = "WASM_BUILD_RUSTFLAGS"; - -/// Environment variable to set the target directory to copy the final wasm binary. -/// -/// The directory needs to be an absolute path. -const WASM_TARGET_DIRECTORY: &str = "WASM_TARGET_DIRECTORY"; - -/// Environment variable to disable color output of the wasm build. -const WASM_BUILD_NO_COLOR: &str = "WASM_BUILD_NO_COLOR"; - -/// Environment variable to set the toolchain used to compile the wasm binary. -const WASM_BUILD_TOOLCHAIN: &str = "WASM_BUILD_TOOLCHAIN"; - -/// Build the currently built project as wasm binary. -/// -/// The current project is determined by using the `CARGO_MANIFEST_DIR` environment variable. -/// -/// `file_name` - The name + path of the file being generated. The file contains the -/// constant `WASM_BINARY`, which contains the built WASM binary. -/// `cargo_manifest` - The path to the `Cargo.toml` of the project that should be built. -pub fn build_project(file_name: &str, cargo_manifest: &str) { - build_project_with_default_rustflags(file_name, cargo_manifest, ""); -} - -/// Build the currently built project as wasm binary. -/// -/// The current project is determined by using the `CARGO_MANIFEST_DIR` environment variable. -/// -/// `file_name` - The name + path of the file being generated. The file contains the -/// constant `WASM_BINARY`, which contains the built WASM binary. -/// `cargo_manifest` - The path to the `Cargo.toml` of the project that should be built. -/// `default_rustflags` - Default `RUSTFLAGS` that will always be set for the build. -pub fn build_project_with_default_rustflags( - file_name: &str, - cargo_manifest: &str, - default_rustflags: &str, -) { - if check_skip_build() { - return; - } - - let cargo_manifest = PathBuf::from(cargo_manifest); - - if !cargo_manifest.exists() { - panic!("'{}' does not exist!", cargo_manifest.display()); - } - - if !cargo_manifest.ends_with("Cargo.toml") { - panic!( - "'{}' no valid path to a `Cargo.toml`!", - cargo_manifest.display() - ); - } - - if let Some(err_msg) = prerequisites::check() { - eprintln!("{}", err_msg); - process::exit(1); - } - - let (wasm_binary, bloaty) = - wasm_project::create_and_compile(&cargo_manifest, default_rustflags); - - write_file_if_changed( - file_name.into(), - format!( - r#" - pub const WASM_BINARY: &[u8] = include_bytes!("{wasm_binary}"); - pub const WASM_BINARY_BLOATY: &[u8] = include_bytes!("{wasm_binary_bloaty}"); - "#, - wasm_binary = wasm_binary.wasm_binary_path_escaped(), - wasm_binary_bloaty = bloaty.wasm_binary_bloaty_path_escaped(), - ), - ); -} - -/// Checks if the build of the WASM binary should be skipped. -fn check_skip_build() -> bool { - env::var(SKIP_BUILD_ENV).is_ok() -} - -/// Write to the given `file` if the `content` is different. -fn write_file_if_changed(file: PathBuf, content: String) { - if fs::read_to_string(&file).ok().as_ref() != Some(&content) { - fs::write(&file, content).expect(&format!("Writing `{}` can not fail!", file.display())); - } -} - -/// Copy `src` to `dst` if the `dst` does not exist or is different. -fn copy_file_if_changed(src: PathBuf, dst: PathBuf) { - let src_file = fs::read_to_string(&src).ok(); - let dst_file = fs::read_to_string(&dst).ok(); - - if src_file != dst_file { - fs::copy(&src, &dst).expect(&format!( - "Copying `{}` to `{}` can not fail; qed", - src.display(), - dst.display() - )); - } -} - -/// Get a cargo command that compiles with nightly -fn get_nightly_cargo() -> CargoCommand { - let env_cargo = - CargoCommand::new(&env::var("CARGO").expect("`CARGO` env variable is always set by cargo")); - let default_cargo = CargoCommand::new("cargo"); - let rustup_run_nightly = CargoCommand::new_with_args("rustup", &["run", "nightly", "cargo"]); - let wasm_toolchain = env::var(WASM_BUILD_TOOLCHAIN).ok(); - - // First check if the user requested a specific toolchain - if let Some(cmd) = wasm_toolchain.and_then(|t| get_rustup_nightly(Some(t))) { - cmd - } else if env_cargo.is_nightly() { - env_cargo - } else if default_cargo.is_nightly() { - default_cargo - } else if rustup_run_nightly.is_nightly() { - rustup_run_nightly - } else { - // If no command before provided us with a nightly compiler, we try to search one - // with rustup. If that fails as well, we return the default cargo and let the prequisities - // check fail. - get_rustup_nightly(None).unwrap_or(default_cargo) - } -} - -/// Get a nightly from rustup. If `selected` is `Some(_)`, a `CargoCommand` using the given -/// nightly is returned. -fn get_rustup_nightly(selected: Option) -> Option { - let host = format!( - "-{}", - env::var("HOST").expect("`HOST` is always set by cargo") - ); - - let version = match selected { - Some(selected) => selected, - None => { - let output = Command::new("rustup") - .args(&["toolchain", "list"]) - .output() - .ok()? - .stdout; - let lines = output.as_slice().lines(); - - let mut latest_nightly = None; - for line in lines.filter_map(|l| l.ok()) { - if line.starts_with("nightly-") && line.ends_with(&host) { - // Rustup prints them sorted - latest_nightly = Some(line.clone()); - } - } - - latest_nightly?.trim_end_matches(&host).into() - } - }; - - Some(CargoCommand::new_with_args( - "rustup", - &["run", &version, "cargo"], - )) -} - -/// Builder for cargo commands -#[derive(Debug)] -struct CargoCommand { - program: String, - args: Vec, -} - -impl CargoCommand { - fn new(program: &str) -> Self { - CargoCommand { - program: program.into(), - args: Vec::new(), - } - } - - fn new_with_args(program: &str, args: &[&str]) -> Self { - CargoCommand { - program: program.into(), - args: args.iter().map(ToString::to_string).collect(), - } - } - - fn command(&self) -> Command { - let mut cmd = Command::new(&self.program); - cmd.args(&self.args); - cmd - } - - /// Check if the supplied cargo command is a nightly version - fn is_nightly(&self) -> bool { - // `RUSTC_BOOTSTRAP` tells a stable compiler to behave like a nightly. So, when this env - // variable is set, we can assume that whatever rust compiler we have, it is a nightly compiler. - // For "more" information, see: - // https://github.com/rust-lang/rust/blob/fa0f7d0080d8e7e9eb20aa9cbf8013f96c81287f/src/libsyntax/feature_gate/check.rs#L891 - env::var("RUSTC_BOOTSTRAP").is_ok() - || self - .command() - .arg("--version") - .output() - .map_err(|_| ()) - .and_then(|o| String::from_utf8(o.stdout).map_err(|_| ())) - .unwrap_or_default() - .contains("-nightly") - } -} diff --git a/utils/wasm-builder/src/prerequisites.rs b/utils/wasm-builder/src/prerequisites.rs deleted file mode 100644 index b5a1e93440..0000000000 --- a/utils/wasm-builder/src/prerequisites.rs +++ /dev/null @@ -1,88 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use std::fs; - -use tempfile::tempdir; - -/// Checks that all prerequisites are installed. -/// -/// # Returns -/// Returns `None` if everything was found and `Some(ERR_MSG)` if something could not be found. -pub fn check() -> Option<&'static str> { - if !check_nightly_installed() { - return Some("Rust nightly not installed, please install it!"); - } - - check_wasm_toolchain_installed() -} - -fn check_nightly_installed() -> bool { - crate::get_nightly_cargo().is_nightly() -} - -fn check_wasm_toolchain_installed() -> Option<&'static str> { - let temp = tempdir().expect("Creating temp dir does not fail; qed"); - fs::create_dir_all(temp.path().join("src")).expect("Creating src dir does not fail; qed"); - - let test_file = temp.path().join("src/lib.rs"); - let manifest_path = temp.path().join("Cargo.toml"); - - fs::write( - &manifest_path, - r#" - [package] - name = "wasm-test" - version = "1.0.0" - edition = "2018" - - [lib] - name = "wasm_test" - crate-type = ["cdylib"] - - [workspace] - "#, - ) - .expect("Writing wasm-test manifest does not fail; qed"); - fs::write(&test_file, "pub fn test() {}").expect("Writing to the test file does not fail; qed"); - - let err_msg = "Rust WASM toolchain not installed, please install it!"; - let manifest_path = manifest_path.display().to_string(); - crate::get_nightly_cargo() - .command() - .args(&[ - "build", - "--target=wasm32-unknown-unknown", - "--manifest-path", - &manifest_path, - ]) - .output() - .map_err(|_| err_msg) - .and_then(|s| { - if s.status.success() { - Ok(()) - } else { - match String::from_utf8(s.stderr) { - Ok(ref err) if err.contains("linker `rust-lld` not found") => { - Err("`rust-lld` not found, please install it!") - } - _ => Err(err_msg), - } - } - }) - .err() -} diff --git a/utils/wasm-builder/src/wasm_project.rs b/utils/wasm-builder/src/wasm_project.rs deleted file mode 100644 index 8fe30c51e0..0000000000 --- a/utils/wasm-builder/src/wasm_project.rs +++ /dev/null @@ -1,685 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use crate::write_file_if_changed; - -use std::{ - borrow::ToOwned, - collections::HashSet, - env, fs, - hash::{Hash, Hasher}, - ops::Deref, - path::{Path, PathBuf}, - process, -}; - -use toml::value::Table; - -use build_helper::rerun_if_changed; - -use cargo_metadata::{Metadata, MetadataCommand}; - -use walkdir::WalkDir; - -use fs2::FileExt; - -use itertools::Itertools; - -/// Holds the path to the bloaty WASM binary. -pub struct WasmBinaryBloaty(PathBuf); - -impl WasmBinaryBloaty { - /// Returns the escaped path to the bloaty wasm binary. - pub fn wasm_binary_bloaty_path_escaped(&self) -> String { - self.0.display().to_string().escape_default().to_string() - } -} - -/// Holds the path to the WASM binary. -pub struct WasmBinary(PathBuf); - -impl WasmBinary { - /// Returns the path to the wasm binary. - pub fn wasm_binary_path(&self) -> &Path { - &self.0 - } - - /// Returns the escaped path to the wasm binary. - pub fn wasm_binary_path_escaped(&self) -> String { - self.0.display().to_string().escape_default().to_string() - } -} - -/// A lock for the WASM workspace. -struct WorkspaceLock(fs::File); - -impl WorkspaceLock { - /// Create a new lock - fn new(wasm_workspace_root: &Path) -> Self { - let lock = fs::OpenOptions::new() - .read(true) - .write(true) - .create(true) - .open(wasm_workspace_root.join("wasm_workspace.lock")) - .expect("Opening the lock file does not fail"); - - lock.lock_exclusive() - .expect("Locking `wasm_workspace.lock` failed"); - - WorkspaceLock(lock) - } -} - -impl Drop for WorkspaceLock { - fn drop(&mut self) { - let _ = self.0.unlock(); - } -} - -/// Creates the WASM project, compiles the WASM binary and compacts the WASM binary. -/// -/// # Returns -/// The path to the compact WASM binary and the bloaty WASM binary. -pub fn create_and_compile( - cargo_manifest: &Path, - default_rustflags: &str, -) -> (WasmBinary, WasmBinaryBloaty) { - let wasm_workspace_root = get_wasm_workspace_root(); - let wasm_workspace = wasm_workspace_root.join("wbuild"); - - // Lock the workspace exclusively for us - let _lock = WorkspaceLock::new(&wasm_workspace_root); - - let crate_metadata = MetadataCommand::new() - .manifest_path(cargo_manifest) - .exec() - .expect("`cargo metadata` can not fail on project `Cargo.toml`; qed"); - - let project = create_project(cargo_manifest, &wasm_workspace, &crate_metadata); - create_wasm_workspace_project(&wasm_workspace, &crate_metadata.workspace_root); - - build_project(&project, default_rustflags); - let (wasm_binary, bloaty) = compact_wasm_file(&project, cargo_manifest, &wasm_workspace); - - copy_wasm_to_target_directory(cargo_manifest, &wasm_binary); - - generate_rerun_if_changed_instructions(cargo_manifest, &project, &wasm_workspace); - - (wasm_binary, bloaty) -} - -/// Find the `Cargo.lock` relative to the `OUT_DIR` environment variable. -/// -/// If the `Cargo.lock` cannot be found, we emit a warning and return `None`. -fn find_cargo_lock(cargo_manifest: &Path) -> Option { - fn find_impl(mut path: PathBuf) -> Option { - loop { - if path.join("Cargo.lock").exists() { - return Some(path.join("Cargo.lock")); - } - - if !path.pop() { - return None; - } - } - } - - if let Some(path) = find_impl(build_helper::out_dir()) { - return Some(path); - } - - if let Some(path) = find_impl(cargo_manifest.to_path_buf()) { - return Some(path); - } - - build_helper::warning!( - "Could not find `Cargo.lock` for `{}`, while searching from `{}`.", - cargo_manifest.display(), - build_helper::out_dir().display() - ); - - None -} - -/// Extract the crate name from the given `Cargo.toml`. -fn get_crate_name(cargo_manifest: &Path) -> String { - let cargo_toml: Table = toml::from_str( - &fs::read_to_string(cargo_manifest).expect("File exists as checked before; qed"), - ) - .expect("Cargo manifest is a valid toml file; qed"); - - let package = cargo_toml - .get("package") - .and_then(|t| t.as_table()) - .expect("`package` key exists in valid `Cargo.toml`; qed"); - - package - .get("name") - .and_then(|p| p.as_str()) - .map(ToOwned::to_owned) - .expect("Package name exists; qed") -} - -/// Returns the name for the wasm binary. -fn get_wasm_binary_name(cargo_manifest: &Path) -> String { - get_crate_name(cargo_manifest).replace('-', "_") -} - -/// Returns the root path of the wasm workspace. -fn get_wasm_workspace_root() -> PathBuf { - let mut out_dir = build_helper::out_dir(); - - loop { - match out_dir.parent() { - Some(parent) if out_dir.ends_with("build") => return parent.to_path_buf(), - _ => { - if !out_dir.pop() { - break; - } - } - } - } - - panic!( - "Could not find target dir in: {}", - build_helper::out_dir().display() - ) -} - -/// Find all workspace members. -/// -/// Each folder in `wasm_workspace` is seen as a member of the workspace. Exceptions are -/// folders starting with "." and the "target" folder. -/// -/// Every workspace member that is not valid anymore is deleted (the folder of it). A -/// member is not valid anymore when the `wasm-project` dependency points to an non-existing -/// folder or the package name is not valid. -fn find_and_clear_workspace_members(wasm_workspace: &Path) -> Vec { - let mut members = WalkDir::new(wasm_workspace) - .min_depth(1) - .max_depth(1) - .into_iter() - .filter_map(|p| p.ok()) - .map(|d| d.into_path()) - .filter(|p| p.is_dir()) - .filter_map(|p| { - p.file_name() - .map(|f| f.to_owned()) - .and_then(|s| s.into_string().ok()) - }) - .filter(|f| !f.starts_with(".") && f != "target") - .collect::>(); - - let mut i = 0; - while i != members.len() { - let path = wasm_workspace.join(&members[i]).join("Cargo.toml"); - - // Extract the `wasm-project` dependency. - // If the path can be extracted and is valid and the package name matches, - // the member is valid. - if let Some(mut wasm_project) = fs::read_to_string(path) - .ok() - .and_then(|s| toml::from_str::(&s).ok()) - .and_then(|mut t| t.remove("dependencies")) - .and_then(|p| p.try_into::
().ok()) - .and_then(|mut t| t.remove("wasm_project")) - .and_then(|p| p.try_into::
().ok()) - { - if let Some(path) = wasm_project - .remove("path") - .and_then(|p| p.try_into::().ok()) - { - if let Some(name) = wasm_project - .remove("package") - .and_then(|p| p.try_into::().ok()) - { - let path = PathBuf::from(path); - if path.exists() { - if name == get_crate_name(&path.join("Cargo.toml")) { - i += 1; - continue; - } - } - } - } - } - - fs::remove_dir_all(wasm_workspace.join(&members[i])) - .expect("Removing invalid workspace member can not fail; qed"); - members.remove(i); - } - - members -} - -fn create_wasm_workspace_project(wasm_workspace: &Path, workspace_root_path: &Path) { - let members = find_and_clear_workspace_members(wasm_workspace); - - let mut workspace_toml: Table = toml::from_str( - &fs::read_to_string(workspace_root_path.join("Cargo.toml")) - .expect("Workspace root `Cargo.toml` exists; qed"), - ) - .expect("Workspace root `Cargo.toml` is a valid toml file; qed"); - - let mut wasm_workspace_toml = Table::new(); - - // Add `profile` with release and dev - let mut release_profile = Table::new(); - release_profile.insert("panic".into(), "abort".into()); - release_profile.insert("lto".into(), true.into()); - - let mut dev_profile = Table::new(); - dev_profile.insert("panic".into(), "abort".into()); - - let mut profile = Table::new(); - profile.insert("release".into(), release_profile.into()); - profile.insert("dev".into(), dev_profile.into()); - - wasm_workspace_toml.insert("profile".into(), profile.into()); - - // Add `workspace` with members - let mut workspace = Table::new(); - workspace.insert("members".into(), members.into()); - - wasm_workspace_toml.insert("workspace".into(), workspace.into()); - - // Add patch section from the project root `Cargo.toml` - if let Some(mut patch) = workspace_toml - .remove("patch") - .and_then(|p| p.try_into::
().ok()) - { - // Iterate over all patches and make the patch path absolute from the workspace root path. - patch - .iter_mut() - .filter_map(|p| { - p.1.as_table_mut() - .map(|t| t.iter_mut().filter_map(|t| t.1.as_table_mut())) - }) - .flatten() - .for_each(|p| { - p.iter_mut() - .filter(|(k, _)| k == &"path") - .for_each(|(_, v)| { - if let Some(path) = v.as_str().map(PathBuf::from) { - if path.is_relative() { - *v = workspace_root_path.join(path).display().to_string().into(); - } - } - }) - }); - - wasm_workspace_toml.insert("patch".into(), patch.into()); - } - - write_file_if_changed( - wasm_workspace.join("Cargo.toml"), - toml::to_string_pretty(&wasm_workspace_toml).expect("Wasm workspace toml is valid; qed"), - ); -} - -/// Find a package by the given `manifest_path` in the metadata. -/// -/// Panics if the package could not be found. -fn find_package_by_manifest_path<'a>( - manifest_path: &Path, - crate_metadata: &'a cargo_metadata::Metadata, -) -> &'a cargo_metadata::Package { - crate_metadata - .packages - .iter() - .find(|p| p.manifest_path == manifest_path) - .expect("Wasm project exists in its own metadata; qed") -} - -/// Get a list of enabled features for the project. -fn project_enabled_features( - cargo_manifest: &Path, - crate_metadata: &cargo_metadata::Metadata, -) -> Vec { - let package = find_package_by_manifest_path(cargo_manifest, crate_metadata); - - let mut enabled_features = package - .features - .keys() - .filter(|f| { - let mut feature_env = f.replace("-", "_"); - feature_env.make_ascii_uppercase(); - - // We don't want to enable the `std`/`default` feature for the wasm build and - // we need to check if the feature is enabled by checking the env variable. - *f != "std" - && *f != "default" - && env::var(format!("CARGO_FEATURE_{}", feature_env)) - .map(|v| v == "1") - .unwrap_or_default() - }) - .cloned() - .collect::>(); - - enabled_features.push("no_std".to_owned()); - enabled_features.sort(); - enabled_features -} - -/// Returns if the project has the `runtime-wasm` feature -fn has_runtime_wasm_feature_declared( - cargo_manifest: &Path, - crate_metadata: &cargo_metadata::Metadata, -) -> bool { - let package = find_package_by_manifest_path(cargo_manifest, crate_metadata); - - package.features.keys().any(|k| k == "runtime-wasm") -} - -/// Create the project used to build the wasm binary. -/// -/// # Returns -/// The path to the created project. -fn create_project( - cargo_manifest: &Path, - wasm_workspace: &Path, - crate_metadata: &Metadata, -) -> PathBuf { - let crate_name = get_crate_name(cargo_manifest); - let crate_path = cargo_manifest.parent().expect("Parent path exists; qed"); - let wasm_binary = get_wasm_binary_name(cargo_manifest); - let project_folder = wasm_workspace.join(&crate_name); - - fs::create_dir_all(project_folder.join("src")) - .expect("Wasm project dir create can not fail; qed"); - - let mut enabled_features = project_enabled_features(&cargo_manifest, &crate_metadata); - - if has_runtime_wasm_feature_declared(cargo_manifest, crate_metadata) { - enabled_features.push("runtime-wasm".into()); - } - - write_file_if_changed( - project_folder.join("Cargo.toml"), - format!( - r#" - [package] - name = "{crate_name}-wasm" - version = "1.0.0" - edition = "2018" - - [lib] - name = "{wasm_binary}" - crate-type = ["cdylib"] - - [dependencies] - wasm_project = {{ package = "{crate_name}", path = "{crate_path}", default-features = false, features = [ {features} ] }} - "#, - crate_name = crate_name, - crate_path = crate_path.display(), - wasm_binary = wasm_binary, - features = enabled_features - .into_iter() - .map(|f| format!("\"{}\"", f)) - .join(","), - ), - ); - - write_file_if_changed( - project_folder.join("src/lib.rs"), - "#![no_std] pub use wasm_project::*;".into(), - ); - - if let Some(crate_lock_file) = find_cargo_lock(cargo_manifest) { - // Use the `Cargo.lock` of the main project. - crate::copy_file_if_changed(crate_lock_file, wasm_workspace.join("Cargo.lock")); - } - - project_folder -} - -/// Returns if the project should be built as a release. -fn is_release_build() -> bool { - if let Ok(var) = env::var(crate::WASM_BUILD_TYPE_ENV) { - match var.as_str() { - "release" => true, - "debug" => false, - var => panic!( - "Unexpected value for `{}` env variable: {}\nOne of the following are expected: `debug` or `release`.", - crate::WASM_BUILD_TYPE_ENV, - var, - ), - } - } else { - true - } -} - -/// Build the project to create the WASM binary. -fn build_project(project: &Path, default_rustflags: &str) { - let manifest_path = project.join("Cargo.toml"); - let mut build_cmd = crate::get_nightly_cargo().command(); - - let rustflags = format!( - "-C link-arg=--export-table {} {}", - default_rustflags, - env::var(crate::WASM_BUILD_RUSTFLAGS_ENV).unwrap_or_default(), - ); - - build_cmd - .args(&["rustc", "--target=wasm32-unknown-unknown"]) - .arg(format!("--manifest-path={}", manifest_path.display())) - .env("RUSTFLAGS", rustflags) - // We don't want to call ourselves recursively - .env(crate::SKIP_BUILD_ENV, ""); - - if env::var(crate::WASM_BUILD_NO_COLOR).is_err() { - build_cmd.arg("--color=always"); - } - - if is_release_build() { - build_cmd.arg("--release"); - }; - - println!("Executing build command: {:?}", build_cmd); - - match build_cmd.status().map(|s| s.success()) { - Ok(true) => {} - // Use `process.exit(1)` to have a clean error output. - _ => process::exit(1), - } -} - -/// Compact the WASM binary using `wasm-gc`. Returns the path to the bloaty WASM binary. -fn compact_wasm_file( - project: &Path, - cargo_manifest: &Path, - wasm_workspace: &Path, -) -> (WasmBinary, WasmBinaryBloaty) { - let target = if is_release_build() { - "release" - } else { - "debug" - }; - let wasm_binary = get_wasm_binary_name(cargo_manifest); - let wasm_file = wasm_workspace - .join("target/wasm32-unknown-unknown") - .join(target) - .join(format!("{}.wasm", wasm_binary)); - let wasm_compact_file = project.join(format!("{}.compact.wasm", wasm_binary)); - - wasm_gc::garbage_collect_file(&wasm_file, &wasm_compact_file) - .expect("Failed to compact generated WASM binary."); - - (WasmBinary(wasm_compact_file), WasmBinaryBloaty(wasm_file)) -} - -/// Custom wrapper for a [`cargo_metadata::Package`] to store it in -/// a `HashSet`. -#[derive(Debug)] -struct DeduplicatePackage<'a> { - package: &'a cargo_metadata::Package, - identifier: String, -} - -impl<'a> From<&'a cargo_metadata::Package> for DeduplicatePackage<'a> { - fn from(package: &'a cargo_metadata::Package) -> Self { - Self { - package, - identifier: format!("{}{}{:?}", package.name, package.version, package.source), - } - } -} - -impl<'a> Hash for DeduplicatePackage<'a> { - fn hash(&self, state: &mut H) { - self.identifier.hash(state); - } -} - -impl<'a> PartialEq for DeduplicatePackage<'a> { - fn eq(&self, other: &Self) -> bool { - self.identifier == other.identifier - } -} - -impl<'a> Eq for DeduplicatePackage<'a> {} - -impl<'a> Deref for DeduplicatePackage<'a> { - type Target = cargo_metadata::Package; - - fn deref(&self) -> &Self::Target { - self.package - } -} - -/// Generate the `rerun-if-changed` instructions for cargo to make sure that the WASM binary is -/// rebuilt when needed. -fn generate_rerun_if_changed_instructions( - cargo_manifest: &Path, - project_folder: &Path, - wasm_workspace: &Path, -) { - // Rerun `build.rs` if the `Cargo.lock` changes - if let Some(cargo_lock) = find_cargo_lock(cargo_manifest) { - rerun_if_changed(cargo_lock); - } - - let metadata = MetadataCommand::new() - .manifest_path(project_folder.join("Cargo.toml")) - .exec() - .expect("`cargo metadata` can not fail!"); - - let package = metadata - .packages - .iter() - .find(|p| p.manifest_path == cargo_manifest) - .expect("The crate package is contained in its own metadata; qed"); - - // Start with the dependencies of the crate we want to compile for wasm. - let mut dependencies = package.dependencies.iter().collect::>(); - - // Collect all packages by follow the dependencies of all packages we find. - let mut packages = HashSet::new(); - packages.insert(DeduplicatePackage::from(package)); - - while let Some(dependency) = dependencies.pop() { - let path_or_git_dep = dependency - .source - .as_ref() - .map(|s| s.starts_with("git+")) - .unwrap_or(true); - - let package = metadata - .packages - .iter() - .filter(|p| !p.manifest_path.starts_with(wasm_workspace)) - .find(|p| { - // Check that the name matches and that the version matches or this is - // a git or path dep. A git or path dependency can only occur once, so we don't - // need to check the version. - (path_or_git_dep || dependency.req.matches(&p.version)) && dependency.name == p.name - }); - - if let Some(package) = package { - if packages.insert(DeduplicatePackage::from(package)) { - dependencies.extend(package.dependencies.iter()); - } - } - } - - // Make sure that if any file/folder of a dependency change, we need to rerun the `build.rs` - packages.iter().for_each(package_rerun_if_changed); - - // Register our env variables - println!("cargo:rerun-if-env-changed={}", crate::SKIP_BUILD_ENV); - println!("cargo:rerun-if-env-changed={}", crate::WASM_BUILD_TYPE_ENV); - println!( - "cargo:rerun-if-env-changed={}", - crate::WASM_BUILD_RUSTFLAGS_ENV - ); - println!( - "cargo:rerun-if-env-changed={}", - crate::WASM_TARGET_DIRECTORY - ); - println!("cargo:rerun-if-env-changed={}", crate::WASM_BUILD_TOOLCHAIN); -} - -/// Track files and paths related to the given package to rerun `build.rs` on any relevant change. -fn package_rerun_if_changed(package: &DeduplicatePackage) { - let mut manifest_path = package.manifest_path.clone(); - if manifest_path.ends_with("Cargo.toml") { - manifest_path.pop(); - } - - WalkDir::new(&manifest_path) - .into_iter() - .filter_entry(|p| { - // Ignore this entry if it is a directory that contains a `Cargo.toml` that is not the - // `Cargo.toml` related to the current package. This is done to ignore sub-crates of a crate. - // If such a sub-crate is a dependency, it will be processed independently anyway. - p.path() == manifest_path || !p.path().is_dir() || !p.path().join("Cargo.toml").exists() - }) - .filter_map(|p| p.ok().map(|p| p.into_path())) - .filter(|p| { - p.is_dir() - || p.extension() - .map(|e| e == "rs" || e == "toml") - .unwrap_or_default() - }) - .for_each(|p| rerun_if_changed(p)); -} - -/// Copy the WASM binary to the target directory set in `WASM_TARGET_DIRECTORY` environment -/// variable. If the variable is not set, this is a no-op. -fn copy_wasm_to_target_directory(cargo_manifest: &Path, wasm_binary: &WasmBinary) { - let target_dir = match env::var(crate::WASM_TARGET_DIRECTORY) { - Ok(path) => PathBuf::from(path), - Err(_) => return, - }; - - if !target_dir.is_absolute() { - panic!( - "Environment variable `{}` with `{}` is not an absolute path!", - crate::WASM_TARGET_DIRECTORY, - target_dir.display(), - ); - } - - fs::create_dir_all(&target_dir).expect("Creates `WASM_TARGET_DIRECTORY`."); - - fs::copy( - wasm_binary.wasm_binary_path(), - target_dir.join(format!("{}.wasm", get_wasm_binary_name(cargo_manifest))), - ) - .expect("Copies WASM binary to `WASM_TARGET_DIRECTORY`."); -}